陈昶聿
2026-01-22 c3395d01203fd57d191b36f3410f8ae6e6aafd09
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -36,6 +36,7 @@
        <result property="searchscope" column="searchscope"/>
        <result property="guid" column="guid"/>
        <result property="orgid" column="orgid"/>
        <result property="campusid" column="campusid"/>
        <association property="dept" column="dept_id" javaType="com.ruoyi.common.core.domain.entity.SysDept"
                     resultMap="deptResult"/>
        <collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
@@ -90,6 +91,7 @@
               u.remark,
               u.guid,
               u.orgid,
               u.campusid,
               d.dept_id,
               d.parent_id,
               d.ancestors,
@@ -119,15 +121,14 @@
        u.birthday,
        u.job_phone,
        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 from sys_user
        u
        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
        u.orgid,u,campusid,
        d.dept_name
        from sys_user u
        left join sys_user_dept d on u.user_id = d.user_id
        where u.del_flag = '0'
        <if test="userId != null">
            AND u.user_id = #{userId}
        </if>
        <if test="orgid != null and orgid != ''">
            AND u.orgid = #{orgid}
        </if>
        <if test="userName != null and userName != ''">
            AND u.user_name like concat('%', #{userName}, '%')
@@ -185,13 +186,15 @@
        u.birthday,
        u.job_phone,
        u.phonenumber, u.sex, u.status,
        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark from sys_user u
        u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
        u.orgid, u.campusid
        from sys_user u
        where u.del_flag = '0'
        <if test="orgid != null">
            AND u.orgid = #{orgid}
        </if>
        <if test="userId != null">
            AND u.user_id = #{userId}
        </if>
        <if test="orgid != null and orgid != ''">
            AND u.orgid = #{orgid}
        </if>
        <if test="userName != null and userName != ''">
            AND u.user_name like concat('%', #{userName}, '%')
@@ -309,8 +312,8 @@
    <select id="selectUserByUserNameByCondition" parameterType="String" resultMap="SysUserResult">
        <include refid="selectUserVo"/>
        <where>
            u.del_flag = '0'
        where 1=1
            AND u.del_flag = '0'
            <if test="userName != null and userName != ''">
                AND u.user_name = #{userName}
            </if>
@@ -320,7 +323,6 @@
            <if test="deptId != null and deptId != ''">
                AND u.dept_id = #{deptId}
            </if>
        </where>
    </select>
    <select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
@@ -328,11 +330,18 @@
        where u.user_id = #{userId}
    </select>
    <select id="checkUserNameUnique" parameterType="String" resultMap="SysUserResult">
    <select id="checkUserNameUnique" parameterType="com.ruoyi.common.core.domain.entity.SysUser" resultMap="SysUserResult">
        select user_id, user_name
        from sys_user
        where user_name = #{userName}
          and del_flag = '0' limit 1
        and del_flag = '0'
        <if test="orgid != null and orgid != ''">
            and orgid = #{orgid}
        </if>
        <if test="campusid != null and campusid != ''">
            and campusid = #{campusid}
        </if>
        limit 1
    </select>
    <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
@@ -374,9 +383,10 @@
        <if test="jobPhone != null and jobPhone != ''">job_phone,</if>
        <if test="birthday != null ">birthday,</if>
        <if test="hisUserId != null and hisUserId != ''">his_user_id,</if>
        <if test="orgid != null and orgid != ''">orgid,</if>
        <if test="deptCode != null and deptCode != ''">dept_code,</if>
        <if test="deptName != null and deptName != ''">dept_name,</if>
        <if test="orgid != null and orgid != ''">orgid,</if>
        <if test="campusid != null and campusid != ''">campusid,</if>
        create_time
        )values(
        <if test="userId != null and userId != ''">#{userId},</if>
@@ -400,9 +410,10 @@
        <if test="jobPhone != null and jobPhone != ''">#{jobPhone},</if>
        <if test="birthday != null and birthday != ''">#{birthday},</if>
        <if test="hisUserId != null and hisUserId != ''">#{hisUserId},</if>
        <if test="orgid != null and orgid != ''">#{orgid},</if>
        <if test="deptCode != null and deptCode != ''">#{deptCode},</if>
        <if test="deptName != null and deptName != ''">#{deptName},</if>
        <if test="orgid != null and orgid != ''">#{orgid},</if>
        <if test="campusid != null and campusid != ''">#{campusid},</if>
        sysdate()
        )
    </insert>
@@ -430,7 +441,6 @@
            <if test="idCard != null and idCard != ''">id_card=#{idCard},</if>
            <if test="jobPhone != null and jobPhone != ''">job_phone=#{jobPhone},</if>
            <if test="birthday != null ">birthday=#{birthday},</if>
            <if test="orgid != null ">orgid=#{orgid},</if>
            <if test="title != null and title != ''">
                title = #{title},
            </if>
@@ -439,6 +449,8 @@
            </if>
            <if test="deptCode != null and deptCode != ''">dept_code=#{deptCode},</if>
            <if test="deptName != null and deptName != ''">dept_name=#{deptName},</if>
            <if test="orgid != null and orgid != ''">orgid=#{orgid},</if>
            <if test="campusid != null and campusid != ''">campusid=#{campusid},</if>
            update_time = sysdate()
        </set>
        where user_id = #{userId}