From 13aa60f1c51f016dd126f5579587e2aa2db1d2aa Mon Sep 17 00:00:00 2001
From: "liang.chao" <1360241448@qq.com>
Date: Thu, 4 Sep 2025 20:57:07 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../material/push/ProDataUseInfoMapper.xml | 76 ++++++++++---------
1 file changed, 41 insertions(+), 35 deletions(-)
diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml
index 82982904..d0d2e033 100644
--- a/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml
+++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/push/ProDataUseInfoMapper.xml
@@ -579,41 +579,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_id
) UNION ALL
(
- SELECT
- mt.type_id as typeId,
- mt2.type_name as typeName,
- mt.type_name as typeModelName,
- mt.unit_name as unit,
- mm.assets_code as assetsCode,
- ifnull(mt.lease_price,0) as rentPrice,
- CASE
- mt.manage_type
- WHEN 0 THEN
- IFNULL( COUNT( mm.ma_id ), 0 ) ELSE IFNULL( mt.storage_num, 0 )
- END AS num,
- '在库' AS STATUS
- FROM
- ma_machine mm
- LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
- LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
- LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
- LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
- WHERE
- mm.ma_code IS NOT NULL
- AND mm.ma_status IN ( 1 )
- AND mt.LEVEL = 4
-
- AND mt2.type_name like concat ('%', #{typeName}, '%')
-
-
- AND mt.type_name like concat ('%', #{typeModelName}, '%')
-
-
- and mt2.is_statics = #{isStatics}
-
- GROUP BY
- mt.type_id
- )
+ SELECT
+ mt.type_id as typeId,
+ mt2.type_name as typeName,
+ mt.type_name as typeModelName,
+ mt.unit_name as unit,
+ mm.assets_code as assetsCode,
+ ifnull(mt.lease_price,0) as rentPrice,
+ CASE
+ mt.manage_type
+ WHEN 0 THEN
+ IFNULL( COUNT( mm.ma_id ), 0 )
+ ELSE
+ IFNULL( mt.storage_num, 0 )
+ END AS num,
+ '在库' AS STATUS
+ FROM
+ ma_type mt
+ LEFT JOIN ma_machine mm ON mt.type_id = mm.type_id
+ LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
+ LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
+ LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
+ WHERE
+ mt.LEVEL = 4
+
+ AND mt2.type_name like concat ('%', #{typeName}, '%')
+
+
+ AND mt.type_name like concat ('%', #{typeModelName}, '%')
+
+
+ and mt2.is_statics = #{isStatics}
+
+ AND (
+ mt.manage_type != 0
+ OR (
+ mt.manage_type = 0
+ AND mm.ma_code IS NOT NULL
+ AND mm.ma_status IN (1)
+ ))
+ GROUP BY
+ mt.type_id)