懒羊羊
2023-08-30 71e81ed1d12e4d69f53c8ad9e066650ad4186293
提交 | 用户 | 时间
71e81e 1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="cn.stylefeng.guns.workflow.modular.mapper.HistoryProcessMapper">
4
5     <!-- 通用查询映射结果 -->
6     <resultMap id="BaseResultMap" type="cn.stylefeng.guns.workflow.modular.entity.Procinst">
7         <id column="ID_" property="id"/>
8         <result column="PROC_INST_ID_" property="procInstId"/>
9         <result column="BUSINESS_KEY_" property="businessKey"/>
10         <result column="PROC_DEF_ID_" property="procDefId"/>
11         <result column="START_TIME_" property="startTime"/>
12         <result column="END_TIME_" property="endTime"/>
13         <result column="DURATION_" property="duration"/>
14         <result column="START_USER_ID_" property="startUserId"/>
15         <result column="START_ACT_ID_" property="startActId"/>
16         <result column="END_ACT_ID_" property="endActId"/>
17         <result column="SUPER_PROCESS_INSTANCE_ID_" property="superProcessInstanceId"/>
18         <result column="DELETE_REASON_" property="deleteReason"/>
19         <result column="TENANT_ID_" property="tenantId"/>
20         <result column="NAME_" property="name"/>
21     </resultMap>
22
23     <!-- 通用查询结果列 -->
24     <sql id="Base_Column_List">
25         ID_ AS "id", PROC_INST_ID_ AS "procInstId", BUSINESS_KEY_ AS "businessKey", PROC_DEF_ID_ AS "procDefId", START_TIME_ AS "startTime", END_TIME_ AS "endTime", DURATION_ AS "duration", START_USER_ID_ AS "startUserId", START_ACT_ID_ AS "startActId", END_ACT_ID_ AS "endActId", SUPER_PROCESS_INSTANCE_ID_ AS "superProcessInstanceId", DELETE_REASON_ AS "deleteReason", TENANT_ID_ AS "tenantId", NAME_ AS "name"
26     </sql>
27
28
29     <select id="customList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcinstResult" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcinstParam">
30         select
31         <include refid="Base_Column_List"/>
32         from act_hi_procinst where 1 = 1
33     </select>
34
35     <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcinstParam">
36         select
37         <include refid="Base_Column_List"/>
38         from act_hi_procinst where 1 = 1
39     </select>
40
41     <select id="customPageList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcinstResult" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcinstParam">
42         select
43         <include refid="Base_Column_List"/>
44         from act_hi_procinst where 1 = 1
45     </select>
46
47     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcinstParam">
48         select
49         <include refid="Base_Column_List"/>
50         from act_hi_procinst where 1 = 1
51     </select>
52
53     <!-- ACT_HI_PROCINST 字段-->
54     <sql id="hp">
55         hp.ID_ AS "id_",
56         hp.PROC_INST_ID_ AS "proc_inst_id_",
57         hp.BUSINESS_KEY_ AS "business_key_",
58         hp.PROC_DEF_ID_ AS "proc_def_id_",
59         hp.START_TIME_ AS "start_time_",
60         hp.END_TIME_ AS "end_time_",
61         hp.DURATION_ AS "duration_",
62         hp.START_USER_ID_ AS "start_user_id_",
63         hp.START_ACT_ID_ AS "start_act_id_",
64         hp.END_ACT_ID_ AS "end_act_id_",
65         hp.SUPER_PROCESS_INSTANCE_ID_ AS "super_process_instance_id_",
66         hp.DELETE_REASON_ AS "delete_reason_",
67         hp.TENANT_ID_ AS "tenant_id_",
68         hp.NAME_ AS "name_"
69     </sql>
70     <!--ACT_HI_VARINST-->
71     <sql id="ahv">
72       ID_ AS "id_",
73       PROC_INST_ID_ AS "proc_inst_id_",
74       EXECUTION_ID_ AS "execution_id_",
75       TASK_ID_ AS "task_id_",
76       NAME_ AS "name_",
77       VAR_TYPE_ AS "var_type_",
78       REV_ AS "REV_",
79       BYTEARRAY_ID_ AS "bytearray_id_",
80       DOUBLE_ AS "double_",
81       LONG_ AS "long_",
82       TEXT_ AS "text_",
83       TEXT2_ AS "text2_",
84       CREATE_TIME_ AS "create_time_",
85       LAST_UPDATED_TIME_  AS "last_updated_time_"
86     </sql>
87     <!-- 历史流程列表-->
88     <select id="datalistPage" resultType="map">
89         select
90         <include refid="hp"/>
91         ,
92         rp.NAME_ pname_,
93         rp.VERSION_ version_,
94         rp.ID_ pid_,
95         rp.DEPLOYMENT_ID_ deployment_id_,
96         rp.DGRM_RESOURCE_NAME_ dgrm_resource_name_
97         from
98         ACT_HI_PROCINST hp
99         left join
100         ACT_RE_PROCDEF rp
101         on hp.PROC_DEF_ID_ = rp.ID_
102         where 1=1
103         <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
104             and
105             (
106             rp.NAME_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
107             )
108         </if>
109         <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
110             and hp.END_TIME_ &gt;= #{pd.lastStart}
111         </if>
112         <if test="pd.lastEnd != null and pd.lastEnd != ''"><!-- 结束时间检索 -->
113             and hp.END_TIME_ &lt;= #{pd.lastEnd}
114         </if>
115         and hp.END_TIME_ is not NULL
116         order by hp.END_TIME_ desc
117     </select>
118
119     <select id="datalistPage" resultType="map" databaseId="mssql">
120         select
121         <include refid="hp"/>
122         ,
123         rp.NAME_ pname_,
124         rp.VERSION_ version_,
125         rp.ID_ pid_,
126         rp.DEPLOYMENT_ID_ deployment_id_,
127         rp.DGRM_RESOURCE_NAME_ dgrm_resource_name_
128         from
129         ACT_HI_PROCINST hp
130         left join
131         ACT_RE_PROCDEF rp
132         on hp.PROC_DEF_ID_ = rp.ID_
133         where 1=1
134         <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
135             and
136             (
137             rp.NAME_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
138             )
139         </if>
140         <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
141             and hp.END_TIME_ &gt;= #{pd.lastStart}
142         </if>
143         <if test="pd.lastEnd != null and pd.lastEnd != ''"><!-- 结束时间检索 -->
144             and hp.END_TIME_ &lt;= #{pd.lastEnd}
145         </if>
146         and hp.END_TIME_ is not NULL
147         order by hp.END_TIME_ desc
148     </select>
149
150     <select id="datalistPage" resultType="map" databaseId="pgsql">
151         select
152         <include refid="hp"/>
153         ,
154         rp.NAME_ pname_,
155         rp.VERSION_ version_,
156         rp.ID_ pid_,
157         rp.DEPLOYMENT_ID_ deployment_id_,
158         rp.DGRM_RESOURCE_NAME_ dgrm_resource_name_
159         from
160         ACT_HI_PROCINST hp
161         left join
162         ACT_RE_PROCDEF rp
163         on hp.PROC_DEF_ID_ = rp.ID_
164         where 1=1
165         <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
166             and
167             (
168             rp.NAME_ LIKE '%' || #{pd.keywords} || '%'
169             )
170         </if>
171         <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
172             and hp.END_TIME_ &gt;= to_timestamp(#{pd.lastStart}||' 00:00:00','yyyy-mm-dd hh24:mi:ss')
173         </if>
174         <if test="pd.lastEnd != null and pd.lastEnd != ''"><!-- 结束时间检索 -->
175             and hp.END_TIME_ &lt;= to_timestamp(#{pd.lastEnd}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
176         </if>
177         and hp.END_TIME_ is not NULL
178         order by hp.END_TIME_ desc
179     </select>
180
181     <select id="datalistPage" resultType="map" databaseId="oracle">
182         select
183         <include refid="hp"/>
184         ,
185         rp.NAME_ "pname_",
186         rp.VERSION_ "version_",
187         rp.ID_ "pid_",
188         rp.DEPLOYMENT_ID_ "deployment_id_",
189         rp.DGRM_RESOURCE_NAME_ "dgrm_resource_name_"
190         from
191         ACT_HI_PROCINST hp
192         left join
193         ACT_RE_PROCDEF rp
194         on hp.PROC_DEF_ID_ = rp.ID_
195         where 1=1
196         <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
197             and
198             (
199             rp.NAME_ LIKE '%' || #{pd.keywords} || '%'
200             )
201         </if>
202         <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
203             and hp.END_TIME_ &gt;= to_date(#{pd.lastStart}||' 00:00:00','yyyy-mm-dd hh24:mi:ss')
204         </if>
205         <if test="pd.lastEnd != null and pd.lastEnd != ''"><!-- 结束时间检索 -->
206             and hp.END_TIME_ &lt;= to_date(#{pd.lastEnd}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
207         </if>
208         and hp.END_TIME_ is not NULL
209         order by hp.END_TIME_ desc
210     </select>
211
212     <!-- 历史流程变量列表 -->
213     <select id="hivarList" resultType="map">
214         select
215         <include refid="ahv"/>
216         from
217         ACT_HI_VARINST ahv
218         where 1=1
219         <if test="PROC_INST_ID_ != null and PROC_INST_ID_ != ''"><!-- 流程实例ID -->
220             and PROC_INST_ID_ = #{PROC_INST_ID_}
221             and TASK_ID_ is NULL
222         </if>
223     </select>
224
225     <select id="hivarList" resultType="map" databaseId="mssql">
226         select
227         <include refid="ahv"/>
228         from
229         ACT_HI_VARINST ahv
230         where 1=1
231         <if test="PROC_INST_ID_ != null and PROC_INST_ID_ != ''"><!-- 流程实例ID -->
232             and PROC_INST_ID_ = #{PROC_INST_ID_}
233             and TASK_ID_ is NULL
234         </if>
235     </select>
236
237     <select id="hivarList" resultType="map" databaseId="pgsql">
238         select
239         <include refid="ahv"/>
240         from
241         ACT_HI_VARINST ahv
242         where 1=1
243         <if test="PROC_INST_ID_ != null and PROC_INST_ID_ != ''"><!-- 流程实例ID -->
244             and PROC_INST_ID_ = #{PROC_INST_ID_}
245             and TASK_ID_ is NULL
246         </if>
247     </select>
248
249     <select id="hivarList" resultType="map" databaseId="oracle">
250         select
251         <include refid="ahv"/>
252         from
253         ACT_HI_VARINST ahv
254         where 1=1
255         <if test="PROC_INST_ID_ != null and PROC_INST_ID_ != ''"><!-- 流程实例ID -->
256             and PROC_INST_ID_ = #{PROC_INST_ID_}
257             and TASK_ID_ is NULL
258         </if>
259     </select>
260
261 </mapper>