Compare commits

...

3 Commits

Author SHA1 Message Date
黎润豪 8bdef9a86d Merge remote-tracking branch 'origin/XQ-20260414-002' 2026-04-15 14:38:48 +08:00
黎润豪 6b6450c6fc 我的一般重复修复 2026-04-15 14:38:02 +08:00
黎润豪 c3cc3898b4 XQ-20260414-002: 修复已办列表问题
1. 修复已办列表显示全自治区记录的问题
   - Controller层始终设置机构过滤参数
   - 默认childUnitSwitch为0(不查看下级)
   - 增加isAutonomousRegion参数判断自治区账号

2. 修复已办列表重复显示同一业务多条记录的问题
   - 使用ROW_NUMBER()窗口函数按BIZSEQID去重
   - 每笔业务只显示最新环节的一条记录

涉及文件:
- TaskController.java: finishTaskUnionPage方法
- TSTaskListMapper.xml: selectFinishUnionTaskPage查询
2026-04-15 11:43:11 +08:00
5 changed files with 400 additions and 84 deletions

View File

@ -0,0 +1,27 @@
# XQ-20260414-002 失败报告
## 状态
- **开发状态**: 已完成
- **编译状态**: 未验证环境无mvn
- **推送状态**: 待推送
## 尝试修复的问题
### 问题1: 已办列表显示全自治区记录
- **根本原因**: 当 `childUnitSwitch` 参数不存在时SQL子查询没有任何过滤条件返回所有记录
- **修复方案**:
1. Controller层始终设置机构过滤参数
2. 默认 `childUnitSwitch = "0"`(不查看下级)
3. 增加 `isAutonomousRegion` 参数判断是否为自治区账号
4. Mapper XML中根据这些参数正确过滤
### 问题2: 已办列表重复显示同一业务的多条记录
- **根本原因**: 每笔业务在TShwfProcessNode表中有多条记录每个环节一条DISTINCT无法合并
- **修复方案**: 使用窗口函数 `ROW_NUMBER() OVER (PARTITION BY BIZSEQID ORDER BY LAUPTIME DESC)` 去重,只取每笔业务最新的一条记录
## 未解决问题
暂无
## 备注
- 本次修改涉及TaskController.java和TSTaskListMapper.xml两个文件
- 由于环境限制未能执行Maven编译验证建议在IDE中验证后推送

View File

