From 309022aae248990d09bf56349a6914d2365c50c0 Mon Sep 17 00:00:00 2001 From: liuyuxin Date: Mon, 13 Apr 2026 15:00:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E5=8D=95?= =?UTF-8?q?=E6=8D=AE=E5=85=B6=E4=BB=96=E4=B8=A4=E4=B8=AA=E8=A1=A8=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mybatis/wisdom/GysJhMapper.xml | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/main/resources/mybatis/wisdom/GysJhMapper.xml b/src/main/resources/mybatis/wisdom/GysJhMapper.xml index 5cbf4ee..76f4d48 100644 --- a/src/main/resources/mybatis/wisdom/GysJhMapper.xml +++ b/src/main/resources/mybatis/wisdom/GysJhMapper.xml @@ -319,16 +319,27 @@ UPDATE gys_jh gj - JOIN rk_info ri - ON gj.sap_no = ri.sap_no - AND gj.wl_no = ri.wl_no - AND gj.xm_no = ri.xm_no - SET - gj.real_qty = ri.real_qty + LEFT JOIN ( + SELECT + sap_no, + wl_no, + xm_no, + IFNULL(SUM(real_qty), 0) AS total_real_qty + FROM rk_info + WHERE (is_delete = '0' OR is_delete IS NULL) + AND exec_status = '1' + AND sap_no = #{sapNo} + AND wl_no = #{wlNo} + AND xm_no = #{xmNo} + GROUP BY sap_no, wl_no, xm_no + ) t + ON gj.sap_no = t.sap_no + AND gj.wl_no = t.wl_no + AND gj.xm_no = t.xm_no + SET gj.real_qty = IFNULL(t.total_real_qty, 0) WHERE (gj.is_delete = '0' OR gj.is_delete IS NULL) - AND (ri.is_delete = '0' OR ri.is_delete IS NULL) - AND ri.sap_no = #{sapNo} - AND ri.wl_no = #{wlNo} - AND ri.xm_no = #{xmNo} + AND gj.sap_no = #{sapNo} + AND gj.wl_no = #{wlNo} + AND gj.xm_no = #{xmNo}