无关风月
2024-11-04 64f7ccb9ef8b5a0618e65cddc14b981c1f108ba3
xinquan-modules/xinquan-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -172,7 +172,7 @@
          <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="userType != null and userType != ''">user_type,</if>
         <if test="userType != null and userType != ''">user_type,</if>
          create_time
       )values(
          <if test="userId != null and userId != ''">#{userId},</if>
@@ -187,7 +187,7 @@
          <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="userType != null and userType != ''">#{user_type},</if>
         <if test="userType != null and userType != ''">#{userType},</if>
          sysdate()
       )
   </insert>
@@ -208,9 +208,23 @@
          <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>
          update_time = sysdate()
         <if test="userType != null and userType != ''">user_type = #{userType},</if>
         <if test="reason != null and reason != ''">reason = #{reason},</if>
         <if test="handleName != null and handleName != ''">handleName = #{handleName},</if>
         update_time = sysdate()
       </set>
       where user_id = #{userId}
   </update>
   <update id="updateDept" parameterType="com.xinquan.system.api.domain.SysDept">
       update sys_dept
       <set>
          <if test="status != null and status != ''">status = #{status},</if>
          <if test="reason != null">reason = #{reason},</if>
          <if test="handleName != null">handleName = #{handleName},</if>
         update_time = sysdate()
       </set>
       where dept_id = #{deptId}
   </update>
   
   <update id="updateUserStatus" parameterType="com.xinquan.system.api.domain.SysUser">
@@ -241,5 +255,39 @@
         #{id}
      </foreach>
   </delete>
   <select id="pageList" resultType="com.xinquan.system.api.domain.vo.SysUserVO">
      select u.user_id AS userId, u.dept_id AS deptId, u.user_name AS userName, u.nick_name AS nickName, u.email AS email, u.avatar AS avatar,
      u.phonenumber AS phonenumber, u.sex AS sex, u.status AS status, u.del_flag AS delFlag, u.login_ip AS loginIp,
      u.login_date AS loginDate, u.create_by AS createBy, u.create_time AS createTime, u.remark AS remark,u.disableRemark AS disableRemark,
      r.role_id AS roleId, r.role_name AS roleName, r.role_key AS roleKey, r.role_sort AS roleSort, r.data_scope AS dataScope, r.status as role_status,
      u.reason AS reason
      from sys_user u
      left join sys_user_role ur on u.user_id = ur.user_id
      left join sys_role r on ur.role_id = r.role_id
      left join sys_user_dept ud on u.user_id = ud.user_id
      left join sys_dept d on ud.dept_id = d.dept_id
      WHERE u.del_flag = 0
      <if test="query.nickNameOrPhone != null and query.nickNameOrPhone != ''">
         AND (u.nick_name LIKE concat('%',#{query.nickNameOrPhone},'%')
         OR u.phonenumber LIKE concat('%',#{query.nickNameOrPhone},'%'))
      </if>
      <if test="query.roleIds != null and query.roleIds.size()>0">
         AND r.role_id in
         <foreach collection="query.roleIds" separator="," item="id" open="(" close=")">
            #{id}
         </foreach>
      </if>
      <if test="query.deptIds != null and query.deptIds.size()>0">
         AND d.dept_id in
         <foreach collection="query.deptIds" separator="," item="id" open="(" close=")">
            #{id}
         </foreach>
      </if>
      <if test="query.status != null and query.status != ''">
         AND u.status = #{query.status}
      </if>
      and u.user_type=00
      group by u.user_id
      ORDER BY u.create_time DESC
   </select>
</mapper>