@ -0,0 +1,209 @@
# XQ-20260414-002 开发思路与改动
## 问题分析
### 问题1根因分析
查看 `TSTaskListMapper.xml``selectFinishUnionTaskPage` 查询:
```sql
SELECT DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ...
FROM TSTaskList ta
LEFT JOIN TShwfProcessNode n ON ta.WorkflowID = n.processid
WHERE ta.BUSSTATUS = 2
AND ta.WORKFLOWID IN (
SELECT DISTINCT WORKFLOWID FROM tsopinion tso
<where>
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
-- 有 childUnitSwitch 时的过滤逻辑
</if>
-- 注意:如果 childUnitSwitch 为空或不存在,整个 WHERE 块不生效
-- 导致子查询返回 tsopinion 表中所有 WORKFLOWID
</where>
)
```
**根本原因**:当 `childUnitSwitch` 参数不存在时,子查询没有任何过滤条件,返回 tsopinion 表中所有 WORKFLOWID导致已办列表显示全自治区的记录。
### 问题2根因分析
查询结果中每条 TASKLIST 记录会对应 TShwfProcessNode 表中的多个节点记录(每个环节一个),而 DISTINCT 无法将同一业务的多条记录合并成一条。
---
## 解决方案
### 修复1: 已办列表按机构范围过滤
**修改文件**: `TaskController.java` (第280行附近 `finishTaskUnionPage` 方法)
**当前逻辑**
```java
if (customParamMap != null && customParamMap.containsKey("childUnitSwitch")) {
// 只有当 childUnitSwitch 存在时才设置机构过滤参数
}
```
**修改后逻辑**
```java
// 获取当前用户机构信息
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
if (StringUtils.isNotBlank(myOrgNumber)) {
customParamMap.put("myOrgNumber", myOrgNumber);
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
// 判断是否为自治区账号机构等级为1
Map<String, String> orgParams = new HashMap<>();
orgParams.put("deleted", "0");
orgParams.put("unittype", "1");
orgParams.put("orgNumber", myOrgNumber);
OrgUnits org = aicorgService.queryByOrgNumberMap(orgParams);
boolean isAutonomousRegion = org != null && org.getOrgLevel() != null && org.getOrgLevel() == 1;
// 设置是否查看下级单位标志
// childUnitSwitch = "1" 表示查看下级
// childUnitSwitch 不传或为 "0" 表示不查看下级
// 但自治区账号即使不查看下级,也应该能看到本级数据
if (customParamMap.containsKey("childUnitSwitch")) {
// 前端明确传了 childUnitSwitch使用前端值
} else {
// 前端没传默认不查看下级childUnitSwitch = "0"
customParamMap.put("childUnitSwitch", "0");
}
}
```
**同步修改 Mapper XML**: 确保当 `childUnitSwitch = "0"` 时,也要有机构过滤逻辑(不仅仅是 "1" 时)。
### 修复2: 每笔业务只显示一条记录
**方案**: 在外层查询使用 GROUP BY BIZSEQID选择每个业务最新的一条记录。
**修改文件**: `TSTaskListMapper.xml``selectFinishUnionTaskPage`
**当前**:
```sql
SELECT * FROM (
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ...
from TSTaskList ta
LEFT JOIN TShwfProcessNode n on ta.WorkflowID = n.processid
where ...)
) m
ORDER BY m.LAUPTIME DESC
```
**修改后**:
```sql
SELECT m.* FROM (
SELECT * FROM (
(select ... from TSTaskList ... UNION all select ... from tsrevtasklist ...)
) sub
GROUP BY sub.BIZSEQID
HAVING sub.LAUPTIME = MAX(sub.LAUPTIME) -- 取每笔业务最新的一条
) m
ORDER BY m.LAUPTIME DESC
```
或者使用窗口函数:
```sql
SELECT * FROM (
SELECT t.*,
ROW_NUMBER() OVER (PARTITION BY t.BIZSEQID ORDER BY t.LAUPTIME DESC) as rn
FROM (
(select ... from TSTaskList ta ... UNION all select ... from tsrevtasklist ...)
) t
) tt
WHERE tt.rn = 1
ORDER BY tt.LAUPTIME DESC
```
---
## 具体代码改动
### 1. TaskController.java 修改约第290行
`finishTaskUnionPage` 方法中,修改机构过滤逻辑:
```java
// 原有代码(只处理 childUnitSwitch 存在时):
// if (customParamMap != null && customParamMap.containsKey("childUnitSwitch")) {
// 修改为:无条件设置机构参数
if (customParamMap != null) {
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
if (StringUtils.isNotBlank(myOrgNumber)) {
customParamMap.put("myOrgNumber", myOrgNumber);
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
}
// 确保 childUnitSwitch 有值(前端没传时默认为"0"
if (!customParamMap.containsKey("childUnitSwitch")) {
customParamMap.put("childUnitSwitch", "0");
}
}
```
### 2. TSTaskListMapper.xml 修改约第580-790行
**2.1 修改子查询逻辑**
`childUnitSwitch = "0"`(不查看下级)时,也需要按机构过滤:
```xml
<when test='customParamMap.childUnitSwitch eq "0"'>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu
left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID
and torg.ORGNUMBER = #{customParamMap.myOrgNumber})
)
</when>
```
**2.2 添加自治区账号特殊处理**
当机构等级为1自治区不过滤
```xml
<when test='customParamMap.childUnitSwitch eq "0"'>
<choose>
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
<!-- 自治区账号,不过滤,返回所有 -->
</when>
<otherwise>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu
left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID
and torg.ORGNUMBER = #{customParamMap.myOrgNumber})
)
</otherwise>
</choose>
</when>
```
**2.3 去重逻辑**
在外层包装查询结果,按 BIZSEQID 分组取最新:
```xml
SELECT * FROM (
SELECT m.*,
ROW_NUMBER() OVER (PARTITION BY m.BIZSEQID ORDER BY m.LAUPTIME DESC) as rn
FROM (
<!-- 现有的 UNION ALL 查询 -->
) m
) mm
WHERE mm.rn = 1
ORDER BY mm.LAUPTIME DESC
```
---
## 注意事项
1. **自治区账号识别**:需要在 Controller 层判断并传递 `isAutonomousRegion` 参数
2. **兼容性**:确保修改后与现有功能兼容,不要破坏其他业务线的已办查询
3. **性能**:去重查询可能影响性能,如果 BIZSEQID 已建立索引应无大碍
4. **第3点难点**:如果去重逻辑 SQL 难以修改(涉及多表 UNION可以在 Service 层用 Java 代码处理,但会增加内存压力

View File

@ -0,0 +1,28 @@
# XQ-20260414-002 需求清单
## 任务信息
- **待办编号**: XQ-20260414-002
- **标题**: 内蒙信用监管-修复我的已办问题
- **到期日**: 2026-04-17
- **执行人**: LiRunHao
## 需求描述
### 问题1: 已办列表范围问题
**现状**: 已办列表显示全自治区的已办记录
**期望**: 改为按照"是否查看下级单位已办记录"的规则查询
- 否:只显示当前单位的已办记录
- 是:显示下级单位的已办记录,自治区账号显示全部已办记录
**具体案例**: 用户 hl_zhangwg (大杨树镇市场监督管理所) 提交了个体工商户移出异常名录业务 YW202603260005提交成功后从已办业务中搜索不到办理的业务全是其他单位的业务。
### 问题2: 已办记录重复问题
**现状**: 当前已办功能将每一笔业务的所有环节(如审批中、审批通过)的记录都显示出来了
**期望**: 每一笔业务只显示一条记录,显示当前业务的最新环节
**说明**: 第3点若查询语句难以修改可以提出修改的难点后续优化
## 涉及范围
- 后端接口:`/task/finishTaskUnionPage`
- Mapper: `TSTaskListMapper.selectFinishUnionTaskPage`
- Service: `TSTaskListServiceImpl.searchFinishTaskUnionPage`

View File

@ -491,11 +491,25 @@ public class TaskController extends BaseController {
}
}
if (customParamMap != null && customParamMap.containsKey("childUnitSwitch")) {
if (customParamMap != null) {
String myOrgNumber = StringUtils.clearRegionZero(curUser.getRegionID());
if (StringUtils.isNotBlank(myOrgNumber)) {
customParamMap.put("myOrgNumber", myOrgNumber);
customParamMap.put("myOrgNumberLike", myOrgNumber + "%");
// 判断是否为自治区账号机构等级为1
Map<String, String> orgParams = new HashMap<>();
orgParams.put("deleted", "0");
orgParams.put("unittype", "1");
orgParams.put("orgNumber", myOrgNumber);
OrgUnits org = aicorgService.queryByOrgNumberMap(orgParams);
boolean isAutonomousRegion = org != null && org.getOrgLevel() != null && org.getOrgLevel() == 1;
customParamMap.put("isAutonomousRegion", isAutonomousRegion);
}
// childUnitSwitch 默认值为 "0"(不查看下级)
if (!customParamMap.containsKey("childUnitSwitch")) {
customParamMap.put("childUnitSwitch", "0");
}
}

View File

@ -578,118 +578,156 @@
ORDER BY n.OPINIONTYPE DESC LIMIT 1
</select>
<select id="selectFinishUnionTaskPage" resultMap="TaskListUnionMap">
SELECT *
from(
<choose>
<when test="customParamMap.finished != null and customParamMap.finished != '' ">
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME,ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME , n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
from TSTaskList ta
LEFT JOIN TShwfProcessNode n on ta.WorkflowID = n.processid
where ta.BUSSTATUS = 2 AND ta.WORKFLOWID IN (
SELECT
DISTINCT WORKFLOWID
FROM
tsopinion tso
<where>
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
SELECT * FROM (
SELECT m.*, ROW_NUMBER() OVER (PARTITION BY m.BIZSEQID ORDER BY m.LAUPTIME DESC) as rn FROM (
<choose>
<when test="customParamMap.finished != null and customParamMap.finished != '' ">
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME,ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME , n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
from TSTaskList ta
LEFT JOIN TShwfProcessNode n on ta.WorkflowID = n.processid
where ta.BUSSTATUS = 2 AND ta.WORKFLOWID IN (
SELECT
DISTINCT WORKFLOWID
FROM
tsopinion tso
<where>
<choose>
<when test='customParamMap.childUnitSwitch eq "1"'>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
))
</when>
<otherwise>
and tso.HANDLERID = #{customParamMap.userId}
</otherwise>
<when test='customParamMap.childUnitSwitch eq "0"'>
<choose>
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
<!-- 自治区账号,不过滤 -->
</when>
<otherwise>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
)
)
</otherwise>
</choose>
</when>
</choose>
</if>
</where>) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
union all
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , n.currentNode as currentNodeOrBizStatus ,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, t.CREATETIME
from tsrevtasklist t
LEFT JOIN TShwfProcessNode n on t.WorkflowID = n.processid
where t.BUSSTATUS = 2 AND t.WORKFLOWID IN (
SELECT
DISTINCT WORKFLOWID
FROM
tsopinion tso
<where>
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
</where>) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
union all
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , n.currentNode as currentNodeOrBizStatus ,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, t.CREATETIME
from tsrevtasklist t
LEFT JOIN TShwfProcessNode n on t.WorkflowID = n.processid
where t.BUSSTATUS = 2 AND t.WORKFLOWID IN (
SELECT
DISTINCT WORKFLOWID
FROM
tsopinion tso
<where>
<choose>
<when test='customParamMap.childUnitSwitch eq "1"'>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
))
</when>
<otherwise>
and tso.HANDLERID = #{customParamMap.userId}
</otherwise>
<when test='customParamMap.childUnitSwitch eq "0"'>
<choose>
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
<!-- 自治区账号,不过滤 -->
</when>
<otherwise>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
)
)
</otherwise>
</choose>
</when>
</choose>
</if>
</where>
) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
union all
</when>
</choose>
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , b.STATUS as currentNodeOrBizStatus, null as lastNode, t.CREATETIME
from tsrevtasklist t, tsbizrevlist b,TShwfProcessNode n
where t.bizseqid = b.bizseq and t.busstatus = '0' and b.ISREMOVE = '0' AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
and t.WorkflowID = n.processid and t.WORKFLOWID in (SELECT DISTINCT WORKFLOWID FROM tsopinion tso
<where>
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
</where>
) and REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1)
union all
</when>
</choose>
(select DISTINCT t.TASKLISTID, t.WORKFLOWID, t.BIZSEQID, t.SIGNUSERID, t.SENDERORGID, t.SENDERUSERID, t.SENDTOORGID, t.ACCEPTNO, t.BUSNAME, t.SIGNTIME, t.BUSTYPE, t.BUSSTATUS, t.LINKNAME, t.AUDITDEPTTYPE, t.ISSIGNON, t.SIGNLOGINNAME, t.SENDERTIME, t.SENDERNAME, t.ACCEPTGROUPID, t.AREA_CODE, t.LAUPTIME , b.STATUS as currentNodeOrBizStatus, null as lastNode, t.CREATETIME
from tsrevtasklist t, tsbizrevlist b,TShwfProcessNode n
where t.bizseqid = b.bizseq and t.busstatus = '0' and b.ISREMOVE = '0' AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
and t.WorkflowID = n.processid and t.WORKFLOWID in (SELECT DISTINCT WORKFLOWID FROM tsopinion tso
<where>
<choose>
<when test='customParamMap.childUnitSwitch eq "1"'>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
))
</when>
<otherwise>
and tso.HANDLERID = #{customParamMap.userId}
</otherwise>
<when test='customParamMap.childUnitSwitch eq "0"'>
<choose>
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
<!-- 自治区账号,不过滤 -->
</when>
<otherwise>
and (
tso.HANDLERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where tso.HANDLERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
)
)
</otherwise>
</choose>
</when>
</choose>
</if>
</where>))
union all
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME, ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME, n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
from TSTaskList ta
LEFT JOIN TSTwfProcessNode n on ta.WorkflowID = n.processid
where ta.BUSSTATUS in ('-1', '0', '1', '3', '5') AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
<if test="customParamMap.childUnitSwitch != null and customParamMap.childUnitSwitch != ''">
</where>))
union all
(select DISTINCT ta.TASKLISTID, ta.WORKFLOWID, ta.BIZSEQID, ta.SIGNUSERID, ta.SENDERORGID, ta.SENDERUSERID, ta.SENDTOORGID, ta.ACCEPTNO, ta.BUSNAME, ta.SIGNTIME, ta.BUSTYPE, ta.BUSSTATUS, ta.LINKNAME, ta.AUDITDEPTTYPE, ta.ISSIGNON,ta.SIGNLOGINNAME, ta.SENDERTIME, ta.SENDERNAME, ta.ACCEPTGROUPID, ta.AREA_CODE, ta.LAUPTIME, n.currentNode as currentNodeOrBizStatus,SUBSTR(n.NODEFLOW, 1, INSTR(n.NODEFLOW, '_') - 1) as lastNode, ta.CREATETIME
from TSTaskList ta
LEFT JOIN TSTwfProcessNode n on ta.WorkflowID = n.processid
where ta.BUSSTATUS in ('-1', '0', '1', '3', '5') AND REGEXP_LIKE(n.currentNode, '^end|over', 'i') = 1
<choose>
<when test='customParamMap.childUnitSwitch eq "1"'>
and (
n.CURRUSERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where n.CURRUSERID = tu.USERID and torg.ORGNUMBER like #{customParamMap.myOrgNumberLike}
<!-- and torg.ORGNUMBER != #{customParamMap.myOrgNumber}-->
))
</when>
<otherwise>
and n.CURRUSERID = #{customParamMap.userId}
</otherwise>
<when test='customParamMap.childUnitSwitch eq "0"'>
<choose>
<when test="customParamMap.isAutonomousRegion != null and customParamMap.isAutonomousRegion == true">
<!-- 自治区账号,不过滤 -->
</when>
<otherwise>
and (
n.CURRUSERID = #{customParamMap.userId}
or exists(select 1 from CXAICORG.T_USERS tu left join CXAICORG.T_ORGUNITS torg on tu.ORGUNITID = torg.ORGUNITID
where n.CURRUSERID = tu.USERID and torg.ORGNUMBER = #{customParamMap.myOrgNumber}
)
)
</otherwise>
</choose>
</when>
</choose>
</if>
)
) m
)
) m
) mm
<where>
mm.rn = 1
<if test="customParamMap != null">
<if test="customParamMap.startDate != null and customParamMap.startDate != '' ">
and date_format(m.CREATETIME,'%Y-%m-%d') &gt;= #{customParamMap.startDate}
AND date_format(mm.CREATETIME,'%Y-%m-%d') &gt;= #{customParamMap.startDate}
</if>
<if test="customParamMap.endDate != null and customParamMap.endDate != '' ">
and date_format(m.CREATETIME,'%Y-%m-%d') &lt;= #{customParamMap.endDate}
AND date_format(mm.CREATETIME,'%Y-%m-%d') &lt;= #{customParamMap.endDate}
</if>
<if test="customParamMap.UNISCID and customParamMap.UNISCID != '' ">
and m.BIZSEQID in (
AND mm.BIZSEQID in (
select BIZSEQ from aiccs.tsbizremlist tsb left join e_baseinfo eb on tsb.PRIPID = eb.PRIPID
where 1=1
and eb.UNISCID = #{customParamMap.UNISCID}
@ -701,7 +739,7 @@
)
</if>
<if test="customParamMap.REGNO and customParamMap.REGNO != '' ">
and m.BIZSEQID in (
AND mm.BIZSEQID in (
select BIZSEQ from aiccs.tsbizremlist tsb left join e_baseinfo eb on tsb.PRIPID = eb.PRIPID
where 1=1
and eb.REGNO = #{customParamMap.REGNO}
@ -713,22 +751,22 @@
)
</if>
<if test="customParamMap.bustype != null and customParamMap.bustype != '' ">
and m.BUSTYPE = #{customParamMap.bustype}
AND mm.BUSTYPE = #{customParamMap.bustype}
</if>
<if test="customParamMap.searchName != null and customParamMap.searchName != '' ">
and m.BUSNAME = #{customParamMap.searchName}
AND mm.BUSNAME = #{customParamMap.searchName}
</if>
<if test="customParamMap.acceptno != null and customParamMap.acceptno != '' ">
and m.ACCEPTNO = #{customParamMap.acceptno}
AND mm.ACCEPTNO = #{customParamMap.acceptno}
</if>
<if test="customParamMap.currentNode != null and customParamMap.currentNode != '' ">
and m.currentNodeOrBizStatus = #{customParamMap.currentNode}
AND mm.currentNodeOrBizStatus = #{customParamMap.currentNode}
</if>
<if test="customParamMap.lastNode != null and customParamMap.lastNode != '' ">
and m.lastNode = #{customParamMap.lastNode}
AND mm.lastNode = #{customParamMap.lastNode}
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '1'.toString() ">
and m.currentNodeOrBizStatus in ('exptlistEnter',
AND mm.currentNodeOrBizStatus in ('exptlistEnter',
'serIllegalEnter',
'revCancelEnter',
'startAccept',
@ -741,7 +779,7 @@
)
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '2'.toString() ">
and m.currentNodeOrBizStatus in ('handleExptlist',
AND mm.currentNodeOrBizStatus in ('handleExptlist',
'handleSerIllegal',
'handleRevCancel',
'handleCancel',
@ -760,7 +798,7 @@
)
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '3'.toString() ">
and m.currentNodeOrBizStatus in ( 'approvelist',
AND mm.currentNodeOrBizStatus in ( 'approvelist',
'approveSerIllegal',
'approveRevCancel',
'approvalCancel',
@ -779,7 +817,7 @@
)
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '4'.toString() ">
and m.currentNodeOrBizStatus in ('endExptlist',
AND mm.currentNodeOrBizStatus in ('endExptlist',
'endDissent',
'endSerIllegal',
'endRevoke',
@ -790,7 +828,7 @@
'14','noRegister','cancelShow','noRegister')
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '5'.toString() ">
and m.currentNodeOrBizStatus in ('overExptlist',
AND mm.currentNodeOrBizStatus in ('overExptlist',
'overDissent',
'overSerIllegal',
'overRevoke',
@ -801,14 +839,14 @@
)
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '6'.toString() ">
and m.currentNodeOrBizStatus = 'clueReturn'
AND mm.currentNodeOrBizStatus = 'clueReturn'
</if>
<if test="customParamMap.busStatus != null and customParamMap.busStatus == '7'.toString() ">
and m.currentNodeOrBizStatus in ('overNullify','noAccept')
AND mm.currentNodeOrBizStatus in ('overNullify','noAccept')
</if>
</if>
</where>
ORDER BY m.LAUPTIME DESC
ORDER BY mm.LAUPTIME DESC
</select>
<select id="searchUnionTaskList" resultMap="TaskListUnionMap">