From 241e579be0f2176f5ccb7b5d3b47651ffd285b7d Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期一, 14 四月 2025 13:16:10 +0800
Subject: [PATCH] 修改flow

---
 lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml |  103 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 92 insertions(+), 11 deletions(-)

diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml
index 221ab77..2eca38b 100644
--- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml
+++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/mapper/xml/FlowMyBusinessMapper.xml
@@ -3,19 +3,100 @@
 <mapper namespace="org.jeecg.modules.flowable.apithird.business.mapper.FlowMyBusinessMapper">
     <select id="PageList" resultType="org.jeecg.modules.flowable.apithird.business.dto.FlowMyBusinessDto">
         SELECT
-            flow_my_business.*,
-            ACT_HI_PROCINST.START_TIME_ as start_time,
-            ACT_HI_PROCINST.END_TIME_ as end_time,
-            NC_ASSIGN_FILE_STREAM.STATUS as status,
-            ACT_RE_PROCDEF.NAME_ as flowName
+        flow_my_business.id,
+        flow_my_business.title as 'description',
+        flow_my_business.proposer,
+        flow_my_business.task_name,
+        flow_my_business.task_id,
+        flow_my_business.data_id AS 'dataId',
+        flow_my_business.process_definition_key,
+        flow_my_business.process_definition_id,
+        flow_my_business.process_instance_id,
+        flow_my_business.todo_users as todoUsers,
+        flow_my_business.done_Users,
+        ACT_HI_PROCINST.START_TIME_ AS start_time,
+        ACT_HI_PROCINST.END_TIME_ AS end_time,
+        ACT_RE_PROCDEF.NAME_ AS flowName,
+        ACT_RE_PROCDEF.CATEGORY_ AS category
         FROM
-            flow_my_business
-                LEFT JOIN ACT_HI_PROCINST ON flow_my_business.process_instance_id = ACT_HI_PROCINST.ID_
-                LEFT JOIN ACT_RE_PROCDEF ON flow_my_business.process_definition_id = ACT_RE_PROCDEF.ID_
-                LEFT JOIN NC_ASSIGN_FILE_STREAM ON flow_my_business.data_id = NC_ASSIGN_FILE_STREAM.STREAM_ID
-        where
-            1 = 1
+        flow_my_business
+        LEFT JOIN ACT_HI_PROCINST ON flow_my_business.process_instance_id = ACT_HI_PROCINST.ID_
+        LEFT JOIN ACT_RE_PROCDEF ON flow_my_business.process_definition_id = ACT_RE_PROCDEF.ID_
+        left join ACT_RU_TASK on flow_my_business.task_id = ACT_RU_TASK.ID_
+        WHERE
+        1 = 1
+        <if test="flowMyBusinessDto.category != null and flowMyBusinessDto.category != ''">
+            and ACT_RE_PROCDEF.CATEGORY_ = #{flowMyBusinessDto.category}
+        </if>
+        <if test="flowMyBusinessDto.flowName!= null and flowMyBusinessDto.flowName!= ''">
+            AND ACT_RE_PROCDEF.name_ LIKE CONCAT('%',#{flowMyBusinessDto.flowName},'%')
+        </if>
+        <if test="flowMyBusinessDto.title != null and flowMyBusinessDto.title != ''">
+            AND flow_my_business.title LIKE CONCAT('%',#{flowMyBusinessDto.title},'%')
+        </if>
+        <if test="flowMyBusinessDto.startTime!= null and flowMyBusinessDto.startTime!= ''">
+            AND ACT_HI_PROCINST.START_TIME_ &gt;= #{flowMyBusinessDto.startTime}
+        </if>
+        <if test="flowMyBusinessDto.endTime!= null and flowMyBusinessDto.endTime!= ''">
+            AND ACT_HI_PROCINST.END_TIME_ &lt;= #{flowMyBusinessDto.endTime}
+        </if>
         ORDER BY
             flow_my_business.create_time desc
     </select>
+
+    <select id="ListMyBusiness" resultType="org.jeecg.modules.flowable.domain.dto.FlowTaskDto">
+        SELECT
+        fmb.task_id AS 'taskId',
+        fmb.process_instance_id AS 'procInsId',
+        ACT_RE_PROCDEF.CATEGORY_ AS 'category',
+        ACT_RE_PROCDEF.NAME_ AS 'procDefName',
+        fmb.title AS 'Description',
+        fmb.data_id AS 'dataId',
+        fmb.process_definition_key AS 'processDefinitionKey',
+        fmb.process_definition_id AS 'processDefinitionId',
+        fmb.proposer,
+        fmb.todo_users,
+        fmb.task_name,
+        latest_task.NAME_ AS taskName,
+        fmb.create_time AS createTime,
+        latest_task.END_TIME_ AS finishTime
+        FROM
+        flow_my_business fmb
+        LEFT JOIN ACT_RE_PROCDEF ON fmb.process_definition_id = ACT_RE_PROCDEF.ID_
+        LEFT JOIN ACT_HI_PROCINST ON fmb.process_instance_id = ACT_HI_PROCINST.ID_
+        LEFT JOIN (
+        SELECT
+        *,
+        ROW_NUMBER() OVER (
+        PARTITION BY PROC_INST_ID_
+        ORDER BY END_TIME_ DESC
+        ) AS rn
+        FROM ACT_HI_TASKINST
+        WHERE ASSIGNEE_ = #{dto.currentUser}  <!-- 缁熶竴鍒悕 -->
+        <if test="dto.startTime != null">
+            AND START_TIME_ &gt;= #{dto.startTime}
+        </if>
+        <if test="dto.endTime != null">
+            AND END_TIME_ &lt;= #{dto.endTime}
+        </if>
+        ) latest_task
+        ON fmb.process_instance_id = latest_task.PROC_INST_ID_
+        AND latest_task.rn = 1
+        WHERE
+        <!-- 鍔ㄦ�佹潯浠剁粺涓�浣跨敤 dto -->
+        <if test="dto.currentUser != null and dto.currentUser != ''">
+            fmb.done_users like concat('%',#{dto.currentUser},'%')
+        </if>
+        <if test="dto.category != null and dto.category != ''">
+            AND ACT_RE_PROCDEF.CATEGORY_ = #{dto.category}
+        </if>
+        <if test="dto.flowName != null and dto.flowName != ''">
+            AND ACT_RE_PROCDEF.NAME_ LIKE CONCAT('%', #{dto.flowName}, '%')
+        </if>
+        <if test="dto.title != null and dto.title != ''">
+            AND fmb.title LIKE CONCAT('%', #{dto.title}, '%')
+        </if>
+        ORDER BY
+        latest_task.END_TIME_ DESC
+    </select>
 </mapper>

--
Gitblit v1.9.3