<?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="org.springblade.desk.mapper.ActHiProcinstMapper">
<resultMap id="actHiProcinstMap" type="org.springblade.desk.entity.ActHiProcinst" >
<result column="ID_" property="id" />
<result column="REV_" property="rev" />
<result column="PROC_INST_ID_" property="procInstId" />
<result column="BUSINESS_KEY_" property="businessKey" />
<result column="PROC_DEF_ID_" property="procDefId" />
<result column="START_TIME_" property="startTime" />
<result column="END_TIME_" property="endTime" />
<result column="DURATION_" property="duration" />
<result column="START_USER_ID_" property="startUserId" />
<result column="START_ACT_ID_" property="startActId" />
<result column="END_ACT_ID_" property="endActId" />
<result column="SUPER_PROCESS_INSTANCE_ID_" property="superProcessInstanceId" />
<result column="DELETE_REASON_" property="deleteReason" />
<result column="NAME_" property="name" />
<result column="CALLBACK_ID_" property="callbackId" />
<result column="CALLBACK_TYPE_" property="callbackType" />
</resultMap>
<!--查询已经发起的流程单据-->
<select id="getApplicationFormsList" parameterType="org.springblade.desk.entity.ActHiProcinst" resultMap="actHiProcinstMap">
select * from bladex_flow.act_hi_procinst where
<if test="procDefId !=null and procDefId !='' ">
PROC_DEF_ID_=#{procDefId}
</if>
<if test="endActId =='1'">
and END_ACT_ID_='end'
</if>
<if test="endActId =='2' ">
and END_ACT_ID_!='end'
</if>
<if test="startUserId !=null and startUserId !='' ">
and START_USER_ID_=#{startUserId}
</if>
<if test="startDate !=null">
START_TIME_ >= #{startDate}
</if>
<if test="endDate !=null">
START_TIME_ <= #{endDate}
</if>
order by START_TIME_ desc
</select>
<!--获取流程单据名称-->
<select id="getOrderInfo" resultType="java.util.Map">
SELECT s.name FROM sap_form_info s where s.process_definition_id like '%%${procDefId}%%'
UNION
SELECT a.name FROM oa_form_info a where a.process_definition_id like '%%${procDefId}%%'
</select>
<!--根据流程实例id获取单号-->
<select id="getorderCode" resultType="java.util.Map">
select TEXT_ from bladex_flow.act_hi_varinst where PROC_INST_ID_=#{procInstId} and NAME_='orderCode' LIMIT 1
</select>
<!--查询全部流程管理信息-->
<select id="getAllFlowInfo" resultType="java.util.Map">
SELECT s.name,s.process_definition_id FROM sap_form_info s where s.is_deleted=0
UNION
SELECT a.name,a.process_definition_id FROM oa_form_info a where a.is_deleted=0
</select>
<!--分页查询-->
<select id="getApplicationFormsListPage" resultType="org.springblade.desk.entity.ActHiProcinst">
select * from bladex_flow.act_hi_procinst
<where>
<if test="procDefId !=null and procDefId !='' ">
PROC_DEF_ID_ like '%%${procDefId}%%'
</if>
<if test="statusBar2 !=null and statusBar2 !=''">
and (END_ACT_ID_ is not null and trim(END_ACT_ID_)!='')
</if>
<if test="statusBar1 !=null and statusBar1 !='' ">
and (END_ACT_ID_ is null or trim(END_ACT_ID_)='')
</if>
<if test="startUserId !=null and startUserId !='' ">
and START_USER_ID_ like '%%${startUserId}%%'
</if>
<if test="startDate !=null">
and START_TIME_ >= #{startDate}
</if>
<if test="endDate !=null">
and START_TIME_ <= #{endDate}
</if>
</where>
order by START_TIME_ desc
</select>
</mapper>