52 lines
2.0 KiB
XML
52 lines
2.0 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.dkha.dao.SysUserDao">
|
|
|
|
<select id="getList" resultType="com.dkha.entity.SysUserEntity">
|
|
select t1.*, (select t2.name from sys_dept t2 where t2.id=t1.dept_id) deptName from sys_user t1
|
|
where t1.del_flag = 0 and t1.super_admin = 0
|
|
<if test="username != null and username.trim() != ''">
|
|
and t1.username like #{username}
|
|
</if>
|
|
<if test="deptId != null and deptId.trim() != ''">
|
|
and t1.dept_id = #{deptId}
|
|
</if>
|
|
<if test="gender != null and gender.trim() != ''">
|
|
and t1.gender = #{gender}
|
|
</if>
|
|
<if test="deptIdList != null">
|
|
and t1.dept_id in
|
|
<foreach item="id" collection="deptIdList" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getById" resultType="com.dkha.entity.SysUserEntity">
|
|
select t1.*, (select t2.name from sys_dept t2 where t2.id=t1.dept_id) deptName from sys_user t1
|
|
where t1.id = #{value} and t1.del_flag = 0
|
|
</select>
|
|
|
|
<select id="getByUsername" resultType="com.dkha.entity.SysUserEntity">
|
|
select u.*,
|
|
(select GROUP_CONCAT(t.name SEPARATOR ',') from sys_role t left join sys_role_user t2 on t.id = t2.role_id where t2.user_id = u.id) as roleNames
|
|
from sys_user u where u.username = #{value} and del_flag = 0
|
|
</select>
|
|
|
|
<update id="updatePassword">
|
|
update sys_user set password = #{newPassword} where id = #{id}
|
|
</update>
|
|
|
|
<select id="getCountByDeptId" resultType="int">
|
|
select count(*) from sys_user where dept_id = #{value} and del_flag = 0
|
|
</select>
|
|
|
|
<select id="getUserIdListByDeptId" resultType="Long">
|
|
select id from sys_user where dept_id in
|
|
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
|
#{deptId}
|
|
</foreach>
|
|
</select>
|
|
</mapper>
|