first commit
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<?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.mhd.user.domain.userAggregate.repository.mapper.UserRoleMapper">
|
||||
|
||||
<sql id="selectUserMenuVo">
|
||||
SELECT
|
||||
a.user_role_id,
|
||||
a.user_id,
|
||||
a.role_id
|
||||
FROM
|
||||
`user_role` a
|
||||
</sql>
|
||||
<select id="userRoleMenuList" resultType="com.mhd.common.core.domain.po.UserRoleMenuPO">
|
||||
SELECT
|
||||
a.role_id,
|
||||
a.user_id,
|
||||
b.menu_id
|
||||
FROM
|
||||
user_role a
|
||||
LEFT JOIN role_menu b ON a.role_id = b.role_id
|
||||
WHERE a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserRoleDo"
|
||||
resultType="com.mhd.user.domain.userAggregate.entity.UserRoleEntity">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
<select id="selectUserRoleList" parameterType="com.mhd.user.domain.userAggregate.repository.todo.UserRoleDo"
|
||||
resultType="com.mhd.common.core.domain.po.UserRoleMenuPO">
|
||||
<include refid="selectUserMenuVo"/>
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
<include refid="common_where"/>
|
||||
</select>
|
||||
<select id="deleteByUserId" parameterType="java.lang.Long" >
|
||||
DELETE
|
||||
FROM
|
||||
`user_role` a
|
||||
WHERE
|
||||
a.del_flag = 1
|
||||
and a.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRolesByUserId" resultType="com.mhd.common.core.domain.po.UserRoleMenuPO" parameterType="java.lang.Long">
|
||||
SELECT
|
||||
ur.user_role_id,
|
||||
ur.role_id,
|
||||
ur.user_id,
|
||||
r.role_name,
|
||||
r.role_code
|
||||
FROM
|
||||
user_role ur
|
||||
LEFT JOIN role r ON ur.role_id = r.role_id
|
||||
AND r.del_flag = 1
|
||||
WHERE ur.del_flag = 1
|
||||
AND ur.user_id = #{userid}
|
||||
</select>
|
||||
|
||||
<sql id="common_where">
|
||||
<if test="userId !=null and userId !='' ">
|
||||
and a.user_id = #{userId}
|
||||
</if>
|
||||
<if test="roleId !=null and roleId !='' ">
|
||||
and a.role_id = #{roleId}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="getUserIdByRoleCode" resultType="java.lang.Long">
|
||||
select
|
||||
u.user_id
|
||||
from user u
|
||||
left join user_role ur on u.user_id = ur.user_id and ur.del_flag = 1
|
||||
left join role r on r.role_id = ur.role_id and r.del_flag = 1
|
||||
<where>
|
||||
u.del_flag = 1
|
||||
and u.top_organization_id = #{topOrganizationId}
|
||||
and r.role_code in
|
||||
<foreach item="code" collection="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
</where>
|
||||
group by u.user_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user