SysUserRoleMapper.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?xml version="1.0" encoding="UTF-8" ?>
  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.slibra.system.mapper.SysUserRoleMapper">
  6. <resultMap type="SysUserRole" id="SysUserRoleResult">
  7. <result property="userId" column="user_id" />
  8. <result property="roleId" column="role_id" />
  9. </resultMap>
  10. <delete id="deleteUserRoleByUserId" parameterType="Long">
  11. delete from sys_user_role where user_id=#{userId}
  12. </delete>
  13. <select id="countUserRoleByRoleId" resultType="Integer">
  14. select count(1) from sys_user_role where role_id=#{roleId}
  15. </select>
  16. <delete id="deleteUserRole" parameterType="Long">
  17. delete from sys_user_role where user_id in
  18. <foreach collection="array" item="userId" open="(" separator="," close=")">
  19. #{userId}
  20. </foreach>
  21. </delete>
  22. <insert id="batchUserRole">
  23. insert into sys_user_role(user_id, role_id) values
  24. <foreach item="item" index="index" collection="list" separator=",">
  25. (#{item.userId},#{item.roleId})
  26. </foreach>
  27. </insert>
  28. <delete id="deleteUserRoleInfo" parameterType="SysUserRole">
  29. delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
  30. </delete>
  31. <delete id="deleteUserRoleInfos">
  32. delete from sys_user_role where role_id=#{roleId} and user_id in
  33. <foreach collection="userIds" item="userId" open="(" separator="," close=")">
  34. #{userId}
  35. </foreach>
  36. </delete>
  37. </mapper>