ResourceDao.xml 1015 B

12345678910111213141516171819202122232425262728
  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.inkasso.factoring.system.resource.dao.ResourceDAO">
  4. <select id="getResourceById" resultType="com.inkasso.factoring.system.resource.model.dto.ResourceDTO">
  5. select
  6. distinct
  7. d.*
  8. from kfb_sys_user_role a
  9. JOIN kfb_sys_role b on a.tenant_id = b.tenant_id and a.role_id = b.id
  10. JOIN kfb_sys_role_resource c on b.id = c.role_id
  11. LEFT JOIN kfb_sys_resource d on c.resource_id = d.id
  12. where a.user_id = #{userId} and a.tenant_id = #{tenantId}
  13. </select>
  14. <!-- 通过角色id 查询 该角色下的资源 -->
  15. <select id="getResourceByRoleId" resultType="com.inkasso.factoring.system.resource.model.dto.ResourceDTO"
  16. parameterType="java.lang.Long">
  17. select
  18. a.*
  19. from kfb_sys_resource a
  20. left join kfb_sys_role_resource b on a.id = b.resource_id
  21. where b.role_id = #{roleId}
  22. </select>
  23. </mapper>