教育训练处考试制证系统后端
heheng
2025-01-21 5217bbc0a0278915e5c641316c20489d8f1868f1
特种作业非煤缴费版本
已修改8个文件
915 ■■■■■ 文件已修改
exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalCategoryServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml 325 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 539 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
exam-system/src/main/java/com/gkhy/exam/pay/controller/NonCoalPayController.java
@@ -179,7 +179,7 @@
    @GetMapping("/nonCoalSelectH5")
    @ApiOperation(value = "H5查询缴费信息")
    @ApiOperation(value = "非煤H5查询缴费信息")
    @Anonymous
    @ApiImplicitParams({
            @ApiImplicitParam(name = "phone", dataTypeClass = String.class, value = "电话", required = true),
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalCategoryServiceImpl.java
@@ -4,6 +4,7 @@
import com.gkhy.exam.pay.entity.NonCoalCategory;
import com.gkhy.exam.pay.mapper.NonCoalCategoryMapper;
import com.gkhy.exam.pay.service.NonCoalCategoryService;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;
@@ -43,7 +44,10 @@
    @Override
    public List<NonCoalCategory> selectNonCoalCategoryList(NonCoalCategory nonCoalCategory) {
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
            nonCoalCategory.setDistrictCode(SecurityUtils.getDeptDistrictCode());
            if (!Constants.DIS_XINJIANG_CODE.equals(SecurityUtils.getDeptDistrictCode())) {
                nonCoalCategory.setDistrictCode(SecurityUtils.getDeptDistrictCode());
            }
        }
        return nonCoalCategoryMapper.selectNonCoalCategoryList(nonCoalCategory);
    }
@@ -56,6 +60,9 @@
     */
    @Override
    public int insertNonCoalCategory(NonCoalCategory nonCoalCategory) {
        if (!nonCoalCategory.getDistrictCode().startsWith(Constants.DIS_XINJIANG_CODE)) {
            throw new RuntimeException("地州信息错误");
        }
        checkSubjectName(nonCoalCategory);
        nonCoalCategory.setCreateBy(SecurityUtils.getUsername());
        return nonCoalCategoryMapper.insertNonCoalCategory(nonCoalCategory);
@@ -70,6 +77,7 @@
    @Override
    public int updateNonCoalCategory(NonCoalCategory nonCoalCategory) {
        checkSubjectName(nonCoalCategory);
        nonCoalCategory.setDistrictCode(null);
        nonCoalCategory.setUpdateBy(SecurityUtils.getUsername());
        return nonCoalCategoryMapper.updateNonCoalCategory(nonCoalCategory);
    }
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayServiceImpl.java
@@ -18,6 +18,7 @@
import com.gkhy.exam.pay.service.NonCoalPayCategoryService;
import com.gkhy.exam.pay.service.NonCoalPayService;
import com.gkhy.exam.pay.service.NonCoalPayStudentService;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
@@ -73,7 +74,9 @@
    @Override
    public List<NonCoalPayPageRepDto> selectNonCoalPayList(NonCoalPay nonCoalPay) {
        if (!SecurityUtils.isAdmin(SecurityUtils.getUserId())) {
            nonCoalPay.setDistrictCode(SecurityUtils.getDeptDistrictCode());
            if (!Constants.DIS_XINJIANG_CODE.equals(SecurityUtils.getDeptDistrictCode())) {
                nonCoalPay.setDistrictCode(SecurityUtils.getDeptDistrictCode());
            }
        }
        return nonCoalPayMapper.getNonCoalPayList(nonCoalPay);
    }
@@ -122,6 +125,9 @@
    @Override
    @Transactional
    public int insertNonCoalPay(NonCoalPayReqDto nonCoalPay) {
        if (!nonCoalPay.getDistrictCode().startsWith(Constants.DIS_XINJIANG_CODE)) {
            throw new RuntimeException("地州信息错误");
        }
        checkData(nonCoalPay);
        NonCoalPay nonCoalPay1 = new NonCoalPay();
        BeanUtils.copyProperties(nonCoalPay, nonCoalPay1);
@@ -173,10 +179,12 @@
    @Override
    @Transactional
    public int updateNonCoalPay(NonCoalPayReqDto nonCoalPay) {
        checkData(nonCoalPay);
        checkHavePay(nonCoalPay.getId());
        NonCoalPay nonCoalPay1 = new NonCoalPay();
        BeanUtils.copyProperties(nonCoalPay, nonCoalPay1);
        nonCoalPay1.setDistrictCode(null);
        nonCoalPay1.setUpdateBy(SecurityUtils.getUsername());
        int i = nonCoalPayMapper.updateNonCoalPay(nonCoalPay1);
        if (i > 0) {
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/NonCoalPayStudentServiceImpl.java
@@ -186,8 +186,10 @@
        StringBuilder failureMsg = new StringBuilder();
        for (NonCoalPayStudent stu : nonCoalPayStudents) {
            try {
                if (idCardToNameMap.get(stu.getIdCard().trim()) != null) {
                if (StringUtils.isEmpty(stu.getIdCard()) || StringUtils.isEmpty(stu.getName()) || StringUtils.isEmpty(stu.getPhone()) || stu.getSex() == null) {
                    failureMsg.append("<br/>" + failureNum + "、身份证号: " + stu.getIdCard() + " 数据已存在");
                } else if (idCardToNameMap.get(stu.getIdCard().trim()) != null) {
                    failureMsg.append("<br/>" + failureNum + "、导入数据为空: " + stu.getIdCard() + " 数据错误");
                } else {
                    stu.setPayType(1L);
                    stu.setPayStatus(0L);
exam-system/src/main/resources/mapper/pay/NonCoalCategoryMapper.xml
@@ -82,7 +82,7 @@
            </if>
            <if test="operateTypeId != null ">and a.operate_type_id = #{operateTypeId}</if>
            <if test="amount != null ">and a.amount = #{amount}</if>
            <if test="bussinessCode != null  and bussinessCode != ''">and a.business_code = #{bussinessCode}</if>
            <if test="businessCode != null  and businessCode != ''">and a.business_code = #{businessCode}</if>
            <if test="companyCode != null  and companyCode != ''">and a.company_code = #{companyCode}</if>
            <if test="drawer != null  and drawer != ''">and a.drawer = #{drawer}</if>
            <if test="reviewer != null  and reviewer != ''">and a.reviewer = #{reviewer}</if>
@@ -131,7 +131,7 @@
            <if test="subjectName != null and subjectName != ''">subject_name,</if>
            <if test="operateTypeId != null">operate_type_id,</if>
            <if test="amount != null">amount,</if>
            <if test="bussinessCode != null and bussinessCode != ''">business_code,</if>
            <if test="businessCode != null and businessCode != ''">business_code,</if>
            <if test="companyCode != null and companyCode != ''">company_code,</if>
            <if test="drawer != null and drawer != ''">drawer,</if>
            <if test="reviewer != null and reviewer != ''">reviewer,</if>
@@ -149,7 +149,7 @@
            <if test="subjectName != null and subjectName != ''">#{subjectName},</if>
            <if test="operateTypeId != null">#{operateTypeId},</if>
            <if test="amount != null">#{amount},</if>
            <if test="bussinessCode != null and bussinessCode != ''">#{bussinessCode},</if>
            <if test="businessCode != null and businessCode != ''">#{businessCode},</if>
            <if test="companyCode != null and companyCode != ''">#{companyCode},</if>
            <if test="drawer != null and drawer != ''">#{drawer},</if>
            <if test="reviewer != null and reviewer != ''">#{reviewer},</if>
@@ -171,7 +171,7 @@
            <if test="subjectName != null and subjectName != ''">subject_name = #{subjectName},</if>
            <if test="operateTypeId != null">operate_type_id = #{operateTypeId},</if>
            <if test="amount != null">amount = #{amount},</if>
            <if test="bussinessCode != null and bussinessCode != ''">business_code = #{bussinessCode},</if>
            <if test="businessCode != null and businessCode != ''">business_code = #{businessCode},</if>
            <if test="companyCode != null and companyCode != ''">company_code = #{companyCode},</if>
            <if test="drawer != null and drawer != ''">drawer = #{drawer},</if>
            <if test="reviewer != null and reviewer != ''">reviewer = #{reviewer},</if>
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
@@ -4,11 +4,10 @@
/**
 * 通用常量信息
 *
 *
 * @author ruoyi
 */
public class Constants
{
public class Constants {
    /**
     * UTF-8 字符集
     */
@@ -63,7 +62,7 @@
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";
    /**
     * 验证码有效期(分钟)
     */
@@ -136,16 +135,18 @@
    /**
     * 自动识别json对象白名单配置(仅允许解析的包名,范围越小越安全)
     */
    public static final String[] JSON_WHITELIST_STR = { "org.springframework", "com.ruoyi" };
    public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.ruoyi"};
    /**
     * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
     */
    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
    public static final String[] JOB_WHITELIST_STR = {"com.ruoyi"};
    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config"};
    public static final String DIS_XINJIANG_CODE = "65";
}
ruoyi-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -1,163 +1,198 @@
<?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">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysDeptMapper">
    <resultMap type="SysDept" id="SysDeptResult">
        <id     property="deptId"     column="dept_id"     />
        <result property="parentId"   column="parent_id"   />
        <result property="ancestors"  column="ancestors"   />
        <result property="deptName"   column="dept_name"   />
        <result property="districtCode"   column="district_code"   />
        <result property="orderNum"   column="order_num"   />
        <result property="leader"     column="leader"      />
        <result property="phone"      column="phone"       />
        <result property="email"      column="email"       />
        <result property="status"     column="status"      />
        <result property="delFlag"    column="del_flag"    />
        <result property="parentName" column="parent_name" />
        <result property="createBy"   column="create_by"   />
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
    </resultMap>
    <sql id="selectDeptVo">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time,d.district_code
    <resultMap type="SysDept" id="SysDeptResult">
        <id property="deptId" column="dept_id"/>
        <result property="parentId" column="parent_id"/>
        <result property="ancestors" column="ancestors"/>
        <result property="deptName" column="dept_name"/>
        <result property="districtCode" column="district_code"/>
        <result property="orderNum" column="order_num"/>
        <result property="leader" column="leader"/>
        <result property="phone" column="phone"/>
        <result property="email" column="email"/>
        <result property="status" column="status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="parentName" column="parent_name"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <sql id="selectDeptVo">
        select d.dept_id,
               d.parent_id,
               d.ancestors,
               d.dept_name,
               d.order_num,
               d.leader,
               d.phone,
               d.email,
               d.status,
               d.del_flag,
               d.create_by,
               d.create_time,
               d.district_code
        from sys_dept d
    </sql>
    <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
    <select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
        where d.del_flag = '0'
        <if test="deptId != null and deptId != 0">
            AND dept_id = #{deptId}
        </if>
        <if test="deptId != null and deptId != 0">
            AND dept_id = #{deptId}
        </if>
        <if test="parentId != null and parentId != 0">
            AND parent_id = #{parentId}
        </if>
        <if test="deptName != null and deptName != ''">
            AND dept_name like concat('%', #{deptName}, '%')
        </if>
        <if test="status != null and status != ''">
            AND status = #{status}
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
        order by d.parent_id, d.order_num
            AND parent_id = #{parentId}
        </if>
        <if test="deptName != null and deptName != ''">
            AND dept_name like concat('%', #{deptName}, '%')
        </if>
        <if test="status != null and status != ''">
            AND status = #{status}
        </if>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
        order by d.parent_id, d.order_num
    </select>
    <select id="selectDeptListByRoleId" resultType="Long">
        select d.dept_id
        from sys_dept d
            left join sys_role_dept rd on d.dept_id = rd.dept_id
        select d.dept_id
        from sys_dept d
        left join sys_role_dept rd on d.dept_id = rd.dept_id
        where rd.role_id = #{roleId}
            <if test="deptCheckStrictly">
              and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId})
            </if>
        order by d.parent_id, d.order_num
    </select>
        <if test="deptCheckStrictly">
            and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id =
            rd.dept_id and rd.role_id = #{roleId})
        </if>
        order by d.parent_id, d.order_num
    </select>
    <select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
        select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, ,d.district_code,d.status,
            (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
        from sys_dept d
        where d.dept_id = #{deptId}
    </select>
        select d.dept_id,
               d.parent_id,
               d.ancestors,
               d.dept_name,
               d.order_num,
               d.leader,
               d.phone,
               d.email,
               d.district_code,
               d.status,
               (select dept_name from sys_dept where dept_id = d.parent_id) parent_name
        from sys_dept d
        where d.dept_id = #{deptId}
    </select>
    <select id="checkDeptExistUser" parameterType="Long" resultType="int">
        select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
    </select>
    <select id="hasChildByDeptId" parameterType="Long" resultType="int">
        select count(1) from sys_dept
        where del_flag = '0' and parent_id = #{deptId} limit 1
    </select>
    <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
        select * from sys_dept where find_in_set(#{deptId}, ancestors)
    </select>
    <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
        select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
    </select>
    <select id="checkDeptNameUnique" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
        where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
    </select>
        select count(1)
        from sys_user
        where dept_id = #{deptId}
          and del_flag = '0'
    </select>
    <select id="hasChildByDeptId" parameterType="Long" resultType="int">
        select count(1)
        from sys_dept
        where del_flag = '0'
          and parent_id = #{deptId} limit 1
    </select>
    <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
        select *
        from sys_dept
        where find_in_set(#{deptId}, ancestors)
    </select>
    <select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
        select count(*)
        from sys_dept
        where status = 0
          and del_flag = '0'
          and find_in_set(#{deptId}, ancestors)
    </select>
    <select id="checkDeptNameUnique" resultMap="SysDeptResult">
        <include refid="selectDeptVo"/>
        where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
    </select>
    <insert id="insertDept" parameterType="SysDept">
         insert into sys_dept(
             <if test="deptId != null and deptId != 0">dept_id,</if>
             <if test="parentId != null and parentId != 0">parent_id,</if>
             <if test="deptName != null and deptName != ''">dept_name,</if>
            <if test="districtCode != null and districtCode != ''">district_code,</if>
             <if test="ancestors != null and ancestors != ''">ancestors,</if>
             <if test="orderNum != null">order_num,</if>
             <if test="leader != null and leader != ''">leader,</if>
             <if test="phone != null and phone != ''">phone,</if>
             <if test="email != null and email != ''">email,</if>
             <if test="status != null">status,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             create_time
         )values(
             <if test="deptId != null and deptId != 0">#{deptId},</if>
             <if test="parentId != null and parentId != 0">#{parentId},</if>
             <if test="deptName != null and deptName != ''">#{deptName},</if>
            <if test="districtCode != null and districtCode != ''">#{districtCode},</if>
             <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
             <if test="orderNum != null">#{orderNum},</if>
             <if test="leader != null and leader != ''">#{leader},</if>
             <if test="phone != null and phone != ''">#{phone},</if>
             <if test="email != null and email != ''">#{email},</if>
             <if test="status != null">#{status},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             sysdate()
         )
    </insert>
    <update id="updateDept" parameterType="SysDept">
         update sys_dept
         <set>
             <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
             <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
            <if test="districtCode != null and districtCode != ''">district_code = #{districtCode},</if>
             <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
             <if test="orderNum != null">order_num = #{orderNum},</if>
             <if test="leader != null">leader = #{leader},</if>
             <if test="phone != null">phone = #{phone},</if>
             <if test="email != null">email = #{email},</if>
             <if test="status != null and status != ''">status = #{status},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             update_time = sysdate()
         </set>
         where dept_id = #{deptId}
    </update>
    <update id="updateDeptChildren" parameterType="java.util.List">
        update sys_dept set ancestors =
        <foreach collection="depts" item="item" index="index"
            separator=" " open="case dept_id" close="end">
            when #{item.deptId} then #{item.ancestors}
        </foreach>
        where dept_id in
        <foreach collection="depts" item="item" index="index"
            separator="," open="(" close=")">
            #{item.deptId}
        </foreach>
    </update>
    <update id="updateDeptStatusNormal" parameterType="Long">
         update sys_dept set status = '0' where dept_id in
         <foreach collection="array" item="deptId" open="(" separator="," close=")">
            #{deptId}
        insert into sys_dept(
        <if test="deptId != null and deptId != 0">dept_id,</if>
        <if test="parentId != null and parentId != 0">parent_id,</if>
        <if test="deptName != null and deptName != ''">dept_name,</if>
        <if test="districtCode != null and districtCode != ''">district_code,</if>
        <if test="ancestors != null and ancestors != ''">ancestors,</if>
        <if test="orderNum != null">order_num,</if>
        <if test="leader != null and leader != ''">leader,</if>
        <if test="phone != null and phone != ''">phone,</if>
        <if test="email != null and email != ''">email,</if>
        <if test="status != null">status,</if>
        <if test="createBy != null and createBy != ''">create_by,</if>
        create_time
        )values(
        <if test="deptId != null and deptId != 0">#{deptId},</if>
        <if test="parentId != null and parentId != 0">#{parentId},</if>
        <if test="deptName != null and deptName != ''">#{deptName},</if>
        <if test="districtCode != null and districtCode != ''">#{districtCode},</if>
        <if test="ancestors != null and ancestors != ''">#{ancestors},</if>
        <if test="orderNum != null">#{orderNum},</if>
        <if test="leader != null and leader != ''">#{leader},</if>
        <if test="phone != null and phone != ''">#{phone},</if>
        <if test="email != null and email != ''">#{email},</if>
        <if test="status != null">#{status},</if>
        <if test="createBy != null and createBy != ''">#{createBy},</if>
        sysdate()
        )
    </insert>
    <update id="updateDept" parameterType="SysDept">
        update sys_dept
        <set>
            <if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
            <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
            <if test="districtCode != null and districtCode != ''">district_code = #{districtCode},</if>
            <if test="ancestors != null and ancestors != ''">ancestors = #{ancestors},</if>
            <if test="orderNum != null">order_num = #{orderNum},</if>
            <if test="leader != null">leader = #{leader},</if>
            <if test="phone != null">phone = #{phone},</if>
            <if test="email != null">email = #{email},</if>
            <if test="status != null and status != ''">status = #{status},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            update_time = sysdate()
        </set>
        where dept_id = #{deptId}
    </update>
    <update id="updateDeptChildren" parameterType="java.util.List">
        update sys_dept set ancestors =
        <foreach collection="depts" item="item" index="index"
                 separator=" " open="case dept_id" close="end">
            when #{item.deptId} then #{item.ancestors}
        </foreach>
    </update>
    <delete id="deleteDeptById" parameterType="Long">
        update sys_dept set del_flag = '2' where dept_id = #{deptId}
    </delete>
        where dept_id in
        <foreach collection="depts" item="item" index="index"
                 separator="," open="(" close=")">
            #{item.deptId}
        </foreach>
    </update>
    <update id="updateDeptStatusNormal" parameterType="Long">
        update sys_dept set status = '0' where dept_id in
        <foreach collection="array" item="deptId" open="(" separator="," close=")">
            #{deptId}
        </foreach>
    </update>
    <delete id="deleteDeptById" parameterType="Long">
        update sys_dept
        set del_flag = '2'
        where dept_id = #{deptId}
    </delete>
</mapper> 
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -1,257 +1,314 @@
<?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">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysUserMapper">
    <resultMap type="SysUser" id="SysUserResult">
        <id     property="userId"       column="user_id"      />
        <result property="deptId"       column="dept_id"      />
        <result property="districtId"       column="district_id"      />
        <result property="unit"       column="unit"      />
        <result property="userName"     column="user_name"    />
        <result property="nickName"     column="nick_name"    />
        <result property="email"        column="email"        />
        <result property="phonenumber"  column="phonenumber"  />
        <result property="sex"          column="sex"          />
        <result property="avatar"       column="avatar"       />
        <result property="password"     column="password"     />
        <result property="status"       column="status"       />
        <result property="delFlag"      column="del_flag"     />
        <result property="loginIp"      column="login_ip"     />
        <result property="loginDate"    column="login_date"   />
        <result property="createBy"     column="create_by"    />
        <result property="createTime"   column="create_time"  />
        <result property="updateBy"     column="update_by"    />
        <result property="updateTime"   column="update_time"  />
        <result property="remark"       column="remark"       />
        <result property="idCard"       column="id_card" />
        <association property="dept"    javaType="SysDept"         resultMap="deptResult" />
        <association property="district" javaType="SysDistrictVo"  resultMap="DistrictResult"/>
        <collection  property="roles"   javaType="java.util.List"  resultMap="RoleResult" />
        <collection  property="institutions"   javaType="java.util.List"  resultMap="InstitutionResult" />
        <id property="userId" column="user_id"/>
        <result property="deptId" column="dept_id"/>
        <result property="districtId" column="district_id"/>
        <result property="unit" column="unit"/>
        <result property="userName" column="user_name"/>
        <result property="nickName" column="nick_name"/>
        <result property="email" column="email"/>
        <result property="phonenumber" column="phonenumber"/>
        <result property="sex" column="sex"/>
        <result property="avatar" column="avatar"/>
        <result property="password" column="password"/>
        <result property="status" column="status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="loginIp" column="login_ip"/>
        <result property="loginDate" column="login_date"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
        <result property="idCard" column="id_card"/>
        <association property="dept" javaType="SysDept" resultMap="deptResult"/>
        <association property="district" javaType="SysDistrictVo" resultMap="DistrictResult"/>
        <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
        <collection property="institutions" javaType="java.util.List" resultMap="InstitutionResult"/>
    </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="leader"    column="leader"      />
        <result property="status"    column="dept_status" />
        <result property="districtCode"   column="district_code"   />
        <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="leader" column="leader"/>
        <result property="status" column="dept_status"/>
        <result property="districtCode" column="district_code"/>
    </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"    />
        <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>
    <resultMap id="DistrictResult" type="SysDistrictVo">
        <id     property="districtId"       column="district_id"        />
        <result property="districtCode"     column="district_code"      />
        <result property="districtName"      column="district_name"       />
        <result property="parentcode"     column="parentcode"      />
        <result property="districtType"    column="district_type"     />
    </resultMap>
    <resultMap id="DistrictResult" type="SysDistrictVo">
        <id property="districtId" column="district_id"/>
        <result property="districtCode" column="district_code"/>
        <result property="districtName" column="district_name"/>
        <result property="parentcode" column="parentcode"/>
        <result property="districtType" column="district_type"/>
    </resultMap>
    <resultMap id="InstitutionResult" type="TrainingInstitutionVo">
        <id     property="institutionId"       column="institution_id"        />
        <result property="institutionName"       column="institution_name" />
    </resultMap>
    <sql id="selectUserVo">
        select u.user_id, u.dept_id, u.district_id,u.unit,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.id_card,
        d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,d.district_code,
        r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,
        di.name as district_name,
        ti.institution_id, ti.institution_name
    <resultMap id="InstitutionResult" type="TrainingInstitutionVo">
        <id property="institutionId" column="institution_id"/>
        <result property="institutionName" column="institution_name"/>
    </resultMap>
    <sql id="selectUserVo">
        select u.user_id,
               u.dept_id,
               u.unit,
               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.id_card,
               d.dept_id,
               d.parent_id,
               d.ancestors,
               d.dept_name,
               d.order_num,
               d.leader,
               d.status as dept_status,
               d.district_code,
               r.role_id,
               r.role_name,
               r.role_key,
               r.role_sort,
               r.data_scope,
               r.status as role_status,
               di.name  as district_name,
               ti.institution_id,
               ti.institution_name,
               di.id    as district_id
        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
            left join sys_district di on di.id = u.district_id
            left join sys_user_institution ui on u.user_id = ui.user_id
            left join training_institution ti on ui.institution_id = ti.institution_id
                 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
                 left join sys_district di on di.code = d.district_code
                 left join sys_user_institution ui on u.user_id = ui.user_id
                 left join training_institution ti on ui.institution_id = ti.institution_id
    </sql>
    <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
        select u.user_id, u.dept_id, u.district_id, u.nick_name, 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, u.id_card, ti.institution_id, ti.institution_name, di.name as district_name from sys_user u
        left join sys_dept d on u.dept_id = d.dept_id
        left join sys_district di on di.id = u.district_id
        left join sys_user_institution ui on u.user_id = ui.user_id
        left join training_institution ti on ui.institution_id = ti.institution_id
        where u.del_flag = '0'
        <if test="userId != null and userId != 0">
            AND u.user_id = #{userId}
        </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="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>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
    <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
        select distinct u.user_id, u.dept_id, u.district_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time, u.id_card, di.name as district_name
        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
             left join sys_district di on di.id = u.district_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.district_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time, u.id_card, di.name as district_name
        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
             left join sys_district di on di.id = u.district_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.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} 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>
    <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
         insert into sys_user(
             <if test="userId != null and userId != 0">user_id,</if>
             <if test="deptId != null and deptId != 0">dept_id,</if>
             <if test="userName != null and userName != ''">user_name,</if>
             <if test="nickName != null and nickName != ''">nick_name,</if>
             <if test="email != null and email != ''">email,</if>
             <if test="avatar != null and avatar != ''">avatar,</if>
             <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
             <if test="sex != null and sex != ''">sex,</if>
             <if test="password != null and password != ''">password,</if>
             <if test="status != null and status != ''">status,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             <if test="remark != null and remark != ''">remark,</if>
            <if test="idCard != null and idCard != ''">id_card,</if>
            <if test="districtId != null and districtId != 0">district_id,</if>
             create_time
         )values(
             <if test="userId != null and userId != ''">#{userId},</if>
             <if test="deptId != null and deptId != ''">#{deptId},</if>
             <if test="userName != null and userName != ''">#{userName},</if>
             <if test="nickName != null and nickName != ''">#{nickName},</if>
             <if test="email != null and email != ''">#{email},</if>
             <if test="avatar != null and avatar != ''">#{avatar},</if>
             <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
             <if test="sex != null and sex != ''">#{sex},</if>
             <if test="password != null and password != ''">#{password},</if>
             <if test="status != null and status != ''">#{status},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             <if test="remark != null and remark != ''">#{remark},</if>
            <if test="idCard != null and idCard != ''">#{idCard},</if>
            <if test="districtId != null and districtId != 0">#{districtId},</if>
             sysdate()
         )
    </insert>
    <update id="updateUser" parameterType="SysUser">
         update sys_user
         <set>
             <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
             <if test="userName != null and userName != ''">user_name = #{userName},</if>
             <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
             <if test="email != null ">email = #{email},</if>
             <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
             <if test="sex != null and sex != ''">sex = #{sex},</if>
             <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
             <if test="password != null and password != ''">password = #{password},</if>
             <if test="status != null and status != ''">status = #{status},</if>
             <if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
             <if test="loginDate != null">login_date = #{loginDate},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             <if test="remark != null">remark = #{remark},</if>
            <if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
            <if test="districtId != null and districtId != 0">district_id = #{districtId},</if>
             update_time = sysdate()
         </set>
         where user_id = #{userId}
    </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>
    <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
        select u.user_id, u.dept_id, di.id as district_id, u.nick_name, 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,
        u.id_card, ti.institution_id, ti.institution_name, di.name as district_name,d.district_code from sys_user u
        left join sys_dept d on u.dept_id = d.dept_id
        left join sys_district di on di.code = d.district_code
        left join sys_user_institution ui on u.user_id = ui.user_id
        left join training_institution ti on ui.institution_id = ti.institution_id
        where u.del_flag = '0'
        <if test="userId != null and userId != 0">
            AND u.user_id = #{userId}
        </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="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>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
    <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
        select distinct u.user_id, u.dept_id, di.id as district_id, u.user_name, u.nick_name, u.email, u.phonenumber,
        u.status,
        u.create_time, u.id_card, di.name as district_name,d.district_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
        left join sys_district di on di.code = d.district_code
        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, di.id as district_id, u.user_name, u.nick_name, u.email, u.phonenumber,
        u.status,
        u.create_time, u.id_card, di.name as district_name, d.district_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
        left join sys_district di on di.code = d.district_code
        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.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}
          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>
    <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
        insert into sys_user(
        <if test="userId != null and userId != 0">user_id,</if>
        <if test="deptId != null and deptId != 0">dept_id,</if>
        <if test="userName != null and userName != ''">user_name,</if>
        <if test="nickName != null and nickName != ''">nick_name,</if>
        <if test="email != null and email != ''">email,</if>
        <if test="avatar != null and avatar != ''">avatar,</if>
        <if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
        <if test="sex != null and sex != ''">sex,</if>
        <if test="password != null and password != ''">password,</if>
        <if test="status != null and status != ''">status,</if>
        <if test="createBy != null and createBy != ''">create_by,</if>
        <if test="remark != null and remark != ''">remark,</if>
        <if test="idCard != null and idCard != ''">id_card,</if>
        <if test="districtId != null and districtId != 0">district_id,</if>
        create_time
        )values(
        <if test="userId != null and userId != ''">#{userId},</if>
        <if test="deptId != null and deptId != ''">#{deptId},</if>
        <if test="userName != null and userName != ''">#{userName},</if>
        <if test="nickName != null and nickName != ''">#{nickName},</if>
        <if test="email != null and email != ''">#{email},</if>
        <if test="avatar != null and avatar != ''">#{avatar},</if>
        <if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
        <if test="sex != null and sex != ''">#{sex},</if>
        <if test="password != null and password != ''">#{password},</if>
        <if test="status != null and status != ''">#{status},</if>
        <if test="createBy != null and createBy != ''">#{createBy},</if>
        <if test="remark != null and remark != ''">#{remark},</if>
        <if test="idCard != null and idCard != ''">#{idCard},</if>
        <if test="districtId != null and districtId != 0">#{districtId},</if>
        sysdate()
        )
    </insert>
    <update id="updateUser" parameterType="SysUser">
        update sys_user
        <set>
            <if test="deptId != null and deptId != 0">dept_id = #{deptId},</if>
            <if test="userName != null and userName != ''">user_name = #{userName},</if>
            <if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
            <if test="email != null ">email = #{email},</if>
            <if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
            <if test="sex != null and sex != ''">sex = #{sex},</if>
            <if test="avatar != null and avatar != ''">avatar = #{avatar},</if>
            <if test="password != null and password != ''">password = #{password},</if>
            <if test="status != null and status != ''">status = #{status},</if>
            <if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
            <if test="loginDate != null">login_date = #{loginDate},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="idCard != null and idCard != ''">id_card = #{idCard},</if>
            <if test="districtId != null and districtId != 0">district_id = #{districtId},</if>
            update_time = sysdate()
        </set>
        where user_id = #{userId}
    </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>
</mapper>