BpmFlowCollectMapper.xml 2.2 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.runtime.dao.BpmFlowCollectDao">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hotent.runtime.model.BpmFlowCollect">
        <id column="ID_" property="id" />
    <result column="DEF_KEY_" property="defKey" />
    <result column="CREATOR_" property="creator" />
    <result column="CREATE_TIME_" property="createTime" />
    <result column="TENANT_ID_" property="tenantId" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID_, DEF_KEY_, CREATOR_, CREATE_TIME_, TENANT_ID_
    </sql>

	<select id="selectPage" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			bpm_flow_collect
		${ew.customSqlSegment}
	</select>
	
	<select id="selectList" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			bpm_flow_collect
		${ew.customSqlSegment}
	</select>
	
	<select id="selectById" resultMap="BaseResultMap">
		select 
			<include refid="Base_Column_List"/> 
		from
			bpm_flow_collect
		where 
		    ID_ = ${id}
	</select>

	<select id="getUserCollect" resultType="com.hotent.bpm.persistence.model.DefaultBpmDefinition">
		select def.*
		from bpm_definition def
				 inner join bpm_flow_collect collect
							on collect.DEF_KEY_ = def.DEF_KEY_
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.customSqlSegment)">
			${ew.customSqlSegment}
		</if>
	</select>

	<select id="getUserCollectDefKeys" resultType="java.lang.String">
		select DEF_KEY_
		from bpm_flow_collect where CREATOR_ = #{userId}
	</select>

	<select id="getCollectCountByUserId" resultType="java.util.Map">
		select def.TYPE_ID_ as "typeId", count(col.DEF_KEY_) as "count"
		from BPM_FLOW_COLLECT col
				 left join BPM_DEFINITION def on def.DEF_KEY_ = col.DEF_KEY_
		<if test="@com.hotent.base.ognl.Ognl@isNotEmpty(ew.customSqlSegment)">
			${ew.customSqlSegment}
			AND
		</if>
		<if test="@com.hotent.base.ognl.Ognl@isEmpty(ew.customSqlSegment)">
			WHERE
		</if>
		def.IS_MAIN_ = 'Y' and col.CREATOR_ = #{userId}
		group by def.TYPE_ID_
	</select>

</mapper>