add
This commit is contained in:
@ -11,5 +11,12 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectDeptIdsByRoleId" resultType="string">
|
||||
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}
|
||||
order by d.parent_id, d.order_num
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,10 @@
|
||||
<?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.qiaoba.module.system.mapper.SysRoleDeptMapper">
|
||||
|
||||
<delete id="deleteByRoleId">
|
||||
delete from sys_role_dept where role_id = #{roleId}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -49,6 +49,41 @@
|
||||
<include refid="selectUserVo"/>
|
||||
</select>
|
||||
|
||||
<select id="selectAllocatedList" resultMap="SysUserVoResult">
|
||||
select distinct t1.user_id, t2.dept_name, t1.username, t1.nickname, t1.email, t1.phone, t1.status,t1.create_time
|
||||
from sys_user t1
|
||||
left join sys_dept t2
|
||||
on t1.dept_id = t2.dept_id
|
||||
left join sys_user_role t3
|
||||
on t1.user_id = t3.user_id
|
||||
left join sys_role t4
|
||||
on t4.role_id = t3.role_id
|
||||
where t1.is_delete = #{param.isDelete} and t4.role_id = #{param.roleId}
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND t1.username like concat('%', #{param.username}, '%')
|
||||
</if>
|
||||
<if test="param.phone != null and param.phone != ''">
|
||||
AND t1.phone like concat('%', #{param.phone}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectUnAllocatedList" resultMap="SysUserVoResult">
|
||||
select distinct t1.user_id, t2.dept_name, t1.username, t1.nickname, t1.email, t1.phone, t1.status, t1.create_time
|
||||
from sys_user t1
|
||||
left join sys_dept t2 on t1.dept_id = t2.dept_id
|
||||
left join sys_user_role t3 on t1.user_id = t3.user_id
|
||||
left join sys_role t4 on t4.role_id = t3.role_id
|
||||
where t1.is_delete = #{param.isDelete} and (t4.role_id != #{param.roleId} or t4.role_id IS NULL)
|
||||
and t1.user_id not in (select t1.user_id from sys_user t1 inner join sys_user_role t3 on t1.user_id = t3.user_id and
|
||||
t3.role_id = #{param.roleId})
|
||||
<if test="param.username != null and param.username != ''">
|
||||
AND t1.username like concat('%', #{param.username}, '%')
|
||||
</if>
|
||||
<if test="param.phone != null and param.phone != ''">
|
||||
AND t1.phone like concat('%', #{param.phone}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectVoList" resultMap="SysUserVoResult">
|
||||
<include refid="selectUserVo"/>
|
||||
</select>
|
||||
|
||||
@ -8,4 +8,10 @@
|
||||
select role_id from sys_user_role where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByRoleIdAndUserIds">
|
||||
delete from sys_user_role where role_id = #{roleId} and user_id in
|
||||
<foreach collection="list" item="userId" open="(" separator="," close=")">
|
||||
#{userId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user