SysUserRoleMapper.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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.gxzc.zen.api.sys.mapper.SysUserRoleMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.gxzc.zen.api.sys.model.SysUserRole">
  6. <result column="id" property="id"/>
  7. <result column="enable" property="enable"/>
  8. <result column="remark" property="remark"/>
  9. <result column="create_time" property="createTime"/>
  10. <result column="create_by" property="createBy"/>
  11. <result column="update_time" property="updateTime"/>
  12. <result column="update_by" property="updateBy"/>
  13. <result column="role_id" property="roleId"/>
  14. <result column="user_id" property="userId"/>
  15. </resultMap>
  16. <select id="selectUserRoleListByUserId" resultType="com.gxzc.zen.api.sys.model.SysRole">
  17. SELECT A.*
  18. FROM
  19. sys_role AS A
  20. INNER JOIN sys_user_role AS B ON B.role_id = A.id
  21. WHERE B.user_id = #{userId}
  22. </select>
  23. <select id="selectUserRoleListByUserIdList" parameterType="java.util.Map" resultType="com.gxzc.zen.api.sys.model.SysRole">
  24. SELECT A.*
  25. FROM
  26. sys_role AS A
  27. INNER JOIN sys_user_role AS B ON B.role_id = A.id
  28. WHERE
  29. B.user_id IN
  30. <foreach collection="userIdList" item="item" open="(" close=")">
  31. #{item}
  32. </foreach>
  33. </select>
  34. </mapper>