Эх сурвалжийг харах

修改回显字段类型和新增实体

luowei 2 жил өмнө
parent
commit
5dc7a19ef0

+ 78 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SysArea.java

@@ -0,0 +1,78 @@
+package com.xunmei.system.api.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.xunmei.common.core.web.domain.BaseEntity;
+import com.xunmei.system.api.enums.OrgType;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/8/14
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@TableName("sys_area")
+@ApiModel(value = "SysArea对象" , description = "【区域管理实体】")
+public class SysArea extends BaseEntity
+{
+    private static final long serialVersionUID=1L;
+
+    /** $column.columnComment */
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long id;
+
+    /** 名称 */
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    /** 最后修改人id */
+    @ApiModelProperty(value = "最后修改人id")
+    private Long updateId;
+
+    /** 删除标志(0代表存在 2代表删除) */
+    private Long delFlag;
+
+    /** $column.columnComment */
+    @ApiModelProperty(value = "${comment}" , notes = "$column.readConverterExp()")
+    private Long orgType;
+
+
+    @Override
+    public String toString(){
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+
+
+                .append("id" ,getId())
+
+
+                .append("name" ,getName())
+
+
+                .append("createTime" ,getCreateTime())
+
+
+                .append("updateBy" ,getUpdateBy())
+
+
+                .append("updateTime" ,getUpdateTime())
+
+
+                .append("updateId" ,getUpdateId())
+
+
+                .append("delFlag" ,getDelFlag())
+
+
+                .append("orgType" ,getOrgType())
+                .toString();
+    }
+}

+ 56 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/enums/OrgType.java

@@ -0,0 +1,56 @@
+package com.xunmei.system.api.enums;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/8/14
+ */
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.EnumSerializer;
+import com.xunmei.common.core.utils.StringUtils;
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 机构类型
+ */
+@Slf4j
+@JsonSerialize(using = EnumSerializer.class)
+public enum OrgType {
+    YJFX("一级分行", "5a6a1ca2-c55b-4473-abb7-44ae302caf8c"),
+    EJFX("二级分行", "e226dd02-cb0d-45aa-9034-59fa6566239e"),
+    YJZX("一级支行", "87a6b4a5-cd72-4beb-b136-2299d6a85add"),
+    WD("营业网点", "28f4be66-af08-4064-9407-b5b8346bb5af"),
+    ZZ("离行式自助银行", ""),
+    JK("金库", ""),
+    BGDL("办公大楼", ""),
+    JKZX("视频监控中心", ""),
+    YQ("园区", ""),
+    OTHER("其他", ""),
+    XJZX("现金中心","");
+    @Getter
+    private final String text;
+
+    private final String guid;
+
+    OrgType(final String text, final String guid) {
+        this.text = text;
+        this.guid = guid;
+    }
+
+    public static OrgType findByGuid(final String guid) {
+        if (StringUtils.isBlank(guid)) {
+            return null;
+        }
+        for (final OrgType orgType : OrgType.values()) {
+            if (StringUtils.equalsIgnoreCase(orgType.name(), guid)) {
+                return orgType;
+            }
+            if (StringUtils.equalsIgnoreCase(orgType.guid, guid)) {
+                return orgType;
+            }
+        }
+        //ORGLOG.warn("[ {} ]没有对应机构类型", guid);
+        return null;
+    }
+}

+ 92 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysAreaController.java

