完善用户信息功能
parent
22ddcb532a
commit
ee69fdc4d6
@ -0,0 +1,7 @@
|
||||
package com.flossom.common.core.constant;
|
||||
|
||||
public class SysRegionConstants {
|
||||
|
||||
public static final int PROVINCE_PID = 0;
|
||||
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package com.flossom.hzMapper.domain;
|
||||
|
||||
import com.flossom.common.core.annotation.Excel;
|
||||
import com.flossom.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 地区列对象 sys_region
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-12
|
||||
*/
|
||||
public class SysRegion extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 表id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 地区名称
|
||||
*/
|
||||
@Excel(name = "地区名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
@Excel(name = "父id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 地区等级
|
||||
*/
|
||||
@Excel(name = "地区等级")
|
||||
private Integer level;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("name", getName())
|
||||
.append("parentId", getParentId())
|
||||
.append("level", getLevel())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.flossom.hzMapper.mapper;
|
||||
|
||||
import com.flossom.hzMapper.domain.SysRegion;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 地区列Mapper接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-12
|
||||
*/
|
||||
public interface SysRegionMapper {
|
||||
/**
|
||||
* 查询地区列
|
||||
*
|
||||
* @param id 地区列主键
|
||||
* @return 地区列
|
||||
*/
|
||||
public SysRegion selectSysRegionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询地区列列表
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 地区列集合
|
||||
*/
|
||||
public List<SysRegion> selectSysRegionList(SysRegion sysRegion);
|
||||
|
||||
/**
|
||||
* 新增地区列
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysRegion(SysRegion sysRegion);
|
||||
|
||||
/**
|
||||
* 修改地区列
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysRegion(SysRegion sysRegion);
|
||||
|
||||
/**
|
||||
* 删除地区列
|
||||
*
|
||||
* @param id 地区列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRegionById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除地区列
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRegionByIds(Long[] ids);
|
||||
|
||||
List<SysRegion> selectSysAreaByPid(@Param("pid") Integer pid);
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flossom.hzMapper.mapper.SysRegionMapper">
|
||||
|
||||
<resultMap type="SysRegion" id="SysRegionResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="parentId" column="parent_id" />
|
||||
<result property="level" column="level" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSysRegionVo">
|
||||
select id, name, parent_id, level from sys_region
|
||||
</sql>
|
||||
|
||||
<select id="selectSysRegionList" parameterType="SysRegion" resultMap="SysRegionResult">
|
||||
<include refid="selectSysRegionVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
||||
<if test="level != null "> and level = #{level}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysRegionById" parameterType="Long" resultMap="SysRegionResult">
|
||||
<include refid="selectSysRegionVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectSysAreaByPid" resultType="com.flossom.hzMapper.domain.SysRegion">
|
||||
<include refid="selectSysRegionVo"/>
|
||||
WHERE
|
||||
parent_id = #{pid}
|
||||
ORDER BY
|
||||
id ASC
|
||||
</select>
|
||||
|
||||
<insert id="insertSysRegion" parameterType="SysRegion" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into sys_region
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="parentId != null">parent_id,</if>
|
||||
<if test="level != null">level,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="parentId != null">#{parentId},</if>
|
||||
<if test="level != null">#{level},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSysRegion" parameterType="SysRegion">
|
||||
update sys_region
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||
<if test="level != null">level = #{level},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSysRegionById" parameterType="Long">
|
||||
delete from sys_region where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSysRegionByIds" parameterType="String">
|
||||
delete from sys_region where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,35 @@
|
||||
package com.flossom.miniProgram.controller;
|
||||
|
||||
import com.flossom.common.core.constant.SysRegionConstants;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.miniProgram.service.ISysRegionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/region")
|
||||
public class SysRegionController {
|
||||
|
||||
@Autowired
|
||||
private ISysRegionService sysRegionService;
|
||||
|
||||
@GetMapping("/getProvince")
|
||||
public AjaxResult getProvince() {
|
||||
return AjaxResult.success(sysRegionService.selectSysAreaByPid(SysRegionConstants.PROVINCE_PID));
|
||||
}
|
||||
|
||||
@GetMapping("/getAreaListByPid")
|
||||
public AjaxResult getAreaListByPid(@RequestParam(value = "pid") Integer pid) {
|
||||
if (pid == null) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.success(sysRegionService.selectSysAreaByPid(pid));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.flossom.miniProgram.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.flossom.common.core.annotation.Excel;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class UserMemberUpdateVo {
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
private String nickname;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String headimg;
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
private Integer province;
|
||||
|
||||
/**
|
||||
* 市
|
||||
*/
|
||||
private Integer city;
|
||||
|
||||
/**
|
||||
* 区
|
||||
*/
|
||||
private Integer area;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.flossom.miniProgram.service;
|
||||
|
||||
import com.flossom.hzMapper.domain.SysRegion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ISysRegionService {
|
||||
|
||||
List<SysRegion> selectSysAreaByPid(Integer pid);
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.flossom.miniProgram.service.impl;
|
||||
|
||||
import com.flossom.hzMapper.domain.SysRegion;
|
||||
import com.flossom.hzMapper.mapper.SysRegionMapper;
|
||||
import com.flossom.miniProgram.service.ISysRegionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysRegionServiceImpl implements ISysRegionService {
|
||||
|
||||
@Autowired
|
||||
private SysRegionMapper sysRegionMapper;
|
||||
|
||||
@Override
|
||||
public List<SysRegion> selectSysAreaByPid(Integer pid) {
|
||||
return sysRegionMapper.selectSysAreaByPid(pid);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
package com.flossom.system.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
import com.flossom.common.core.web.page.TableDataInfo;
|
||||
import com.flossom.common.log.annotation.Log;
|
||||
import com.flossom.common.log.enums.BusinessType;
|
||||
import com.flossom.common.security.annotation.RequiresPermissions;
|
||||
import com.flossom.hzMapper.domain.SysRegion;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.flossom.system.service.ISysRegionService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地区列Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/region")
|
||||
public class SysRegionController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ISysRegionService sysRegionService;
|
||||
|
||||
/**
|
||||
* 查询地区列列表
|
||||
*/
|
||||
@RequiresPermissions("system:region:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRegion sysRegion) {
|
||||
startPage();
|
||||
List<SysRegion> list = sysRegionService.selectSysRegionList(sysRegion);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出地区列列表
|
||||
*/
|
||||
@RequiresPermissions("system:region:export")
|
||||
@Log(title = "地区列", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysRegion sysRegion) {
|
||||
List<SysRegion> list = sysRegionService.selectSysRegionList(sysRegion);
|
||||
ExcelUtil<SysRegion> util = new ExcelUtil<SysRegion>(SysRegion.class);
|
||||
util.exportExcel(response, list, "地区列数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取地区列详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:region:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(sysRegionService.selectSysRegionById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地区列
|
||||
*/
|
||||
@RequiresPermissions("system:region:add")
|
||||
@Log(title = "地区列", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysRegion sysRegion) {
|
||||
return toAjax(sysRegionService.insertSysRegion(sysRegion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地区列
|
||||
*/
|
||||
@RequiresPermissions("system:region:edit")
|
||||
@Log(title = "地区列", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysRegion sysRegion) {
|
||||
return toAjax(sysRegionService.updateSysRegion(sysRegion));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地区列
|
||||
*/
|
||||
@RequiresPermissions("system:region:remove")
|
||||
@Log(title = "地区列", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(sysRegionService.deleteSysRegionByIds(ids));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.flossom.system.service;
|
||||
|
||||
import com.flossom.hzMapper.domain.SysRegion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 地区列Service接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-12
|
||||
*/
|
||||
public interface ISysRegionService {
|
||||
/**
|
||||
* 查询地区列
|
||||
*
|
||||
* @param id 地区列主键
|
||||
* @return 地区列
|
||||
*/
|
||||
public SysRegion selectSysRegionById(Long id);
|
||||
|
||||
/**
|
||||
* 查询地区列列表
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 地区列集合
|
||||
*/
|
||||
public List<SysRegion> selectSysRegionList(SysRegion sysRegion);
|
||||
|
||||
/**
|
||||
* 新增地区列
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSysRegion(SysRegion sysRegion);
|
||||
|
||||
/**
|
||||
* 修改地区列
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSysRegion(SysRegion sysRegion);
|
||||
|
||||
/**
|
||||
* 批量删除地区列
|
||||
*
|
||||
* @param ids 需要删除的地区列主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRegionByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除地区列信息
|
||||
*
|
||||
* @param id 地区列主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSysRegionById(Long id);
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.flossom.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.flossom.hzMapper.domain.SysRegion;
|
||||
import com.flossom.hzMapper.mapper.SysRegionMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.flossom.system.service.ISysRegionService;
|
||||
|
||||
/**
|
||||
* 地区列Service业务层处理
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-12
|
||||
*/
|
||||
@Service
|
||||
public class SysRegionServiceImpl implements ISysRegionService {
|
||||
|
||||
@Autowired
|
||||
private SysRegionMapper sysRegionMapper;
|
||||
|
||||
/**
|
||||
* 查询地区列
|
||||
*
|
||||
* @param id 地区列主键
|
||||
* @return 地区列
|
||||
*/
|
||||
@Override
|
||||
public SysRegion selectSysRegionById(Long id) {
|
||||
return sysRegionMapper.selectSysRegionById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询地区列列表
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 地区列
|
||||
*/
|
||||
@Override
|
||||
public List<SysRegion> selectSysRegionList(SysRegion sysRegion) {
|
||||
return sysRegionMapper.selectSysRegionList(sysRegion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增地区列
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysRegion(SysRegion sysRegion) {
|
||||
return sysRegionMapper.insertSysRegion(sysRegion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改地区列
|
||||
*
|
||||
* @param sysRegion 地区列
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysRegion(SysRegion sysRegion) {
|
||||
return sysRegionMapper.updateSysRegion(sysRegion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除地区列
|
||||
*
|
||||
* @param ids 需要删除的地区列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysRegionByIds(Long[] ids) {
|
||||
return sysRegionMapper.deleteSysRegionByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除地区列信息
|
||||
*
|
||||
* @param id 地区列主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysRegionById(Long id) {
|
||||
return sysRegionMapper.deleteSysRegionById(id);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue