You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?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.glxp.api.dao.auth.SysUserRoleMapper">
|
|
|
|
|
|
|
|
<resultMap type="com.glxp.api.entity.auth.SysUserRole" id="SysUserRoleResult">
|
|
|
|
<result property="userId" column="user_id"/>
|
|
|
|
<result property="roleId" column="role_id"/>
|
|
|
|
</resultMap>
|
|
|
|
<select id="selectUserIdsByRoleId" resultType="Long">
|
|
|
|
select u.id
|
|
|
|
from auth_user u
|
|
|
|
inner join auth_user_role sur
|
|
|
|
on u.id = sur.user_id and sur.role_id = #{roleId}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectByAuthId" parameterType="java.lang.Long" resultType="com.glxp.api.entity.auth.SysUserRole">
|
|
|
|
select * from auth_user_role
|
|
|
|
where user_id=#{id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<delete id="delete" parameterType="com.glxp.api.req.auth.FilterUserRoleRequest">
|
|
|
|
DELETE
|
|
|
|
FROM auth_user_role
|
|
|
|
<where>
|
|
|
|
<if test="userId != '' and userId != null">
|
|
|
|
AND user_id = #{userId}
|
|
|
|
</if>
|
|
|
|
<if test="roleId != '' and roleId != null">
|
|
|
|
AND role_id = #{roleId}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<insert id="insert" parameterType="com.glxp.api.entity.auth.SysUserRole">
|
|
|
|
insert INTO auth_user_role values ( #{userId},
|
|
|
|
#{roleId})
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
|
|
|
|
insert INTO auth_user_role
|
|
|
|
(
|
|
|
|
user_id,role_id
|
|
|
|
)
|
|
|
|
values
|
|
|
|
<foreach collection="sysUserRoles" item="item" index="index"
|
|
|
|
separator=",">
|
|
|
|
(
|
|
|
|
#{item.userId},
|
|
|
|
#{item.roleId}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
</insert>
|
|
|
|
</mapper>
|