diff --git a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml index 3905f4a1..f53f1c88 100644 --- a/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml +++ b/bonus-modules/bonus-material/src/main/resources/mapper/material/ma/TypeMapper.xml @@ -458,15 +458,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select DISTINCT m.type_id, m.type_name, m.parent_id, m.unit_id, m.unit_name, m.manage_type, m.lease_price,m.eff_time, m.rent_price, m.buy_price, m.pay_price, m.level, m.rated_load, m.test_load, m.holding_time, m.warn_num, - -- mtk.user_id keeperUserId, - -- su.nick_name keeperUserName, mpi.prop_name, m.del_flag, m.create_by, m.create_time, - m.remark,m.type_id id , m.type_name label + m.remark,m.type_id id , m.type_name label, + CASE m.manage_type + WHEN 0 THEN + IFNULL(subquery0.num, 0) + ELSE + IFNULL(m.storage_num, 0) + END as storage_num from ma_type m left join ma_prop_set mps on m.type_id = mps.type_id and mps.`status`='0' and mps.del_flag='0' left join ma_prop_info mpi on mps.prop_id = mpi.prop_id and mpi.`status`='0' and mpi.del_flag='0' - -- left join ma_type_keeper mtk on m.type_id = mtk.type_id - -- left join sys_user su on mtk.user_id = su.user_id + left join (SELECT mt.type_id, + mt2.type_name AS typeName, + mt.type_name AS typeModelName, + count(mm.ma_id) num + 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 + WHERE mm.ma_code is not null and mm.ma_status in (15) + GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = m.type_id m.del_flag = '0'