yyt
2024-06-26 0cceb649e1dc443c2a91d26d81eacb0867c96db3
提交 | 用户 | 时间
0cceb6 1 <?xml version="1.0" encoding="UTF-8" ?>
Y 2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.jcdm.system.mapper.SysUserRoleMapper">
6
7     <resultMap type="SysUserRole" id="SysUserRoleResult">
8         <result property="userId"     column="user_id"      />
9         <result property="roleId"     column="role_id"      />
10     </resultMap>
11
12     <delete id="deleteUserRoleByUserId" parameterType="Long">
13         delete from sys_user_role where user_id=#{userId}
14     </delete>
15     
16     <select id="countUserRoleByRoleId" resultType="Integer">
17         select count(1) from sys_user_role where role_id=#{roleId}  
18     </select>
19     
20     <delete id="deleteUserRole" parameterType="Long">
21          delete from sys_user_role where user_id in
22          <foreach collection="array" item="userId" open="(" separator="," close=")">
23              #{userId}
24         </foreach> 
25      </delete>
26     
27     <insert id="batchUserRole">
28         insert into sys_user_role(user_id, role_id) values
29         <foreach item="item" index="index" collection="list" separator=",">
30             (#{item.userId},#{item.roleId})
31         </foreach>
32     </insert>
33     
34     <delete id="deleteUserRoleInfo" parameterType="SysUserRole">
35         delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
36     </delete>
37     
38     <delete id="deleteUserRoleInfos">
39         delete from sys_user_role where role_id=#{roleId} and user_id in
40          <foreach collection="userIds" item="userId" open="(" separator="," close=")">
41              #{userId}
42             </foreach> 
43     </delete>
44 </mapper>