yzc пре 11 месеци
родитељ
комит
276fe1e503

+ 28 - 15
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -219,7 +219,7 @@ public class SysUser extends BaseEntity {
     /**
     /**
      * 10实习员工、20试用员工、30正式员工
      * 10实习员工、20试用员工、30正式员工
      */
      */
-    private String employeeType;
+    private Integer employeeType;
     /**
     /**
      * 试用期薪资比例
      * 试用期薪资比例
      */
      */
@@ -233,6 +233,10 @@ public class SysUser extends BaseEntity {
      */
      */
     private BigDecimal amount;
     private BigDecimal amount;
     /**
     /**
+     * 计件薪资
+     */
+    private BigDecimal perfAmount;
+    /**
      * 学历
      * 学历
      */
      */
     private String education;
     private String education;
@@ -245,6 +249,11 @@ public class SysUser extends BaseEntity {
      */
      */
     private Integer probationPeriod;
     private Integer probationPeriod;
     /**
     /**
+     * 入职日期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+    private Date entryDate;
+    /**
      * 生效日期
      * 生效日期
      */
      */
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
     @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
@@ -265,22 +274,22 @@ public class SysUser extends BaseEntity {
     /**
     /**
      * 上午开始工作时间
      * 上午开始工作时间
      */
      */
-    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
     private Date morningBeginTime;
     private Date morningBeginTime;
     /**
     /**
      * 上午结束工作时间
      * 上午结束工作时间
      */
      */
-    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
     private Date morningEndTime;
     private Date morningEndTime;
     /**
     /**
      * 下午开始工作时间
      * 下午开始工作时间
      */
      */
-    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
     private Date afternoonBeginTime;
     private Date afternoonBeginTime;
     /**
     /**
      * 下午结束工作时间
      * 下午结束工作时间
      */
      */
-    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "HH:mm")
     private Date afternoonEndTime;
     private Date afternoonEndTime;
     /**
     /**
      * 薪资结算方式
      * 薪资结算方式
@@ -290,11 +299,6 @@ public class SysUser extends BaseEntity {
      * 薪资说明
      * 薪资说明
      */
      */
     private String salaryRemark;
     private String salaryRemark;
-    /**
-     * 入职时间
-     */
-    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
-    private Date entryDate;
 
 
 
 
     //==================================================
     //==================================================
@@ -321,6 +325,19 @@ public class SysUser extends BaseEntity {
 
 
     //================================================================
     //================================================================
 
 
+
+    public void setEmployeeType(Integer employeeType) {
+        this.employeeType = employeeType;
+    }
+
+    public BigDecimal getPerfAmount() {
+        return perfAmount;
+    }
+
+    public void setPerfAmount(BigDecimal perfAmount) {
+        this.perfAmount = perfAmount;
+    }
+
     public Date getEntryDate() {
     public Date getEntryDate() {
         return entryDate;
         return entryDate;
     }
     }
@@ -345,14 +362,10 @@ public class SysUser extends BaseEntity {
         this.jdSubjectName = jdSubjectName;
         this.jdSubjectName = jdSubjectName;
     }
     }
 
 
-    public String getEmployeeType() {
+    public Integer getEmployeeType() {
         return employeeType;
         return employeeType;
     }
     }
 
 
-    public void setEmployeeType(String employeeType) {
-        this.employeeType = employeeType;
-    }
-
     public Integer getProbationRatio() {
     public Integer getProbationRatio() {
         return probationRatio;
         return probationRatio;
     }
     }

+ 458 - 441
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.SysUserMapper">
 <mapper namespace="com.ruoyi.system.mapper.SysUserMapper">
 
 
     <resultMap type="SysUser" id="SysUserResult">
     <resultMap type="SysUser" id="SysUserResult">
@@ -25,270 +25,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateTime" column="update_time"/>
         <result property="updateTime" column="update_time"/>
         <result property="remark" column="remark"/>
         <result property="remark" column="remark"/>
         <result property="tenantId" column="tenant_id"/>
         <result property="tenantId" column="tenant_id"/>
-		<result property="jobNumber"    column="job_number"	  />
-		<result property="userCode" column="user_code"/>
-		<result property="userType"     column="user_type"	  />
-		<result property="companyId"     column="company_id"	  />
-		<result property="ofCompanyId"     column="company_id"	  />
-		<result property="companySet"     column="company_set"	  />
-		<result property="accountName"     column="account_name"	  />
-		<result property="accountBank"     column="account_bank"	  />
-		<result property="accountNumber"     column="account_number"	  />
-		<result property="purchaseRange"     column="purchase_range"	  />
-		<result property="saleLv"     column="sale_lv"	  />
-		<result property="identity"     column="identity"	  />
-		<result property="jdSubjectCode"     column="jd_subject_code"	  />
-		<result property="jdSubjectName"     column="jd_subject_name"	  />
-		<association property="dept"    column="dept_id" javaType="SysDept" resultMap="deptResult" />
-        <collection  property="roles"   javaType="java.util.List"           resultMap="RoleResult" />
-	</resultMap>
-	
-    <resultMap id="deptResult" type="SysDept">
-		<id property="deptId" column="dept_id"/>
-		<result property="parentId" column="parent_id"/>
-		<result property="deptName" column="dept_name"/>
-		<result property="ancestors" column="ancestors"/>
-		<result property="orderNum" column="order_num"/>
-		<result property="leaderId" column="leader_id"/>
-		<result property="directorId" column="director_id"/>
-		<result property="type" column="type"/>
-		<result property="status" column="dept_status"/>
-	</resultMap>
-	
-    <resultMap id="RoleResult" type="SysRole">
-        <id     property="roleId"       column="role_id"        />
-        <result property="roleName"     column="role_name"      />
-        <result property="roleKey"      column="role_key"       />
-        <result property="roleSort"     column="role_sort"      />
-        <result property="dataScope"     column="data_scope"    />
-        <result property="status"       column="role_status"    />
+        <result property="jobNumber" column="job_number"/>
+        <result property="userCode" column="user_code"/>
+        <result property="userType" column="user_type"/>
+        <result property="companyId" column="company_id"/>
+        <result property="ofCompanyId" column="company_id"/>
+        <result property="companySet" column="company_set"/>
+        <result property="accountName" column="account_name"/>
+        <result property="accountBank" column="account_bank"/>
+        <result property="accountNumber" column="account_number"/>
+        <result property="purchaseRange" column="purchase_range"/>
+        <result property="saleLv" column="sale_lv"/>
+        <result property="identity" column="identity"/>
+        <result property="jdSubjectCode" column="jd_subject_code"/>
+        <result property="jdSubjectName" column="jd_subject_name"/>
+        <result property="education" column="education"/>
+        <result property="post" column="post"/>
+        <association property="dept" column="dept_id" javaType="SysDept" resultMap="deptResult"/>
+        <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
     </resultMap>
     </resultMap>
 
 
-	<sql id="selectUserVo">
-		select u.user_id,
-			   u.dept_id,
-			   u.user_name,
-			   u.nick_name,
-			   u.nick_name_en,
-			   u.email,
-			   u.avatar,
-			   u.phonenumber,
-			   u.password,
-			   u.sex,
-			   u.status,
-			   u.del_flag,
-			   u.login_ip,
-			   u.login_date,
-			   u.create_by,
-			   u.create_time,
-			   u.remark,
-			   u.tenant_id,
-			   u.user_code,
-			   u.company_id,
-			   u.company_id as ofCompanyId,
-			   u.company_set,
-			   u.account_name,u.account_bank,u.account_number,u.purchase_range,u.sale_lv,u.identity,
-			   u.jd_subject_code,u.jd_subject_name,
-			   u.employee_type,
-			   u.probation_ratio,
-			   u.internship_ratio,
-			   u.amount,
-			   u.education,
-			   u.post,
-			   u.probation_period,
-			   u.entry_date,
-			   u.effective_date,
-			   u.full_time_date,
-			   u.month_rest,
-			   u.daily_hours,
-			   u.morning_begin_time,
-			   u.morning_end_time,
-			   u.afternoon_begin_time,
-			   u.afternoon_end_time,
-			   u.settle_method,
-			   u.salary_remark,
-			   d.dept_id,
-			   d.parent_id,
-			   d.ancestors,
-			   d.dept_name,
-			   d.order_num,
-			   d.leader_id,
-			   d.director_id,
-			   d.type,
-			   d.status as dept_status,
-			   r.role_id,
-			   r.role_name,
-			   r.role_key,
-			   r.role_sort,
-			   r.data_scope,
-			   r.status as role_status
-		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
-	</sql>
-
-	<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
-		select
-		u.user_id, u.dept_id, u.nick_name, u.nick_name_en, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status,
-		u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader_id,
-		d.director_id, d.type,u.job_number,u.user_type,u.tenant_id,u.user_code,u.company_id,u.company_set,
-		u.account_name,u.account_bank,u.account_number,u.purchase_range,u.sale_lv,u.identity,
-		u.jd_subject_code,u.jd_subject_name,
-		u.employee_type,
-		u.probation_ratio,
-		u.internship_ratio,
-		u.amount,
-		u.education,
-		u.post,
-		u.probation_period,
-		u.entry_date,
-		u.effective_date,
-		u.full_time_date,
-		u.month_rest,
-		u.daily_hours,
-		u.morning_begin_time,
-		u.morning_end_time,
-		u.afternoon_begin_time,
-		u.afternoon_end_time,
-		u.settle_method,
-		u.salary_remark
-		from
-		sys_user u
-		left join sys_dept d on u.dept_id = d.dept_id
-		where u.del_flag = '0'
-		<if test="userId != null and userId != 0">
-			AND u.user_id = #{userId}
-		</if>
-		<if test="jobNumber != null and jobNumber != 0">
-			AND u.job_number = #{jobNumber}
-		</if>
-		<if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
-		</if>
-		<if test="status != null and status != ''">
-			AND u.status = #{status}
-		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
-		</if>
-		<if test="tenantId != null and tenantId != ''">
-			AND u.tenant_id = #{tenantId}
-		</if>
-		<if test="userType != null and userType != ''">
-			AND u.user_type = #{userType}
-		</if>
-		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
-		</if>
-		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
-		</if>
-		<if test="deptId != null and deptId != 0">
-			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
-			ancestors) ))
-		</if>
-		<if test="keyword != null and keyword != ''">
-			AND (instr(u.nick_name,#{keyword}) or instr(u.user_name,#{keyword}) or u.user_id in (SELECT DISTINCT ur.user_id FROM sys_user_role ur JOIN sys_role r ON ur.role_id = r.role_id WHERE instr(r.role_name,#{keyword})))
-		</if>
-		<if test="nickName != null and nickName != ''">
-			AND instr(u.nick_name,#{nickName})
-		</if>
-		<if test="roleId != null">
-			AND u.user_id IN (select t.user_id from sys_user_role t where t.role_id = #{roleId})
-		</if>
-		<if test="jobNumber != null and jobNumber != ''">
-			AND instr(u.job_number,#{jobNumber})
-		</if>
-		<if test="companyId != null">
-			AND u.company_id = #{companyId}
-		</if>
-		<if test="identity != null">
-			AND u.identity = #{identity}
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-	</select>
-	
-	<select id="selectAllocatedList" parameterType="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,
-		u.user_code
-		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}, '%')
-		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-	</select>
-	
-	<select id="selectUnallocatedList" parameterType="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,
-		u.user_code
-		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} or r.role_id IS NULL)
-		and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and
-		ur.role_id = #{roleId})
-		<if test="userName != null and userName != ''">
-			AND u.user_name like concat('%', #{userName}, '%')
-		</if>
-		<if test="phonenumber != null and phonenumber != ''">
-			AND u.phonenumber like concat('%', #{phonenumber}, '%')
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-	</select>
-
-	<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
-		<include refid="selectUserVo"/>
-		where u.user_name = #{userName} and u.tenant_id = #{tenantId} and u.del_flag = '0'
-	</select>
-	
-	<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
-		<include refid="selectUserVo"/>
-		where u.user_id = #{userId}
-	</select>
-	
-	<select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
-        select user_id, user_name
-        from sys_user
-        where user_name = #{userName}
-        <if test="tenantId != null and tenantId != ''">
-            and tenant_id = #{tenantId}
-        </if>
-        and del_flag = '0'
-        limit 1
-    </select>
+    <resultMap id="deptResult" type="SysDept">
+        <id property="deptId" column="dept_id"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="ancestors" column="ancestors"/>
+        <result property="orderNum" column="order_num"/>
+        <result property="leaderId" column="leader_id"/>
+        <result property="directorId" column="director_id"/>
+        <result property="type" column="type"/>
+        <result property="status" column="dept_status"/>
+    </resultMap>
 
 
-	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, phonenumber
-		from sys_user
-		where phonenumber = #{phonenumber}
-		  and del_flag = '0'
-		limit 1
-	</select>
+    <resultMap id="RoleResult" type="SysRole">
+        <id property="roleId" column="role_id"/>
+        <result property="roleName" column="role_name"/>
+        <result property="roleKey" column="role_key"/>
+        <result property="roleSort" column="role_sort"/>
+        <result property="dataScope" column="data_scope"/>
+        <result property="status" column="role_status"/>
+    </resultMap>
 
 
-	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
-		select user_id, email
-		from sys_user
-		where email = #{email}
-		  and del_flag = '0'
-		limit 1
-	</select>
-	<select id="getListByPostId" resultType="com.ruoyi.common.core.domain.entity.SysUser">
+    <sql id="selectUserVo">
         select u.user_id,
         select u.user_id,
                u.dept_id,
                u.dept_id,
                u.user_name,
                u.user_name,
                u.nick_name,
                u.nick_name,
+               u.nick_name_en,
                u.email,
                u.email,
                u.avatar,
                u.avatar,
                u.phonenumber,
                u.phonenumber,
@@ -302,44 +85,270 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                u.create_time,
                u.create_time,
                u.remark,
                u.remark,
                u.tenant_id,
                u.tenant_id,
-               u.user_code
+               u.user_code,
+               u.company_id,
+               u.company_id as ofCompanyId,
+               u.company_set,
+               u.account_name,
+               u.account_bank,
+               u.account_number,
+               u.purchase_range,
+               u.sale_lv,
+               u.identity,
+               u.jd_subject_code,
+               u.jd_subject_name,
+               u.employee_type,
+               u.probation_ratio,
+               u.internship_ratio,
+               u.amount,
+               u.education,
+               u.post,
+               u.probation_period,
+               u.entry_date,
+               u.effective_date,
+               u.full_time_date,
+               u.month_rest,
+               u.daily_hours,
+               u.morning_begin_time,
+               u.morning_end_time,
+               u.afternoon_begin_time,
+               u.afternoon_end_time,
+               u.settle_method,
+               u.salary_remark,
+               d.dept_id,
+               d.parent_id,
+               d.ancestors,
+               d.dept_name,
+               d.order_num,
+               d.leader_id,
+               d.director_id,
+               d.type,
+               d.status     as dept_status,
+               r.role_id,
+               r.role_name,
+               r.role_key,
+               r.role_sort,
+               r.data_scope,
+               r.status     as role_status
+        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
+    </sql>
+
+    <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
+        select
+        u.user_id, u.dept_id, u.nick_name, u.nick_name_en, u.user_name, u.email, u.avatar, u.phonenumber, u.sex,
+        u.status,
+        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader_id,
+        d.director_id, d.type,u.job_number,u.user_type,u.tenant_id,u.user_code,u.company_id,u.company_set,
+        u.account_name,u.account_bank,u.account_number,u.purchase_range,u.sale_lv,u.identity,
+        u.jd_subject_code,u.jd_subject_name,
+        u.employee_type,
+        u.probation_ratio,
+        u.internship_ratio,
+        u.amount,
+        u.education,
+        u.post,
+        u.probation_period,
+        u.entry_date,
+        u.effective_date,
+        u.full_time_date,
+        u.month_rest,
+        u.daily_hours,
+        u.morning_begin_time,
+        u.morning_end_time,
+        u.afternoon_begin_time,
+        u.afternoon_end_time,
+        u.settle_method,
+        u.salary_remark
+        from
+        sys_user u
+        left join sys_dept d on u.dept_id = d.dept_id
+        where u.del_flag = '0'
+        <if test="userId != null and userId != 0">
+            AND u.user_id = #{userId}
+        </if>
+        <if test="jobNumber != null and jobNumber != 0">
+            AND u.job_number = #{jobNumber}
+        </if>
+        <if test="userName != null and userName != ''">
+            AND u.user_name like concat('%', #{userName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND u.status = #{status}
+        </if>
+        <if test="phonenumber != null and phonenumber != ''">
+            AND u.phonenumber like concat('%', #{phonenumber}, '%')
+        </if>
+        <if test="tenantId != null and tenantId != ''">
+            AND u.tenant_id = #{tenantId}
+        </if>
+        <if test="userType != null and userType != ''">
+            AND u.user_type = #{userType}
+        </if>
+        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+            AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+        </if>
+        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+            AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+        </if>
+        <if test="deptId != null and deptId != 0">
+            AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId},
+            ancestors) ))
+        </if>
+        <if test="keyword != null and keyword != ''">
+            AND (instr(u.nick_name,#{keyword}) or instr(u.user_name,#{keyword}) or u.user_id in (SELECT DISTINCT
+            ur.user_id FROM sys_user_role ur JOIN sys_role r ON ur.role_id = r.role_id WHERE
+            instr(r.role_name,#{keyword})))
+        </if>
+        <if test="nickName != null and nickName != ''">
+            AND instr(u.nick_name,#{nickName})
+        </if>
+        <if test="roleId != null">
+            AND u.user_id IN (select t.user_id from sys_user_role t where t.role_id = #{roleId})
+        </if>
+        <if test="jobNumber != null and jobNumber != ''">
+            AND instr(u.job_number,#{jobNumber})
+        </if>
+        <if test="companyId != null">
+            AND u.company_id = #{companyId}
+        </if>
+        <if test="identity != null">
+            AND u.identity = #{identity}
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectAllocatedList" parameterType="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,
+        u.user_code
+        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}, '%')
+        </if>
+        <if test="phonenumber != null and phonenumber != ''">
+            AND u.phonenumber like concat('%', #{phonenumber}, '%')
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectUnallocatedList" parameterType="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,
+        u.user_code
+        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} or r.role_id IS NULL)
+        and u.user_id not in (select u.user_id from sys_user u inner join sys_user_role ur on u.user_id = ur.user_id and
+        ur.role_id = #{roleId})
+        <if test="userName != null and userName != ''">
+            AND u.user_name like concat('%', #{userName}, '%')
+        </if>
+        <if test="phonenumber != null and phonenumber != ''">
+            AND u.phonenumber like concat('%', #{phonenumber}, '%')
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
+        <include refid="selectUserVo"/>
+        where u.user_name = #{userName} and u.tenant_id = #{tenantId} and u.del_flag = '0'
+    </select>
+
+    <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
+        <include refid="selectUserVo"/>
+        where u.user_id = #{userId}
+    </select>
+
+    <select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
+        select user_id, user_name
+        from sys_user
+        where user_name = #{userName}
+        <if test="tenantId != null and tenantId != ''">
+            and tenant_id = #{tenantId}
+        </if>
+        and del_flag = '0'
+        limit 1
+    </select>
+
+    <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
+        select user_id, phonenumber
+        from sys_user
+        where phonenumber = #{phonenumber}
+          and del_flag = '0' limit 1
+    </select>
+
+    <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
+        select user_id, email
+        from sys_user
+        where email = #{email}
+          and del_flag = '0' limit 1
+    </select>
+    <select id="getListByPostId" resultType="com.ruoyi.common.core.domain.entity.SysUser">
+        select u.user_id,
+        u.dept_id,
+        u.user_name,
+        u.nick_name,
+        u.email,
+        u.avatar,
+        u.phonenumber,
+        u.password,
+        u.sex,
+        u.status,
+        u.del_flag,
+        u.login_ip,
+        u.login_date,
+        u.create_by,
+        u.create_time,
+        u.remark,
+        u.tenant_id,
+        u.user_code
         from sys_user_post sup
         from sys_user_post sup
-                 inner join sys_user u on sup.user_id = u.user_id
+        inner join sys_user u on sup.user_id = u.user_id
         where sup.post_id = #{postId}
         where sup.post_id = #{postId}
-		<if test="companyId != null">
-			AND u.company_id = #{companyId}
-		</if>
+        <if test="companyId != null">
+            AND u.company_id = #{companyId}
+        </if>
     </select>
     </select>
 
 
     <select id="getListByRoleIds" resultType="com.ruoyi.common.core.domain.entity.SysUser">
     <select id="getListByRoleIds" resultType="com.ruoyi.common.core.domain.entity.SysUser">
         select u.user_id,
         select u.user_id,
-               u.dept_id,
-               u.user_name,
-               u.nick_name,
-               u.email,
-               u.avatar,
-               u.phonenumber,
-               u.password,
-               u.sex,
-               u.status,
-               u.del_flag,
-               u.login_ip,
-               u.login_date,
-               u.create_by,
-               u.create_time,
-               u.remark,
-               u.tenant_id,
-               u.user_code
+        u.dept_id,
+        u.user_name,
+        u.nick_name,
+        u.email,
+        u.avatar,
+        u.phonenumber,
+        u.password,
+        u.sex,
+        u.status,
+        u.del_flag,
+        u.login_ip,
+        u.login_date,
+        u.create_by,
+        u.create_time,
+        u.remark,
+        u.tenant_id,
+        u.user_code
         from sys_user_role sur
         from sys_user_role sur
-                 inner join sys_user u on sur.user_id = u.user_id
+        inner join sys_user u on sur.user_id = u.user_id
         <where>
         <where>
-			<foreach collection="roleIds" item="roleId" open="sur.role_id in (" separator="," close=")">
-				#{roleId}
-			</foreach>
-			<if test="companyId != null">
-				AND (u.company_id = #{companyId} OR FIND_IN_SET(#{companyId}, u.company_set))
-			</if>
-		</where>
+            <foreach collection="roleIds" item="roleId" open="sur.role_id in (" separator="," close=")">
+                #{roleId}
+            </foreach>
+            <if test="companyId != null">
+                AND (u.company_id = #{companyId} OR FIND_IN_SET(#{companyId}, u.company_set))
+            </if>
+        </where>
     </select>
     </select>
     <select id="getRoleByUserIdList" resultType="com.ruoyi.common.core.domain.entity.SysRole">
     <select id="getRoleByUserIdList" resultType="com.ruoyi.common.core.domain.entity.SysRole">
         select sr.role_id, sr.role_key ,sr.role_name, sur.user_id
         select sr.role_id, sr.role_key ,sr.role_name, sur.user_id
@@ -378,37 +387,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="userType != null and userType != ''">user_type,</if>
         <if test="userType != null and userType != ''">user_type,</if>
         <if test="jobNumber != null and jobNumber != ''">job_number,</if>
         <if test="jobNumber != null and jobNumber != ''">job_number,</if>
         <if test="userCode != null and userCode != ''">user_code,</if>
         <if test="userCode != null and userCode != ''">user_code,</if>
-		<if test="nickNameEn != null and nickNameEn != ''">nick_name_en,</if>
-		<if test="companyId != null and companyId != ''">company_id,</if>
+        <if test="nickNameEn != null and nickNameEn != ''">nick_name_en,</if>
+        <if test="companyId != null and companyId != ''">company_id,</if>
         <if test="companySet != null and companySet != ''">company_set,</if>
         <if test="companySet != null and companySet != ''">company_set,</if>
-		<if test="accountName != null and accountName != ''">account_name,</if>
-		<if test="accountBank != null and accountBank != ''">account_bank,</if>
-		<if test="accountNumber != null and accountNumber != ''">account_number,</if>
-		<if test="purchaseRange != null and purchaseRange != ''">purchase_range,</if>
-		<if test="saleLv != null">sale_lv,</if>
-		<if test="identity != null">identity,</if>
-		<if test="jdSubjectCode != null">jd_subject_code,</if>
-		<if test="jdSubjectName != null">jd_subject_name,</if>
+        <if test="accountName != null and accountName != ''">account_name,</if>
+        <if test="accountBank != null and accountBank != ''">account_bank,</if>
+        <if test="accountNumber != null and accountNumber != ''">account_number,</if>
+        <if test="purchaseRange != null and purchaseRange != ''">purchase_range,</if>
+        <if test="saleLv != null">sale_lv,</if>
+        <if test="identity != null">identity,</if>
+        <if test="jdSubjectCode != null">jd_subject_code,</if>
+        <if test="jdSubjectName != null">jd_subject_name,</if>
 
 
-		<if test="employeeType != null and employeeType != ''">employee_type,</if>
-		<if test="probationRatio != null and probationRatio != ''">probation_ratio,</if>
-		<if test="internshipRatio != null and internshipRatio != ''">internship_ratio,</if>
-		<if test="amount != null and amount != ''">amount,</if>
-		<if test="education != null and education != ''">education,</if>
-		<if test="post != null and post != ''">post,</if>
-		<if test="probationPeriod != null and probationPeriod != ''">probation_period,</if>
-		<if test="entryDate != null">entry_date,</if>
-		<if test="effectiveDate != null">effective_date,</if>
-		<if test="fullTimeDate != null">full_time_date,</if>
-		<if test="monthRest != null and monthRest != ''">month_rest,</if>
-		<if test="dailyHours != null and dailyHours != ''">daily_hours,</if>
-		<if test="morningBeginTime != null">morning_begin_time,</if>
-		<if test="morningEndTime != null">morning_end_time,</if>
-		<if test="afternoonBeginTime != null">afternoon_begin_time,</if>
-		<if test="afternoonEndTime != null">afternoon_end_time,</if>
-		<if test="settleMethod != null and settleMethod != ''">settle_method,</if>
-		<if test="salaryRemark != null and salaryRemark != ''">salary_remark,</if>
-		create_time
+        <if test="employeeType != null and employeeType != ''">employee_type,</if>
+        <if test="probationRatio != null and probationRatio != ''">probation_ratio,</if>
+        <if test="internshipRatio != null and internshipRatio != ''">internship_ratio,</if>
+        <if test="amount != null and amount != ''">amount,</if>
+        <if test="education != null and education != ''">education,</if>
+        <if test="post != null and post != ''">post,</if>
+        <if test="probationPeriod != null and probationPeriod != ''">probation_period,</if>
+        <if test="entryDate != null">entry_date,</if>
+        <if test="effectiveDate != null">effective_date,</if>
+        <if test="fullTimeDate != null">full_time_date,</if>
+        <if test="monthRest != null and monthRest != ''">month_rest,</if>
+        <if test="dailyHours != null and dailyHours != ''">daily_hours,</if>
+        <if test="morningBeginTime != null">morning_begin_time,</if>
+        <if test="morningEndTime != null">morning_end_time,</if>
+        <if test="afternoonBeginTime != null">afternoon_begin_time,</if>
+        <if test="afternoonEndTime != null">afternoon_end_time,</if>
+        <if test="settleMethod != null and settleMethod != ''">settle_method,</if>
+        <if test="salaryRemark != null and salaryRemark != ''">salary_remark,</if>
+        create_time
         )values(
         )values(
         <if test="userId != null and userId != ''">#{userId},</if>
         <if test="userId != null and userId != ''">#{userId},</if>
         <if test="deptId != null and deptId != ''">#{deptId},</if>
         <if test="deptId != null and deptId != ''">#{deptId},</if>
@@ -426,37 +435,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="userType != null and userType != ''">#{userType},</if>
         <if test="userType != null and userType != ''">#{userType},</if>
         <if test="jobNumber != null and jobNumber != ''">#{jobNumber},</if>
         <if test="jobNumber != null and jobNumber != ''">#{jobNumber},</if>
         <if test="userCode != null and userCode != ''">#{userCode},</if>
         <if test="userCode != null and userCode != ''">#{userCode},</if>
-		<if test="nickNameEn != null and nickNameEn != ''">#{nickNameEn},</if>
-		<if test="companyId != null and companyId != ''">#{companyId},</if>
-		<if test="companySet != null and companySet != ''">#{companySet},</if>
-		<if test="accountName != null and accountName != ''">#{accountName},</if>
-		<if test="accountBank != null and accountBank != ''">#{accountBank},</if>
-		<if test="accountNumber != null and accountNumber != ''">#{accountNumber},</if>
-		<if test="purchaseRange != null and purchaseRange != ''">#{purchaseRange},</if>
-		<if test="saleLv != null">#{saleLv},</if>
-		<if test="identity != null">#{identity},</if>
-		<if test="jdSubjectCode != null">#{jdSubjectCode},</if>
-		<if test="jdSubjectName != null">#{jdSubjectName},</if>
+        <if test="nickNameEn != null and nickNameEn != ''">#{nickNameEn},</if>
+        <if test="companyId != null and companyId != ''">#{companyId},</if>
+        <if test="companySet != null and companySet != ''">#{companySet},</if>
+        <if test="accountName != null and accountName != ''">#{accountName},</if>
+        <if test="accountBank != null and accountBank != ''">#{accountBank},</if>
+        <if test="accountNumber != null and accountNumber != ''">#{accountNumber},</if>
+        <if test="purchaseRange != null and purchaseRange != ''">#{purchaseRange},</if>
+        <if test="saleLv != null">#{saleLv},</if>
+        <if test="identity != null">#{identity},</if>
+        <if test="jdSubjectCode != null">#{jdSubjectCode},</if>
+        <if test="jdSubjectName != null">#{jdSubjectName},</if>
 
 
-		<if test="employeeType != null and employeeType != ''">#{employeeType},</if>
-		<if test="probationRatio != null and probationRatio != ''">#{probationRatio},</if>
-		<if test="internshipRatio != null and internshipRatio != ''">#{internshipRatio},</if>
-		<if test="amount != null and amount != ''">#{amount},</if>
-		<if test="education != null and education != ''">#{education},</if>
-		<if test="post != null and post != ''">#{post},</if>
-		<if test="probationPeriod != null and probationPeriod != ''">#{probationPeriod},</if>
-		<if test="entryDate != null">#{entryDate},</if>
-		<if test="effectiveDate != null">#{effectiveDate},</if>
-		<if test="fullTimeDate != null">#{fullTimeDate},</if>
-		<if test="monthRest != null and monthRest != ''">#{monthRest},</if>
-		<if test="dailyHours != null and dailyHours != ''">#{dailyHours},</if>
-		<if test="morningBeginTime != null">#{morningBeginTime},</if>
-		<if test="morningEndTime != null">#{morningEndTime},</if>
-		<if test="afternoonBeginTime != null">#{afternoonBeginTime},</if>
-		<if test="afternoonEndTime != null">#{afternoonEndTime},</if>
-		<if test="settleMethod != null and settleMethod != ''">#{settleMethod},</if>
-		<if test="salaryRemark != null and salaryRemark != ''">#{salaryRemark},</if>
-		sysdate()
+        <if test="employeeType != null and employeeType != ''">#{employeeType},</if>
+        <if test="probationRatio != null and probationRatio != ''">#{probationRatio},</if>
+        <if test="internshipRatio != null and internshipRatio != ''">#{internshipRatio},</if>
+        <if test="amount != null and amount != ''">#{amount},</if>
+        <if test="education != null and education != ''">#{education},</if>
+        <if test="post != null and post != ''">#{post},</if>
+        <if test="probationPeriod != null and probationPeriod != ''">#{probationPeriod},</if>
+        <if test="entryDate != null">#{entryDate},</if>
+        <if test="effectiveDate != null">#{effectiveDate},</if>
+        <if test="fullTimeDate != null">#{fullTimeDate},</if>
+        <if test="monthRest != null and monthRest != ''">#{monthRest},</if>
+        <if test="dailyHours != null and dailyHours != ''">#{dailyHours},</if>
+        <if test="morningBeginTime != null">#{morningBeginTime},</if>
+        <if test="morningEndTime != null">#{morningEndTime},</if>
+        <if test="afternoonBeginTime != null">#{afternoonBeginTime},</if>
+        <if test="afternoonEndTime != null">#{afternoonEndTime},</if>
+        <if test="settleMethod != null and settleMethod != ''">#{settleMethod},</if>
+        <if test="salaryRemark != null and salaryRemark != ''">#{salaryRemark},</if>
+        sysdate()
         )
         )
     </insert>
     </insert>
 
 
@@ -476,110 +485,118 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="loginDate != null">login_date = #{loginDate},</if>
             <if test="loginDate != null">login_date = #{loginDate},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="remark != null">remark = #{remark},</if>
-<!--            禁止修改租户-->
-<!--            <if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>-->
+            <!--            禁止修改租户-->
+            <!--            <if test="tenantId != null and tenantId != ''">tenant_id = #{tenantId},</if>-->
             <if test="userType != null and userType != ''">user_type = #{userType},</if>
             <if test="userType != null and userType != ''">user_type = #{userType},</if>
             <if test="jobNumber != null and jobNumber != ''">job_number = #{jobNumber},</if>
             <if test="jobNumber != null and jobNumber != ''">job_number = #{jobNumber},</if>
-			<if test="userCode != null and userCode != ''">user_code = #{userCode},</if>
-			<if test="nickNameEn != null and nickNameEn != ''">nick_name_en = #{nickNameEn},</if>
-			<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
-			<if test="companySet != null and companySet != ''">company_set = #{companySet},</if>
+            <if test="userCode != null and userCode != ''">user_code = #{userCode},</if>
+            <if test="nickNameEn != null and nickNameEn != ''">nick_name_en = #{nickNameEn},</if>
+            <if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
+            <if test="companySet != null and companySet != ''">company_set = #{companySet},</if>
 
 
-			<if test="accountName != null">account_name = #{accountName},</if>
-			<if test="accountBank != null">account_bank = #{accountBank},</if>
-			<if test="accountNumber != null">account_number = #{accountNumber},</if>
-			<if test="purchaseRange != null">purchase_range = #{purchaseRange},</if>
-			<if test="saleLv != null">sale_lv = #{saleLv},</if>
-			<if test="identity != null">identity = #{identity},</if>
+            <if test="accountName != null">account_name = #{accountName},</if>
+            <if test="accountBank != null">account_bank = #{accountBank},</if>
+            <if test="accountNumber != null">account_number = #{accountNumber},</if>
+            <if test="purchaseRange != null">purchase_range = #{purchaseRange},</if>
+            <if test="saleLv != null">sale_lv = #{saleLv},</if>
+            <if test="identity != null">identity = #{identity},</if>
 
 
-			<if test="jdSubjectCode != null">jd_subject_code = #{jdSubjectCode},</if>
-			<if test="jdSubjectName != null">jd_subject_name = #{jdSubjectName},</if>
+            <if test="jdSubjectCode != null">jd_subject_code = #{jdSubjectCode},</if>
+            <if test="jdSubjectName != null">jd_subject_name = #{jdSubjectName},</if>
 
 
-			<if test="employeeType != null and employeeType != ''">employee_type = #{employeeType},</if>
-			<if test="probationRatio != null and probationRatio != ''">probation_ratio = #{probationRatio},</if>
-			<if test="internshipRatio != null and internshipRatio != ''">internship_ratio = #{internshipRatio},</if>
-			<if test="amount != null and amount != ''">amount = #{amount},</if>
-			<if test="education != null and education != ''">education = #{education},</if>
-			<if test="post != null and post != ''">post = #{post},</if>
-			<if test="probationPeriod != null and probationPeriod != ''">probation_period = #{probationPeriod},</if>
-			<if test="entryDate != null">entry_date = #{entryDate},</if>
-			<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
-			<if test="fullTimeDate != null">full_time_date = #{fullTimeDate},</if>
-			<if test="monthRest != null and monthRest != ''">month_rest = #{monthRest},</if>
-			<if test="dailyHours != null and dailyHours != ''">daily_hours = #{dailyHours},</if>
-			<if test="morningBeginTime != null">morning_begin_time = #{morningBeginTime},</if>
-			<if test="morningEndTime != null">morning_end_time = #{morningEndTime},</if>
-			<if test="afternoonBeginTime != null">afternoon_begin_time = #{afternoonBeginTime},</if>
-			<if test="afternoonEndTime != null">afternoon_end_time = #{afternoonEndTime},</if>
-			<if test="settleMethod != null and settleMethod != ''">settle_method = #{settleMethod},</if>
-			<if test="salaryRemark != null and salaryRemark != ''">salary_remark = #{salaryRemark},</if>
-			update_time = sysdate()
+            <if test="employeeType != null and employeeType != ''">employee_type = #{employeeType},</if>
+            <if test="probationRatio != null and probationRatio != ''">probation_ratio = #{probationRatio},</if>
+            <if test="internshipRatio != null and internshipRatio != ''">internship_ratio = #{internshipRatio},</if>
+            <if test="amount != null and amount != ''">amount = #{amount},</if>
+            <if test="education != null and education != ''">education = #{education},</if>
+            <if test="post != null and post != ''">post = #{post},</if>
+            <if test="probationPeriod != null and probationPeriod != ''">probation_period = #{probationPeriod},</if>
+            <if test="entryDate != null">entry_date = #{entryDate},</if>
+            <if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
+            <if test="fullTimeDate != null">full_time_date = #{fullTimeDate},</if>
+            <if test="monthRest != null and monthRest != ''">month_rest = #{monthRest},</if>
+            <if test="dailyHours != null and dailyHours != ''">daily_hours = #{dailyHours},</if>
+            <if test="morningBeginTime != null">morning_begin_time = #{morningBeginTime},</if>
+            <if test="morningEndTime != null">morning_end_time = #{morningEndTime},</if>
+            <if test="afternoonBeginTime != null">afternoon_begin_time = #{afternoonBeginTime},</if>
+            <if test="afternoonEndTime != null">afternoon_end_time = #{afternoonEndTime},</if>
+            <if test="settleMethod != null and settleMethod != ''">settle_method = #{settleMethod},</if>
+            <if test="salaryRemark != null and salaryRemark != ''">salary_remark = #{salaryRemark},</if>
+            update_time = sysdate()
         </set>
         </set>
         where user_id = #{userId}
         where user_id = #{userId}
     </update>
     </update>
-	
-	<update id="updateUserStatus" parameterType="SysUser">
- 		update sys_user set status = #{status} where user_id = #{userId}
-	</update>
-	
-	<update id="updateUserAvatar" parameterType="SysUser">
- 		update sys_user set avatar = #{avatar} where user_name = #{userName}
-	</update>
-	
-	<update id="resetUserPwd" parameterType="SysUser">
- 		update sys_user set password = #{password} where user_name = #{userName}
-	</update>
 
 
-	<delete id="deleteUserById" parameterType="Long">
- 		update sys_user set del_flag = '2' where user_id = #{userId}
- 	</delete>
- 	
- 	<delete id="deleteUserByIds" parameterType="Long">
- 		update sys_user set del_flag = '2' where user_id in
- 		<foreach collection="array" item="userId" open="(" separator="," close=")">
- 			#{userId}
-        </foreach> 
- 	</delete>
+    <update id="updateUserStatus" parameterType="SysUser">
+        update sys_user
+        set status = #{status}
+        where user_id = #{userId}
+    </update>
+
+    <update id="updateUserAvatar" parameterType="SysUser">
+        update sys_user
+        set avatar = #{avatar}
+        where user_name = #{userName}
+    </update>
+
+    <update id="resetUserPwd" parameterType="SysUser">
+        update sys_user
+        set password = #{password}
+        where user_name = #{userName}
+    </update>
+
+    <delete id="deleteUserById" parameterType="Long">
+        update sys_user
+        set del_flag = '2'
+        where user_id = #{userId}
+    </delete>
 
 
-	<update id="updateUserPwdById">
-		update sys_user set password = #{password} where user_id = #{userId}
-	</update>
+    <delete id="deleteUserByIds" parameterType="Long">
+        update sys_user set del_flag = '2' where user_id in
+        <foreach collection="array" item="userId" open="(" separator="," close=")">
+            #{userId}
+        </foreach>
+    </delete>
 
 
-	<select id="getUserListByRoleIds" resultType="com.ruoyi.common.core.domain.entity.SysUser">
-		SELECT
-		su.user_id,
-		su.dept_id,
-		su.user_name,
-		su.nick_name,
-		su.email,
-		su.avatar,
-		su.phonenumber,
-		su.sex,
-		su.status,
-		su.remark,
-		su.user_code,
-		sur.role_id
-		FROM
-		sys_user_role sur
-		LEFT JOIN sys_user su ON su.user_id = sur.user_id
-		WHERE sur.role_id in
-		<foreach collection="roleIdList" item="roleId" open="(" separator="," close=")">
-			#{roleId}
-		</foreach>
-	</select>
-	<select id="getUserList" resultType="com.ruoyi.common.core.domain.entity.SysUser">
-		SELECT
-			su.user_id,
-			su.dept_id,
-			su.user_name,
-			su.nick_name,
-			sr.role_id,
-			sr.role_key
-		FROM
-			sys_user su
-				LEFT JOIN sys_user_role sur ON sur.user_id = su.user_id
-				LEFT JOIN sys_role sr ON sr.role_id = sur.role_id
-			${ew.customSqlSegment}
-	</select>
+    <update id="updateUserPwdById">
+        update sys_user
+        set password = #{password}
+        where user_id = #{userId}
+    </update>
+
+    <select id="getUserListByRoleIds" resultType="com.ruoyi.common.core.domain.entity.SysUser">
+        SELECT
+        su.user_id,
+        su.dept_id,
+        su.user_name,
+        su.nick_name,
+        su.email,
+        su.avatar,
+        su.phonenumber,
+        su.sex,
+        su.status,
+        su.remark,
+        su.user_code,
+        sur.role_id
+        FROM
+        sys_user_role sur
+        LEFT JOIN sys_user su ON su.user_id = sur.user_id
+        WHERE sur.role_id in
+        <foreach collection="roleIdList" item="roleId" open="(" separator="," close=")">
+            #{roleId}
+        </foreach>
+    </select>
+    <select id="getUserList" resultType="com.ruoyi.common.core.domain.entity.SysUser">
+        SELECT su.user_id,
+               su.dept_id,
+               su.user_name,
+               su.nick_name,
+               sr.role_id,
+               sr.role_key
+        FROM sys_user su
+                 LEFT JOIN sys_user_role sur ON sur.user_id = su.user_id
+                 LEFT JOIN sys_role sr ON sr.role_id = sur.role_id
+            ${ew.customSqlSegment}
+    </select>
 
 
 </mapper> 
 </mapper>