拓恒统一认证授权服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AuthoritiesMapper.xml 2.0KB

8 months ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.tuoheng.mapper.AuthoritiesMapper">
  4. <insert id="batchInsert" parameterType="java.util.List">
  5. insert into authorities (user_id, username, authority, create_user)
  6. VALUES
  7. <foreach collection="list" item="it" separator=",">
  8. (#{it.userId}, #{it.username}, #{it.authority}, #{it.createUser})
  9. </foreach>
  10. </insert>
  11. <delete id="deleteByUserIdAndClient">
  12. delete
  13. from authorities
  14. where user_id = #{userId}
  15. and authority = #{clientId}
  16. </delete>
  17. <select id="selectByUserId" resultType="com.tuoheng.model.po.AuthoritiesPo">
  18. SELECT id, user_id, username, authority
  19. FROM authorities
  20. WHERE user_id = #{userId}
  21. </select>
  22. <select id="selectListByUserIdAndClientId" resultType="com.tuoheng.model.po.AuthoritiesPo">
  23. SELECT id, user_id, username, authority
  24. FROM authorities
  25. WHERE user_id = #{userId}
  26. <if test="query.clientId != null and query.clientId != ''">
  27. and authority LIKE concat('%',#{query.clientId},'%')
  28. </if>
  29. </select>
  30. <select id="selectByUserIds" resultType="com.tuoheng.model.po.AuthoritiesPo">
  31. SELECT id, user_id, username, authority
  32. FROM authorities
  33. where user_id IN
  34. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  35. #{item}
  36. </foreach>
  37. </select>
  38. <select id="selectByUserIdsAndClient" resultType="com.tuoheng.model.po.AuthoritiesPo">
  39. SELECT id, user_id, username, authority
  40. FROM authorities
  41. WHERE authority LIKE concat('%', #{clientId}, '%')
  42. and
  43. user_id IN
  44. <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
  45. #{item}
  46. </foreach>
  47. </select>
  48. </mapper>