1234567891011121314151617181920212223242526272829303132 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="UrlResourceMapper">
- <select id="list" resultType="am.lodge.platform.model.UrlResource">
- SELECT
- id, name, url, leaf, enabled, order_Num as orderNum, parent_id as parentId,app_id appId,IMAGE_URL imageUrl
- FROM
- sys_url_resource
- <where>
- <if test="id != null">and id = #{id}</if>
- <if test="root != null">and parent_id is null</if>
- <if test="parentId != null">and parent_id = #{parentId}</if>
- </where>
- ORDER BY order_num
- </select>
- <select id="permissions" resultType="map">
- 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
- inner join sys_app a on r.app_id = a.id
- <if test="appType == null"> and a.app_type = 'web' </if>
- <if test="appType != null"> and a.app_type = #{appType} </if>
- <if test="userId != null">
- where exists(
- select 1 from sys_role_url_resource rr where rr.resource_id = r.id and exists(
- select 1 from sys_user_role ur where ur.role_id = rr.role_id and ur.user_id = #{userId}
- )
- )
- </if>
- ORDER BY r.order_num
- </select>
- </mapper>
|