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