From 8323ae3cd92f01776ae15f085ee44bb6ebbfdddf Mon Sep 17 00:00:00 2001 From: liuyuxin Date: Fri, 6 Mar 2026 15:38:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/wisdom/RkRecordMapper.xml | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/resources/mybatis/wisdom/RkRecordMapper.xml b/src/main/resources/mybatis/wisdom/RkRecordMapper.xml index 3b36f85..b7d90c2 100644 --- a/src/main/resources/mybatis/wisdom/RkRecordMapper.xml +++ b/src/main/resources/mybatis/wisdom/RkRecordMapper.xml @@ -92,44 +92,42 @@ SELECT rr.*, - - /* 总金额 */ - COALESCE(rr.real_qty,0) * COALESCE(rr.ht_dj,0) AS total_amount, - + COALESCE(rr.real_qty, 0) * COALESCE(rr.ht_dj, 0) AS total_amount, su.nick_name AS operator_name, mt.type_name AS wl_type_name, COALESCE(sit.type_name, sot.type_name) AS operation_type_name, - - -- 小仓 wh.warehouse_name AS warehouse_name, - - -- 大仓 wh.parent_warehouse_code AS parent_warehouse_code, wh.parent_warehouse_name AS parent_warehouse_name, - ct.team_name AS team_name, - - -- 新增 gys_jh 主键 - gj.id AS gys_jh_id - + gj.gys_jh_id AS gys_jh_id FROM rk_record rr - LEFT JOIN sys_user su ON rr.operator = su.user_id - LEFT JOIN material_type mt ON rr.wl_type = mt.type_code - LEFT JOIN stock_in_type sit ON rr.operation_type = sit.type_code - LEFT JOIN stock_out_type sot ON rr.operation_type = sot.type_code - - LEFT JOIN warehouse_info wh ON rr.cangku = wh.warehouse_code - + LEFT JOIN sys_user su + ON rr.operator = su.user_id + LEFT JOIN material_type mt + ON rr.wl_type = mt.type_code + LEFT JOIN stock_in_type sit + ON rr.operation_type = sit.type_code + LEFT JOIN stock_out_type sot + ON rr.operation_type = sot.type_code + LEFT JOIN warehouse_info wh + ON rr.cangku = wh.warehouse_code LEFT JOIN construction_team ct ON rr.team_code = ct.team_code AND ct.is_delete = '0' - /* 新增关联 */ - LEFT JOIN gys_jh gj + 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 - AND gj.is_delete = '0' - @@ -296,7 +294,7 @@ ORDER BY rr.exec_status = '0' DESC, rr.create_time ASC, - gj.id ASC + gj.gys_jh_id ASC