FormAuthorizeActMapper.xml 2.26 KB
<?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>