根据角色 查询用户

This commit is contained in:
yuezhihang
2022-02-18 16:50:04 +08:00
parent 278985f338
commit 83ae8a029a
6 changed files with 74 additions and 11 deletions
@@ -127,4 +127,33 @@
#{msgId}
</foreach>
</select>
<select id="selectUserByRole" resultType="java.lang.Integer">
SELECT count(ts_user.USID) from ts_user
LEFT JOIN ts_user_position on ts_user.USID = ts_user_position.user_id
WHERE ts_user_position.position_id in (
SELECT ts_position_role.position_id from ts_position_role
WHERE ts_position_role.role_id = #{role.roleId} )
<if test="null != role.userId and role.userId != ''">
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
</if>
<if test="null != role.userName and role.userName != ''">
and ts_user.UNAME like concat(concat('%',#{role.userName}),'%')
</if>
</select>
<select id="selectUserByRoleByPage" resultMap="UserPosition">
SELECT ts_user.UNAME,ts_user.USID from ts_user
LEFT JOIN ts_user_position on ts_user.USID = ts_user_position.user_id
WHERE ts_user_position.position_id in (
SELECT ts_position_role.position_id from ts_position_role
WHERE ts_position_role.role_id = #{role.roleId} )
<if test="null != role.userId and role.userId != ''">
and ts_user.USID like concat(concat('%',#{role.userId}),'%')
</if>
<if test="null != role.userName and role.userName != ''">
and ts_user.UNAME like concat(concat('%',#{role.userName}),'%')
</if>
limit ${(role.pageNumber - 1) * role.pageSize},${role.pageSize}
</select>
</mapper>