From 8ceaeb03ef375d7f3e65b8b9889f989baaa23ad2 Mon Sep 17 00:00:00 2001 From: wenshijun Date: Fri, 6 Mar 2026 16:11:26 +0800 Subject: [PATCH] =?UTF-8?q?sql=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/wisdom/RkRecordMapper.xml | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/resources/mybatis/wisdom/RkRecordMapper.xml b/src/main/resources/mybatis/wisdom/RkRecordMapper.xml index b7d90c2..c7bb847 100644 --- a/src/main/resources/mybatis/wisdom/RkRecordMapper.xml +++ b/src/main/resources/mybatis/wisdom/RkRecordMapper.xml @@ -100,7 +100,16 @@ wh.parent_warehouse_code AS parent_warehouse_code, wh.parent_warehouse_name AS parent_warehouse_name, ct.team_name AS team_name, - gj.gys_jh_id AS gys_jh_id + + ( + SELECT MIN(gj.id) + FROM gys_jh gj + WHERE gj.sap_no = rr.sap_no + AND gj.wl_no = rr.wl_no + AND gj.xm_no = rr.xm_no + AND gj.is_delete = '0' + ) AS gys_jh_id + FROM rk_record rr LEFT JOIN sys_user su ON rr.operator = su.user_id @@ -115,19 +124,6 @@ LEFT JOIN construction_team ct ON rr.team_code = ct.team_code AND ct.is_delete = '0' - LEFT JOIN ( - SELECT - sap_no, - wl_no, - xm_no, - MIN(id) AS gys_jh_id - FROM gys_jh - WHERE is_delete = '0' - GROUP BY sap_no, wl_no, xm_no - ) gj - ON rr.sap_no = gj.sap_no - AND rr.wl_no = gj.wl_no - AND rr.xm_no = gj.xm_no