@@ -0,0 +1,92 @@
+package com.xunmei.system.controller;
+
+
+
+import com.xunmei.system.api.domain.SysArea;
+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.xunmei.common.log.annotation.Log;
+import com.xunmei.common.log.enums.BusinessType;
+import com.xunmei.common.security.annotation.RequiresPermissions;
+import com.xunmei.system.service.ISysAreaService;
+import com.xunmei.common.core.web.controller.BaseController;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 【请填写功能名称】Controller
+ *
+ * @author xunmei
+ * @date 2023-08-14
+ */
+@Api(tags = {"SysArea" })
+@RestController
+@RequestMapping("/area")
+public class SysAreaController extends BaseController {
+    @Autowired
+    private ISysAreaService sysAreaService;
+
+/**
+ * 查询【请填写功能名称】列表
+ */
+@ApiOperation(value = "查询SysArea列表")
+@RequiresPermissions("system:area:list")
+@GetMapping("/list")
+    public TableDataInfo list(SysArea sysArea) {
+
+        return sysAreaService.selectPage( sysArea);
+    }
+
+                                                
+    /**
+     * 获取【请填写功能名称】详细信息
+     */
+    @ApiOperation(value = "获取SysArea详细信息")
+    @RequiresPermissions("system:area:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(sysAreaService.selectSysAreaById(id));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     */
+    @ApiOperation(value = "新增SysArea")
+    @RequiresPermissions("system:area:add")
+    @Log(title = "【请填写功能名称】" , businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody SysArea sysArea) {
+        return toAjax(sysAreaService.insertSysArea(sysArea));
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     */
+    @ApiOperation(value = "修改SysArea")
+    @RequiresPermissions("system:area:edit")
+    @Log(title = "【请填写功能名称】" , businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody SysArea sysArea) {
+        return toAjax(sysAreaService.updateSysArea(sysArea));
+    }
+
+    /**
+     * 删除【请填写功能名称】
+     */
+    @ApiOperation(value = "删除SysArea")
+    @RequiresPermissions("system:area:remove")
+    @Log(title = "【请填写功能名称】" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(sysAreaService.deleteSysAreaByIds(ids));
+    }
+}

+ 0 - 2
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysRoleController.java

@@ -15,12 +15,10 @@ import com.xunmei.system.domain.SysUserRole;
 import com.xunmei.system.service.ISysDeptService;
 import com.xunmei.system.service.ISysRoleService;
 import com.xunmei.system.service.ISysUserService;
-import org.apache.ibatis.annotations.Delete;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**

+ 13 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/domain/vo/SysUserVO.java

@@ -0,0 +1,13 @@
+package com.xunmei.system.domain.vo;
+
+import com.xunmei.system.api.domain.SysUser;
+import lombok.Data;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/8/14
+ */
+@Data
+public class SysUserVO extends SysUser {
+    private Long roleId;
+}

+ 64 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysAreaMapper.java

@@ -0,0 +1,64 @@
+package com.xunmei.system.mapper;
+
+import java.util.List;
+
+import com.xunmei.system.api.domain.SysArea;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author xunmei
+ * @date 2023-08-14
+ */
+@Mapper
+public interface SysAreaMapper extends BaseMapper<SysArea> {
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public SysArea selectSysAreaById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<SysArea> selectSysAreaList(SysArea sysArea);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertSysArea(SysArea sysArea);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateSysArea(SysArea sysArea);
+
+    /**
+     * 删除【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteSysAreaById(Long id);
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteSysAreaByIds(Long[] ids);
+}

+ 71 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysAreaService.java

@@ -0,0 +1,71 @@
+package com.xunmei.system.service;
+
+import java.util.List;
+
+import com.xunmei.system.api.domain.SysArea;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.xunmei.common.core.web.page.TableDataInfo;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author xunmei
+ * @date 2023-08-14
+ */
+public interface ISysAreaService extends IService<SysArea> {
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public SysArea selectSysAreaById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<SysArea> selectSysAreaList(SysArea sysArea);
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertSysArea(SysArea sysArea);
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateSysArea(SysArea sysArea);
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的【请填写功能名称】主键集合
+     * @return 结果
+     */
+    public int deleteSysAreaByIds(Long[] ids);
+
+    /**
+     * 删除【请填写功能名称】信息
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteSysAreaById(Long id);
+
+    /**
+     * 查询【请填写功能名称】分页数据
+     *
+     * @param sysArea 查询条件对象
+     * @return Page
+     */
+    public TableDataInfo selectPage(SysArea sysArea);
+}

+ 151 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysAreaServiceImpl.java

@@ -0,0 +1,151 @@
+package com.xunmei.system.service.impl;
+
+import java.util.List;
+
+import com.xunmei.common.core.utils.DateUtils;
+import com.xunmei.common.security.utils.SecurityUtils;
+import com.xunmei.system.api.domain.SysArea;
+import com.xunmei.system.api.model.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.xunmei.system.service.ISysOrgService;
+
+import java.util.Arrays;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.system.mapper.SysAreaMapper;
+import com.xunmei.system.service.ISysAreaService;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author xunmei
+ * @date 2023-08-14
+ */
+@Service
+public class SysAreaServiceImpl extends ServiceImpl<SysAreaMapper, SysArea> implements ISysAreaService {
+    @Autowired
+    private SysAreaMapper sysAreaMapper;
+    @Autowired
+    private ISysOrgService orgService;
+
+    @Override
+    public TableDataInfo selectPage(SysArea sysArea) {
+
+
+        //未删除
+        sysArea.setDelFlag(0L);
+        Page<SysArea> page;
+        //分页
+        if (sysArea.getPageNum() != null && sysArea.getPageSize() != null) {
+            page = new Page<>(sysArea.getPageNum(), sysArea.getPageSize());
+        } else {
+            page = new Page<>();
+        }
+        //查询条件
+        QueryWrapper<SysArea> query = new QueryWrapper<>(sysArea);
+        //下穿
+        if (sysArea.getCheckSub()) {
+            List<Long> ids = orgService.selectCheckSubOrgIdList(sysArea.getOrgType());
+            //清空前端传递的org_id
+            sysArea.setOrgType(null);
+            //添加in条件
+            query.in("org_type", ids);
+        }
+        //时间范围查询
+        if (sysArea.getParams().get("beginTime") != null && sysArea.getParams().get("endTime") != null) {
+            query.between("create_time", sysArea.getParams().get("beginTime"), sysArea.getParams().get("endTime"));
+        }
+        //获取数据
+        page = sysAreaMapper.selectPage(page, query);
+        //抓换为TableDataInfo适配前端
+        TableDataInfo tableDataInfo = new TableDataInfo();
+        tableDataInfo.setMsg("操作成功");
+        tableDataInfo.setCode(200);
+        tableDataInfo.setTotal(page.getTotal());
+        tableDataInfo.setRows(page.getRecords());
+        return tableDataInfo;
+
+
+    }
+
+
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public SysArea selectSysAreaById(Long id) {
+        return sysAreaMapper.selectById(id);
+    }
+
+    /**
+     * 查询【请填写功能名称】列表
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public List<SysArea> selectSysAreaList(SysArea sysArea) {
+        return sysAreaMapper.selectList(new QueryWrapper<>(sysArea));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int insertSysArea(SysArea sysArea) {
+        sysArea.setCreateTime(DateUtils.getNowDate());
+        sysArea.setUpdateTime(DateUtils.getNowDate());
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        sysArea.setCreateBy(loginUser.getUsername());
+        sysArea.setUpdateBy(loginUser.getUsername());
+        sysArea.setUpdateId(loginUser.getUserid());
+        return sysAreaMapper.insert(sysArea);
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     *
+     * @param sysArea 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int updateSysArea(SysArea sysArea) {
+        sysArea.setUpdateTime(DateUtils.getNowDate());
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        sysArea.setUpdateBy(loginUser.getUsername());
+        sysArea.setUpdateId(loginUser.getUserid());
+        return sysAreaMapper.updateById(sysArea);
+    }
+
+    /**
+     * 批量删除【请填写功能名称】
+     *
+     * @param ids 需要删除的【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysAreaByIds(Long[] ids) {
+        return sysAreaMapper.deleteBatchIds(Arrays.asList((ids)));
+    }
+
+    /**
+     * 删除【请填写功能名称】信息
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteSysAreaById(Long id) {
+        return sysAreaMapper.deleteById(id);
+    }
+}

+ 120 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysAreaMapper.xml

@@ -0,0 +1,120 @@
+<?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.xunmei.system.mapper.SysAreaMapper">
+
+    <resultMap type="com.xunmei.system.api.domain.SysArea" id="SysAreaResult">
+                <result property="id" column="id"/>
+                <result property="name" column="name"/>
+                <result property="createTime" column="create_time"/>
+                <result property="updateBy" column="update_by"/>
+                <result property="updateTime" column="update_time"/>
+                <result property="updateId" column="update_id"/>
+                <result property="delFlag" column="del_flag"/>
+                <result property="orgType" column="org_type"/>
+    </resultMap>
+
+    <sql id="selectSysAreaVo">
+        select id, name, create_time, update_by, update_time, update_id, del_flag, org_type
+        from sys_area
+    </sql>
+
+    <select id="selectSysAreaList" parameterType="com.xunmei.system.api.domain.SysArea"
+            resultMap="SysAreaResult">
+        <include refid="selectSysAreaVo"/>
+        <where>
+                        <if test="name != null  and name != ''">
+                            and name like concat('%', #{name}, '%')
+                        </if>
+                        <if test="updateId != null ">
+                            and update_id = #{updateId}
+                        </if>
+                        <if test="orgType != null ">
+                            and org_type = #{orgType}
+                        </if>
+        </where>
+    </select>
+
+    <select id="selectSysAreaById" parameterType="Long"
+            resultMap="SysAreaResult">
+            <include refid="selectSysAreaVo"/>
+            where id = #{id}
+    </select>
+
+    <insert id="insertSysArea" parameterType="com.xunmei.system.api.domain.SysArea"            useGeneratedKeys="true" keyProperty="id">
+        insert into sys_area
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test="name != null">name,
+                    </if>
+                    <if test="createTime != null">create_time,
+                    </if>
+                    <if test="updateBy != null">update_by,
+                    </if>
+                    <if test="updateTime != null">update_time,
+                    </if>
+                    <if test="updateId != null">update_id,
+                    </if>
+                    <if test="delFlag != null">del_flag,
+                    </if>
+                    <if test="orgType != null">org_type,
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test="name != null">#{name},
+                    </if>
+                    <if test="createTime != null">#{createTime},
+                    </if>
+                    <if test="updateBy != null">#{updateBy},
+                    </if>
+                    <if test="updateTime != null">#{updateTime},
+                    </if>
+                    <if test="updateId != null">#{updateId},
+                    </if>
+                    <if test="delFlag != null">#{delFlag},
+                    </if>
+                    <if test="orgType != null">#{orgType},
+                    </if>
+        </trim>
+    </insert>
+
+    <update id="updateSysArea" parameterType="com.xunmei.system.api.domain.SysArea">
+        update sys_area
+        <trim prefix="SET" suffixOverrides=",">
+                    <if test="name != null">name =
+                        #{name},
+                    </if>
+                    <if test="createTime != null">create_time =
+                        #{createTime},
+                    </if>
+                    <if test="updateBy != null">update_by =
+                        #{updateBy},
+                    </if>
+                    <if test="updateTime != null">update_time =
+                        #{updateTime},
+                    </if>
+                    <if test="updateId != null">update_id =
+                        #{updateId},
+                    </if>
+                    <if test="delFlag != null">del_flag =
+                        #{delFlag},
+                    </if>
+                    <if test="orgType != null">org_type =
+                        #{orgType},
+                    </if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteSysAreaById" parameterType="Long">
+        delete
+        from sys_area where id = #{id}
+    </delete>
+
+    <delete id="deleteSysAreaByIds" parameterType="String">
+        delete from sys_area where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 13 - 13
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -5,9 +5,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.xunmei.system.mapper.SysUserMapper">
 
     <resultMap type="com.xunmei.system.api.domain.SysUser" id="SysUserResult">
-        <id     property="id"       column="user_id"      />
+        <id     property="id"       column="id"      />
         <result property="deptId"       column="dept_id"      />
-        <result property="userName"     column="user_name"    />
+        <result property="username"     column="user_name"    />
         <result property="nickName"     column="nick_name"    />
         <result property="email"        column="email"        />
         <result property="phonenumber"  column="phonenumber"  />
@@ -85,18 +85,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		${params.dataScope}
 	</select>
 	
-	<select id="selectAllocatedList" parameterType="com.xunmei.system.api.domain.SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
-	    from sys_user u
-			 left join sys_dept d on u.dept_id = d.dept_id
-			 left join sys_user_role ur on u.user_id = ur.user_id
-			 left join sys_role r on r.role_id = ur.role_id
-	    where u.del_flag = '0' and r.role_id = #{roleId}
-	    <if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
+	<select id="selectAllocatedList" parameterType="com.xunmei.system.domain.vo.SysUserVO" resultMap="SysUserResult">
+		select distinct u.id as  id, u.dept_id as deptId, u.username as  username, u.phone as  phone, u.create_time as createTime
+		from sys_user u
+		left join sys_dept d on u.dept_id = d.dept_id
+		left join sys_user_role ur on u.id = ur.user_id
+		left join sys_role r on r.id = ur.role_id
+		where u.deleted = '0'  and r.id = #{roleId}
+	    <if test="username != null and username != ''">
+			AND u.username like concat('%', #{username}, '%')
 		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
+		<if test="phone != null and phone != ''">
+			AND u.phone like concat('%', #{phone}, '%')
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}