懒羊羊
2023-11-14 8286c62256f23bc2367a6729c0f46f84215e380b
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
262
263
<?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.TaskWaitingMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="cn.stylefeng.guns.workflow.modular.entity.Task">
        <id column="ID_" property="id" />
        <result column="REV_" property="rev" />
        <result column="EXECUTION_ID_" property="executionId" />
        <result column="PROC_INST_ID_" property="procInstId" />
        <result column="PROC_DEF_ID_" property="procDefId" />
        <result column="NAME_" property="name" />
        <result column="PARENT_TASK_ID_" property="parentTaskId" />
        <result column="DESCRIPTION_" property="description" />
        <result column="TASK_DEF_KEY_" property="taskDefKey" />
        <result column="OWNER_" property="owner" />
        <result column="ASSIGNEE_" property="assignee" />
        <result column="DELEGATION_" property="delegation" />
        <result column="PRIORITY_" property="priority" />
        <result column="CREATE_TIME_" property="createTime" />
        <result column="DUE_DATE_" property="dueDate" />
        <result column="CATEGORY_" property="category" />
        <result column="SUSPENSION_STATE_" property="suspensionState" />
        <result column="TENANT_ID_" property="tenantId" />
        <result column="FORM_KEY_" property="formKey" />
        <result column="CLAIM_TIME_" property="claimTime" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ID_ AS "id", REV_ AS "rev", EXECUTION_ID_ AS "executionId", PROC_INST_ID_ AS "procInstId", PROC_DEF_ID_ AS "procDefId", NAME_ AS "name", PARENT_TASK_ID_ AS "parentTaskId", DESCRIPTION_ AS "description", TASK_DEF_KEY_ AS "taskDefKey", OWNER_ AS "owner", ASSIGNEE_ AS "assignee", DELEGATION_ AS "delegation", PRIORITY_ AS "priority", CREATE_TIME_ AS "createTime", DUE_DATE_ AS "dueDate", CATEGORY_ AS "category", SUSPENSION_STATE_ AS "suspensionState", TENANT_ID_ AS "tenantId", FORM_KEY_ AS "formKey", CLAIM_TIME_ AS "claimTime"
    </sql>
 
 
    <select id="customList" resultType="cn.stylefeng.guns.workflow.modular.model.result.TaskResult" parameterType="cn.stylefeng.guns.workflow.modular.model.params.TaskParam">
        select
        <include refid="Base_Column_List"/>
        from act_ru_task where 1 = 1
            <if test="paramCondition.createTime != null and paramCondition.createTime != ''">
                and CREATE_TIME_ like CONCAT('%',#{paramCondition.createTime},'%')
            </if>
    </select>
 
    <select id="customMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.TaskParam">
        select
        <include refid="Base_Column_List"/>
        from act_ru_task where 1 = 1
            <if test="paramCondition.createTime != null and paramCondition.createTime != ''">
                and CREATE_TIME_ like CONCAT('%',#{paramCondition.createTime},'%')
            </if>
    </select>
 
    <select id="customPageList" resultType="cn.stylefeng.guns.workflow.modular.model.result.TaskResult" parameterType="cn.stylefeng.guns.workflow.modular.model.params.TaskParam">
        select
        <include refid="Base_Column_List"/>
        from act_ru_task where 1 = 1
            <if test="paramCondition.createTime != null and paramCondition.createTime != ''">
                and CREATE_TIME_ like CONCAT('%',#{paramCondition.createTime},'%')
            </if>
    </select>
 
    <select id="customPageMapList" resultType="map" parameterType="cn.stylefeng.guns.workflow.modular.model.params.TaskParam">
        select
        <include refid="Base_Column_List"/>
        from act_ru_task where 1 = 1
            <if test="paramCondition.createTime != null and paramCondition.createTime != ''">
                and CREATE_TIME_ like CONCAT('%',#{paramCondition.createTime},'%')
            </if>
    </select>
 
    <!--ACT_RU_TASK-->
    <sql id="f">
      f.ID_ AS "id_",
      f.REV_ AS "rev_",
      f.EXECUTION_ID_ AS "execution_id_",
      f.PROC_INST_ID_ AS "proc_inst_id_",
      f.PROC_DEF_ID_ AS "proc_def_id_",
      f.NAME_ AS "name_",
      f.PARENT_TASK_ID_ AS "parent_task_id_",
      f.DESCRIPTION_ AS "description_",
      f.TASK_DEF_KEY_ AS "task_def_key_",
      f.OWNER_ AS "owner_",
      f.ASSIGNEE_ AS "assignee_",
      f.DELEGATION_ AS "delegation_",
      f.PRIORITY_ AS "priority_",
      f.CREATE_TIME_ AS "create_time_",
      f.DUE_DATE_ AS "due_date_",
      f.CATEGORY_ AS "category_",
      f.SUSPENSION_STATE_ AS "suspension_state_",
      f.TENANT_ID_ AS "tenant_id_",
      f.FORM_KEY_ AS "form_key_",
      f.CLAIM_TIME_ AS "claim_time_"
    </sql>
    <!-- 待办任务 or正在运行任务列表-->
    <select id="datalistPage" resultType="map">
        select
        <include refid="f"/> ,
        p.NAME_ pname_,
        p.DGRM_RESOURCE_NAME_ dgrm_resource_name_
        from
        ACT_RU_TASK f
        left join
        ACT_RE_PROCDEF p
        on f.PROC_DEF_ID_ = p.ID_
        where 1=1
        <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
            and
            (
            p.NAME_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
            or
            f.NAME_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
            or
            f.ASSIGNEE_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
            )
        </if>
        <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
            and f.CREATE_TIME_ &gt;= CONCAT(#{pd.lastStart},' 00:00:00')
        </if>
        <if test="pd.lastEnd != null and pd.lastEnd != ''"><!-- 结束时间检索 -->
            and f.CREATE_TIME_ &lt;= CONCAT(#{pd.lastEnd},' 23:59:59')
        </if>
        <if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 当前办理人检索 -->
            and
            (
            f.ASSIGNEE_ = #{pd.USERNAME}
            or
            f.ASSIGNEE_ in ${pd.RNUMBERS}
            )
        </if>
        order by f.CREATE_TIME_ desc
    </select>
 
    <select id="datalistPage" resultType="map" databaseId="mssql">
        select
        <include refid="f"/> ,
        p.NAME_ pname_,
        p.DGRM_RESOURCE_NAME_ dgrm_resource_name_
        from
        ACT_RU_TASK f
        left join
        ACT_RE_PROCDEF p
        on f.PROC_DEF_ID_ = p.ID_
        where 1=1
        <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
            and
            (
            p.NAME_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
            or
            f.NAME_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
            or
            f.ASSIGNEE_ LIKE CONCAT(CONCAT('%', #{pd.keywords}),'%')
            )
        </if>
        <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
            and f.CREATE_TIME_ &gt;= CONCAT(#{pd.lastStart},' 00:00:00')
        </if>
        <if test="pd.lastEnd != null and pd.lastEnd != ''"><!-- 结束时间检索 -->
            and f.CREATE_TIME_ &lt;= CONCAT(#{pd.lastEnd},' 23:59:59')
        </if>
        <if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 当前办理人检索 -->
            and
            (
            f.ASSIGNEE_ = #{pd.USERNAME}
            or
            f.ASSIGNEE_ in ${pd.RNUMBERS}
            )
        </if>
        order by f.CREATE_TIME_ desc
    </select>
 
    <select id="datalistPage" resultType="map" databaseId="pgsql">
        select
        <include refid="f"/> ,
        p.NAME_ pname_,
        p.DGRM_RESOURCE_NAME_ dgrm_resource_name_
        from
        ACT_RU_TASK f
        left join
        ACT_RE_PROCDEF p
        on f.PROC_DEF_ID_ = p.ID_
        where 1=1
        <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
            and
            (
            p.NAME_ LIKE '%' || #{pd.keywords} || '%'
            or
            f.NAME_ LIKE '%' || #{pd.keywords} || '%'
            or
            f.ASSIGNEE_ LIKE '%' || #{pd.keywords} || '%'
            )
        </if>
        <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
            and f.CREATE_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 f.CREATE_TIME_ &lt;= to_timestamp(#{pd.lastEnd}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
        </if>
        <if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 当前办理人检索 -->
            and
            (
            f.ASSIGNEE_ = #{pd.USERNAME}
            or
            f.ASSIGNEE_ in ${pd.RNUMBERS}
            )
        </if>
        order by f.CREATE_TIME_ desc
    </select>
 
    <select id="datalistPage" resultType="map" databaseId="oracle">
        select
        <include refid="f"/> ,
        p.NAME_ "pname_",
        p.DGRM_RESOURCE_NAME_ "dgrm_resource_name_"
        from
        ACT_RU_TASK f
        left join
        ACT_RE_PROCDEF p
        on f.PROC_DEF_ID_ = p.ID_
        where 1=1
        <if test="pd.keywords!= null and pd.keywords != ''"><!-- 关键词检索 -->
            and
            (
            p.NAME_ LIKE '%' || #{pd.keywords} || '%'
            or
            f.NAME_ LIKE '%' || #{pd.keywords} || '%'
            or
            f.ASSIGNEE_ LIKE '%' || #{pd.keywords} || '%'
            )
        </if>
        <if test="pd.lastStart != null and pd.lastStart != ''"><!-- 开始时间检索 -->
            and f.CREATE_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 f.CREATE_TIME_ &lt;= to_date(#{pd.lastEnd}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
        </if>
        <if test="pd.USERNAME != null and pd.USERNAME != ''"><!-- 当前办理人检索 -->
            and
            (
            f.ASSIGNEE_ = #{pd.USERNAME}
            or
            f.ASSIGNEE_ in ${pd.RNUMBERS}
            )
        </if>
        order by f.CREATE_TIME_ desc
    </select>
 
    <select id="getUserRoleString" resultType="string">
        select u.role_id as id from sys_user u WHERE u.account = #{account};
    </select>
 
    <select id="getUserRoleString" resultType="string" databaseId="mssql">
        select u.role_id as id from sys_user u WHERE u.account = #{account}
    </select>
 
    <select id="getUserRoleString" resultType="string" databaseId="pgsql">
        select u.role_id as "id" from sys_user u WHERE u.account = #{account}
    </select>
 
    <select id="getUserRoleString" resultType="string" databaseId="oracle">
        select u.role_id as "id" from sys_user u WHERE u.account = #{account}
    </select>
 
</mapper>