懒羊羊
2023-08-30 1ac2bc1590406d9babec036e154d8d08f34a6aa1
提交 | 用户 | 时间
1ac2bc 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.ProcessMapper">
4
5     <!-- 通用查询映射结果 -->
6     <resultMap id="BaseResultMap" type="cn.stylefeng.guns.workflow.modular.entity.Procdef">
7         <id column="ID_" property="id"/>
8         <result column="REV_" property="rev"/>
9         <result column="CATEGORY_" property="category"/>
10         <result column="NAME_" property="name"/>
11         <result column="KEY_" property="key"/>
12         <result column="VERSION_" property="version"/>
13         <result column="DEPLOYMENT_ID_" property="deploymentId"/>
14         <result column="RESOURCE_NAME_" property="resourceName"/>
15         <result column="DGRM_RESOURCE_NAME_" property="dgrmResourceName"/>
16         <result column="DESCRIPTION_" property="description"/>
17         <result column="HAS_START_FORM_KEY_" property="hasStartFormKey"/>
18         <result column="HAS_GRAPHICAL_NOTATION_" property="hasGraphicalNotation"/>
19         <result column="SUSPENSION_STATE_" property="suspensionState"/>
20         <result column="TENANT_ID_" property="tenantId"/>
21         <result column="ENGINE_VERSION_" property="engineVersion"/>
22     </resultMap>
23
24     <!-- 通用查询结果列 -->
25     <sql id="Base_Column_List">
26         ID_ AS "id", REV_ AS "rev", CATEGORY_ AS "category", NAME_ AS "name", KEY_ AS "key", VERSION_ AS "version", DEPLOYMENT_ID_ AS "deploymentId", RESOURCE_NAME_ AS "resourceName", DGRM_RESOURCE_NAME_ AS "dgrmResourceName", DESCRIPTION_ AS "description", HAS_START_FORM_KEY_ AS "hasStartFormKey", HAS_GRAPHICAL_NOTATION_ AS "hasGraphicalNotation", SUSPENSION_STATE_ AS "suspensionState", TENANT_ID_ AS "tenantId", ENGINE_VERSION_ AS "engineVersion"
27     </sql>
28
29     <!-- 激活or挂起任务(指定某个任务) -->
30     <update id="onoffTask">
31         update
32         ACT_RU_TASK
33         set
34         SUSPENSION_STATE_ = #{status}
35         where ID_ = #{id}
36     </update>
37
38     <update id="onoffTask" databaseId="mssql">
39         update
40         ACT_RU_TASK
41         set
42         SUSPENSION_STATE_ = #{status}
43         where ID_ = #{id}
44     </update>
45
46     <update id="onoffTask" databaseId="pgsql">
47         update
48         ACT_RU_TASK
49         set
50         SUSPENSION_STATE_ = #{status}
51         where ID_ = #{id}
52     </update>
53
54     <update id="onoffTask" databaseId="oracle">
55         update
56         ACT_RU_TASK
57         set
58         SUSPENSION_STATE_ = #{status}
59         where ID_ = #{id}
60     </update>
61
62     <!-- 激活or挂起任务(指定某个流程的所有任务) -->
63     <update id="onoffAllTask">
64         update
65         ACT_RU_TASK
66         set
67         SUSPENSION_STATE_ = #{status}
68         where PROC_DEF_ID_ = #{id}
69     </update>
70
71     <update id="onoffAllTask" databaseId="mssql">
72         update
73         ACT_RU_TASK
74         set
75         SUSPENSION_STATE_ = #{status}
76         where PROC_DEF_ID_ = #{id}
77     </update>
78
79     <update id="onoffAllTask" databaseId="pgsql">
80         update
81         ACT_RU_TASK
82         set
83         SUSPENSION_STATE_ = #{status}
84         where PROC_DEF_ID_ = #{id}
85     </update>
86
87     <update id="onoffAllTask" databaseId="oracle">
88         update
89         ACT_RU_TASK
90         set
91         SUSPENSION_STATE_ = #{status}
92         where PROC_DEF_ID_ = #{id}
93     </update>
94
95     <select id="customList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam">
96         select
97         <include refid="Base_Column_List"/>
98         from act_re_procdef where 1 = 1
99         <if test="paramCondition.name != null and paramCondition.name != ''">
100             and NAME_ like CONCAT('%',#{paramCondition.name},'%')
101         </if>
102     </select>
103
104     <select id="customList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult"
105             parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="mssql">
106         select
107         <include refid="Base_Column_List"/>
108         from act_re_procdef where 1 = 1
109         <if test="paramCondition.name != null and paramCondition.name != ''">
110             and NAME_ like CONCAT('%',#{paramCondition.name},'%')
111         </if>
112     </select>
113
114     <select id="customList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult"
115             parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="pgsql">
116         select
117         <include refid="Base_Column_List"/>
118         from act_re_procdef where 1 = 1
119         <if test="paramCondition.name != null and paramCondition.name != ''">
120             and NAME_ like '%' || #{paramCondition.name} || '%'
121         </if>
122     </select>
123
124     <select id="customList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult"
125             parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="oracle">
126         select
127         <include refid="Base_Column_List"/>
128         from act_re_procdef where 1 = 1
129         <if test="paramCondition.name != null and paramCondition.name != ''">
130             and NAME_ like '%' || #{paramCondition.name} || '%'
131         </if>
132     </select>
133
134     <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam">
135         select
136         <include refid="Base_Column_List"/>
137         from act_re_procdef where 1 = 1
138         <if test="paramCondition.name != null and paramCondition.name != ''">
139             and NAME_ like CONCAT('%',#{paramCondition.name},'%')
140         </if>
141     </select>
142
143     <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="mssql">
144         select
145         <include refid="Base_Column_List"/>
146         from act_re_procdef where 1 = 1
147         <if test="paramCondition.name != null and paramCondition.name != ''">
148             and NAME_ like CONCAT('%',#{paramCondition.name},'%')
149         </if>
150     </select>
151
152     <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="pgsql">
153         select
154         <include refid="Base_Column_List"/>
155         from act_re_procdef where 1 = 1
156         <if test="paramCondition.name != null and paramCondition.name != ''">
157             and NAME_ like '%' || #{paramCondition.name} || '%'
158         </if>
159     </select>
160
161     <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="oracle">
162         select
163         <include refid="Base_Column_List"/>
164         from act_re_procdef where 1 = 1
165         <if test="paramCondition.name != null and paramCondition.name != ''">
166             and NAME_ like '%' || #{paramCondition.name} || '%'
167         </if>
168     </select>
169
170     <select id="customPageList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam">
171         select
172         p.ID_ AS "id", p.CATEGORY_ AS "category", p.NAME_ AS "name", p.KEY_ AS "key", p.VERSION_ AS "version", p.DEPLOYMENT_ID_ AS "deploymentId",
173         p.RESOURCE_NAME_ AS "resourceName", p.DGRM_RESOURCE_NAME_ AS "dgrmResourceName", DESCRIPTION_ AS "description", p.SUSPENSION_STATE_ AS "suspensionState",
174         d.DEPLOY_TIME_ as deployTime
175         from act_re_procdef p
176         left join
177         ACT_RE_DEPLOYMENT d
178         on p.DEPLOYMENT_ID_ = d.ID_
179         where 1=1
180         <if test="paramCondition.keywords!= null and paramCondition.keywords != ''"><!-- 关键词检索 -->
181             and
182             (
183             p.NAME_ LIKE CONCAT(CONCAT('%', #{paramCondition.keywords}),'%')
184             )
185         </if>
186         <if test="paramCondition.lastStart != null and paramCondition.lastStart != ''"><!-- 开始时间检索 -->
187             and d.DEPLOY_TIME_ &gt;= #{paramCondition.lastStart}
188         </if>
189         <if test="paramCondition.lastEnd != null and paramCondition.lastEnd != ''"><!-- 结束时间检索 -->
190             and d.DEPLOY_TIME_ &lt;= #{paramCondition.lastEnd}
191         </if>
192         order by d.DEPLOY_TIME_ desc
193     </select>
194
195     <select id="customPageList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult"
196             parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="mssql">
197         select
198         p.ID_ AS "id", p.CATEGORY_ AS "category", p.NAME_ AS "name", p.KEY_ AS "key", p.VERSION_ AS "version", p.DEPLOYMENT_ID_ AS "deploymentId",
199         p.RESOURCE_NAME_ AS "resourceName", p.DGRM_RESOURCE_NAME_ AS "dgrmResourceName", DESCRIPTION_ AS "description", p.SUSPENSION_STATE_ AS "suspensionState",
200         d.DEPLOY_TIME_ as deployTime
201         from act_re_procdef p
202         left join
203         ACT_RE_DEPLOYMENT d
204         on p.DEPLOYMENT_ID_ = d.ID_
205         where 1=1
206         <if test="paramCondition.keywords!= null and paramCondition.keywords != ''"><!-- 关键词检索 -->
207             and
208             (
209             p.NAME_ LIKE CONCAT(CONCAT('%', #{paramCondition.keywords}),'%')
210             )
211         </if>
212         <if test="paramCondition.lastStart != null and paramCondition.lastStart != ''"><!-- 开始时间检索 -->
213             and d.DEPLOY_TIME_ &gt;= #{paramCondition.lastStart}
214         </if>
215         <if test="paramCondition.lastEnd != null and paramCondition.lastEnd != ''"><!-- 结束时间检索 -->
216             and d.DEPLOY_TIME_ &lt;= #{paramCondition.lastEnd}
217         </if>
218         order by d.DEPLOY_TIME_ desc
219     </select>
220
221     <select id="customPageList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult"
222             parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="pgsql">
223         select
224         p.ID_ AS "id", p.CATEGORY_ AS "category", p.NAME_ AS "name", p.KEY_ AS "key", p.VERSION_ AS "version", p.DEPLOYMENT_ID_ AS "deploymentId",
225         p.RESOURCE_NAME_ AS "resourceName", p.DGRM_RESOURCE_NAME_ AS "dgrmResourceName", DESCRIPTION_ AS "description", p.SUSPENSION_STATE_ AS "suspensionState",
226         d.DEPLOY_TIME_ as deployTime
227         from act_re_procdef p
228         left join
229         ACT_RE_DEPLOYMENT d
230         on p.DEPLOYMENT_ID_ = d.ID_
231         where 1=1
232         <if test="paramCondition.keywords!= null and paramCondition.keywords != ''"><!-- 关键词检索 -->
233             and
234             (
235             p.NAME_ LIKE '%' || #{paramCondition.keywords} || '%'
236             )
237         </if>
238         <if test="paramCondition.lastStart != null and paramCondition.lastStart != ''"><!-- 开始时间检索 -->
239             and d.DEPLOY_TIME_ &gt;= to_timestamp(#{paramCondition.lastStart}||'00:00:00','yyyy-mm-dd hh24:mi:ss')
240         </if>
241         <if test="paramCondition.lastEnd != null and paramCondition.lastEnd != ''"><!-- 结束时间检索 -->
242             and d.DEPLOY_TIME_ &lt;= to_timestamp(#{paramCondition.lastEnd}||'23:59:59','yyyy-mm-dd hh24:mi:ss')
243         </if>
244         order by d.DEPLOY_TIME_ desc
245     </select>
246
247     <select id="customPageList" resultType="cn.stylefeng.guns.workflow.modular.model.result.ProcdefResult"
248             parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="oracle">
249         select
250         p.ID_ AS "id", p.CATEGORY_ AS "category", p.NAME_ AS "name", p.KEY_ AS "key", p.VERSION_ AS "version", p.DEPLOYMENT_ID_ AS "deploymentId",
251         p.RESOURCE_NAME_ AS "resourceName", p.DGRM_RESOURCE_NAME_ AS "dgrmResourceName", DESCRIPTION_ AS "description", p.SUSPENSION_STATE_ AS "suspensionState",
252         d.DEPLOY_TIME_ as deployTime
253         from act_re_procdef p
254         left join
255         ACT_RE_DEPLOYMENT d
256         on p.DEPLOYMENT_ID_ = d.ID_
257         where 1=1
258         <if test="paramCondition.keywords!= null and paramCondition.keywords != ''"><!-- 关键词检索 -->
259             and
260             (
261             p.NAME_ LIKE '%' || #{paramCondition.keywords} || '%'
262             )
263         </if>
264         <if test="paramCondition.lastStart != null and paramCondition.lastStart != ''"><!-- 开始时间检索 -->
265             and d.DEPLOY_TIME_ &gt;= to_date(#{paramCondition.lastStart}||'00:00:00','yyyy-mm-dd hh24:mi:ss')
266         </if>
267         <if test="paramCondition.lastEnd != null and paramCondition.lastEnd != ''"><!-- 结束时间检索 -->
268             and d.DEPLOY_TIME_ &lt;= to_date(#{paramCondition.lastEnd}||'23:59:59','yyyy-mm-dd hh24:mi:ss')
269         </if>
270         order by d.DEPLOY_TIME_ desc
271     </select>
272
273     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam">
274         select
275         <include refid="Base_Column_List"/>
276         from act_re_procdef where 1 = 1
277         <if test="paramCondition.name != null and paramCondition.name != ''">
278             and NAME_ like CONCAT('%',#{paramCondition.name},'%')
279         </if>
280     </select>
281
282     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="mssql">
283         select
284         <include refid="Base_Column_List"/>
285         from act_re_procdef where 1 = 1
286         <if test="paramCondition.name != null and paramCondition.name != ''">
287             and NAME_ like CONCAT('%',#{paramCondition.name},'%')
288         </if>
289     </select>
290
291     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="pgsql">
292         select
293         <include refid="Base_Column_List"/>
294         from act_re_procdef where 1 = 1
295         <if test="paramCondition.name != null and paramCondition.name != ''">
296             and NAME_ like '%' || #{paramCondition.name} || '%'
297         </if>
298     </select>
299
300     <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.ProcdefParam" databaseId="oracle">
301         select
302         <include refid="Base_Column_List"/>
303         from act_re_procdef where 1 = 1
304         <if test="paramCondition.name != null and paramCondition.name != ''">
305             and NAME_ like '%' || #{paramCondition.name} || '%'
306         </if>
307     </select>
308
309     <!-- ACT_RU_VARIABLE -->
310     <sql id="arv">
311       ID_ AS "id_",
312       REV_ AS "rev_",
313       TYPE_ AS "type_",
314       NAME_ AS "name_",
315       EXECUTION_ID_ AS "execution_id_",
316       PROC_INST_ID_ AS "proc_inst_id_",
317       TASK_ID_ AS "task_id_",
318       BYTEARRAY_ID_ AS "bytearray_id_",
319       DOUBLE_ AS "double_",
320       LONG_ AS "long_",
321       TEXT_ AS "text_",
322       TEXT2_ AS "text2_"
323     </sql>
324     <!-- ACT_HI_ACTINST -->
325     <sql id="ht">
326       ht.ID_ AS "id_",
327       ht.PROC_DEF_ID_ AS "proc_def_id_",
328       ht.PROC_INST_ID_ AS "proc_inst_id_",
329       ht.EXECUTION_ID_ AS "execution_id_",
330       ht.ACT_ID_ AS "act_id_",
331       ht.TASK_ID_ AS "task_id_",
332       ht.CALL_PROC_INST_ID_ AS "call_proc_inst_id_",
333       ht.ACT_NAME_ AS "act_name_",
334       ht.ACT_TYPE_ AS "act_type_",
335       ht.ASSIGNEE_ AS "assignee_",
336       ht.START_TIME_ AS "start_time_",
337       ht.END_TIME_ AS "end_time_",
338       ht.DURATION_ AS "duration_",
339       ht.DELETE_REASON_ AS "delete_reason_",
340       ht.TENANT_ID_ AS "tenant_id_"
341     </sql>
342     <!-- 流程变量列表 -->
343     <select id="varList" resultType="map">
344         select
345         <include refid="arv"/>
346         from
347         ACT_RU_VARIABLE
348         where 1=1
349         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
350             and PROC_INST_ID_ = #{procInstId}
351             and TASK_ID_ is NULL
352         </if>
353     </select>
354
355     <select id="varList" resultType="map" databaseId="mssql">
356         select
357         <include refid="arv"/>
358         from
359         ACT_RU_VARIABLE
360         where 1=1
361         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
362             and PROC_INST_ID_ = #{procInstId}
363             and TASK_ID_ is NULL
364         </if>
365     </select>
366
367     <select id="varList" resultType="map" databaseId="pgsql">
368         select
369         <include refid="arv"/>
370         from
371         ACT_RU_VARIABLE
372         where 1=1
373         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
374             and PROC_INST_ID_ = #{procInstId}
375             and TASK_ID_ is NULL
376         </if>
377     </select>
378
379     <select id="varList" resultType="map" databaseId="oracle">
380         select
381         <include refid="arv"/>
382         from
383         ACT_RU_VARIABLE
384         where 1=1
385         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
386             and PROC_INST_ID_ = #{procInstId}
387             and TASK_ID_ is NULL
388         </if>
389     </select>
390
391     <!-- 历史任务节点列表关联历史流程变量表 -->
392     <select id="historyTaskList" resultType="map">
393         select
394         <include refid="ht"/>
395         ,
396         hv.TEXT_ text_
397         from
398         ACT_HI_ACTINST ht
399         left join
400         ACT_HI_VARINST hv
401         on ht.TASK_ID_ = hv.TASK_ID_
402         where 1=1
403         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
404             and ht.PROC_INST_ID_ = #{procInstId}
405         </if>
406         order by ht.ID_
407     </select>
408
409     <select id="historyTaskList" resultType="map" databaseId="mssql">
410         select
411         <include refid="ht"/>
412         ,
413         hv.TEXT_ text_
414         from
415         ACT_HI_ACTINST ht
416         left join
417         ACT_HI_VARINST hv
418         on ht.TASK_ID_ = hv.TASK_ID_
419         where 1=1
420         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
421             and ht.PROC_INST_ID_ = #{procInstId}
422         </if>
423         order by ht.ID_
424     </select>
425
426     <select id="historyTaskList" resultType="map" databaseId="pgsql">
427         select
428         <include refid="ht"/>
429         ,
430         hv.TEXT_ text_
431         from
432         ACT_HI_ACTINST ht
433         left join
434         ACT_HI_VARINST hv
435         on ht.TASK_ID_ = hv.TASK_ID_
436         where 1=1
437         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
438             and ht.PROC_INST_ID_ = #{procInstId}
439         </if>
440         order by ht.ID_
441     </select>
442
443     <select id="historyTaskList" resultType="map" databaseId="oracle">
444         select
445         <include refid="ht"/>
446         ,
447         hv.TEXT_ as "text_"
448         from
449         ACT_HI_ACTINST ht
450         left join
451         ACT_HI_VARINST hv
452         on ht.TASK_ID_ = hv.TASK_ID_
453         where 1=1
454         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
455             and ht.PROC_INST_ID_ = #{procInstId}
456         </if>
457         order by ht.ID_
458     </select>
459
460     <!--ACT_HI_VARINST-->
461     <sql id="ahv">
462       ID_ AS "id_",
463       PROC_INST_ID_ AS "proc_inst_id_",
464       EXECUTION_ID_ AS "execution_id_",
465       TASK_ID_ AS "task_id_",
466       NAME_ AS "name_",
467       VAR_TYPE_ AS "var_type_",
468       REV_ AS "REV_",
469       BYTEARRAY_ID_ AS "bytearray_id_",
470       DOUBLE_ AS "double_",
471       LONG_ AS "long_",
472       TEXT_ AS "text_",
473       TEXT2_ AS "text2_",
474       CREATE_TIME_ AS "create_time_",
475       LAST_UPDATED_TIME_  AS "last_updated_time_"
476     </sql>
477     <!-- 历史流程变量列表 -->
478     <select id="historyVariableList" resultType="map">
479         select
480         <include refid="ahv"/>
481         from
482         ACT_HI_VARINST
483         where 1=1
484         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
485             and PROC_INST_ID_ = #{procInstId}
486             and TASK_ID_ is NULL
487         </if>
488     </select>
489
490     <select id="historyVariableList" resultType="map" databaseId="mssql">
491         select
492         <include refid="ahv"/>
493         from
494         ACT_HI_VARINST
495         where 1=1
496         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
497             and PROC_INST_ID_ = #{procInstId}
498             and TASK_ID_ is NULL
499         </if>
500     </select>
501
502     <select id="historyVariableList" resultType="map" databaseId="pgsql">
503         select
504         <include refid="ahv"/>
505         from
506         ACT_HI_VARINST
507         where 1=1
508         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
509             and PROC_INST_ID_ = #{procInstId}
510             and TASK_ID_ is NULL
511         </if>
512     </select>
513
514     <select id="historyVariableList" resultType="map" databaseId="oracle">
515         select
516         <include refid="ahv"/>
517         from
518         ACT_HI_VARINST
519         where 1=1
520         <if test="_parameter != null and _parameter != ''"><!-- 流程实例ID -->
521             and PROC_INST_ID_ = #{procInstId}
522             and TASK_ID_ is NULL
523         </if>
524     </select>
525
526 </mapper>