FormAuthorizeActMapper.xml
2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?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="com.hotent.form.dao.FormAuthorizeActDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hotent.form.model.FormAuthorizeAct">
<id column="ID_" property="id" />
<result column="AUTHORIZE_ID_" property="authorizeId" />
<result column="MODEL_KEY_" property="modelKey" />
<result column="MODEL_NAME_" property="modelName" />
<result column="RIGHT_CONTENT_" property="rightContent" />
<result column="TYPE_" property="type" />
<result column="modelType" property="MODEL_TYPE_" />
<result column="TENANT_ID_" property="tenantId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ID_, AUTHORIZE_ID_, MODEL_KEY_, MODEL_NAME_, RIGHT_CONTENT_, TYPE_, MODEL_TYPE_,TENANT_ID_
</sql>
<!--根据用户权限Map获取有权限资源列表 -->
<select id="getActRightByUserMap" resultMap="BaseResultMap" parameterType="java.util.Map" >
select b.ID_,b.AUTHORIZE_ID_,b.MODEL_KEY_,b.MODEL_NAME_,b.RIGHT_CONTENT_,b.TYPE_ from form_authorize_act b
where b.AUTHORIZE_ID_ in (
select distinct a.ID_ from form_authorize a, (
select u.AUTHORIZE_ID_ from form_authorize_user u where u.RIGHT_TYPE_ = 'everyone'
<foreach collection="userRightMap" index="key" item="value" open="" separator=" " close="">
union
select u.AUTHORIZE_ID_ from form_authorize_user u
where u.RIGHT_TYPE_ = #{key} and u.OWNER_ID_ in (${value})
</foreach>
) c where a.ID_ = c.AUTHORIZE_ID_
) and b.MODEL_TYPE_=#{resourceType}
</select>
<select id="selectPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
form_authorize_act
${ew.customSqlSegment}
</select>
<select id="selectList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
form_authorize_act
${ew.customSqlSegment}
</select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
form_authorize_act
where
ID_ = #{id}
</select>
</mapper>