From b5b01d4f7976bea686e435bf6d9b5eea80d55f38 Mon Sep 17 00:00:00 2001
From: kangwenjing <1138819403@qq.com>
Date: Tue, 15 Sep 2026 10:57:28 +0800
Subject: [PATCH] =?UTF-8?q?refactor(mapper):=20=E6=9B=BF=E6=8D=A2MyBatis?=
=?UTF-8?q?=20XML=E4=B8=AD=E7=9A=84case=E8=A1=A8=E8=BE=BE=E5=BC=8F?=
=?UTF-8?q?=E4=B8=BAchoose=E6=A0=87=E7=AD=BE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
将多个SQL查询里的case when分组逻辑替换为更易读的mybatis choose标签,同时修正用户手机号字段名匹配错误
---
.../resources/mapper/llm/LlmMcpMapper.xml | 71 +++++++++++--------
1 file changed, 42 insertions(+), 29 deletions(-)
diff --git a/backend/src/main/resources/mapper/llm/LlmMcpMapper.xml b/backend/src/main/resources/mapper/llm/LlmMcpMapper.xml
index ef96f587..8893e29f 100644
--- a/backend/src/main/resources/mapper/llm/LlmMcpMapper.xml
+++ b/backend/src/main/resources/mapper/llm/LlmMcpMapper.xml
@@ -911,10 +911,10 @@
cross join users_scope u
)
select
- case
- when #{groupBy} = 'owner' then e.user_name
- else to_char(e.report_date, 'YYYY-MM-DD')
- end as "groupName",
+
+ e.user_name
+ to_char(e.report_date, 'YYYY-MM-DD')
+ as "groupName",
count(1)::bigint as "expectedCount",
count(r.id)::bigint as "submittedCount",
(count(1) - count(r.id))::bigint as "missingCount",
@@ -924,7 +924,11 @@
on r.user_id = e.user_id
and r.report_date = e.report_date
and coalesce(r.status, 'submitted') in ('submitted', 'read', 'reviewed')
- group by case when #{groupBy} = 'owner' then e.user_name else to_char(e.report_date, 'YYYY-MM-DD') end
+ group by
+
+ e.user_name
+ to_char(e.report_date, 'YYYY-MM-DD')
+
order by "groupName" asc
limit #{limit}
offset #{offset}
@@ -932,11 +936,11 @@