UrlResource.xml 1.2 KB

1234567891011121314151617181920212223242526272829303132
  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="UrlResourceMapper">
  4. <select id="list" resultType="am.lodge.platform.model.UrlResource">
  5. SELECT
  6. id, name, url, leaf, enabled, order_Num as orderNum, parent_id as parentId,app_id appId,IMAGE_URL imageUrl
  7. FROM
  8. sys_url_resource
  9. <where>
  10. <if test="id != null">and id = #{id}</if>
  11. <if test="root != null">and parent_id is null</if>
  12. <if test="parentId != null">and parent_id = #{parentId}</if>
  13. </where>
  14. ORDER BY order_num
  15. </select>
  16. <select id="permissions" resultType="map">
  17. select r.id "id",r.name as "text",r.parent_id as "pid",r.url as "url", r.image_url as "iconCls", r.app_id "app_id" from sys_url_resource r
  18. inner join sys_app a on r.app_id = a.id
  19. <if test="appType == null"> and a.app_type = 'web' </if>
  20. <if test="appType != null"> and a.app_type = #{appType} </if>
  21. <if test="userId != null">
  22. where exists(
  23. select 1 from sys_role_url_resource rr where rr.resource_id = r.id and exists(
  24. select 1 from sys_user_role ur where ur.role_id = rr.role_id and ur.user_id = #{userId}
  25. )
  26. )
  27. </if>
  28. ORDER BY r.order_num
  29. </select>
  30. </mapper>