综合查询 工程机具历史归还设备详情功能开发
This commit is contained in:
parent
118600bf0e
commit
ecbb572cf0
|
|
@ -217,40 +217,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
FROM
|
||||
(
|
||||
SELECT
|
||||
lod.ma_id AS maId,
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
lod.ma_id as maId,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( lod.out_num, 0 )) AS outNum
|
||||
SUM(IFNULL(lod.out_num, 0)) AS outNum
|
||||
FROM
|
||||
lease_out_details lod
|
||||
LEFT JOIN ma_type mt ON mt.type_id = lod.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
lod.ma_id, mt.type_id
|
||||
) AS subquery1
|
||||
LEFT JOIN (
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
bcd.ma_id AS maId,
|
||||
mt.type_id,
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
SUM(
|
||||
IFNULL( bcd.back_num, 0 )) backNum
|
||||
SUM(IFNULL(bcd.back_num, 0)) AS backNum
|
||||
FROM
|
||||
back_check_details bcd
|
||||
LEFT JOIN ma_type mt ON mt.type_id = bcd.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = bcd.ma_id
|
||||
WHERE
|
||||
mt.type_id = #{typeId}
|
||||
GROUP BY
|
||||
mt.type_id
|
||||
) AS subquery2 ON subquery1.type_id = subquery2.type_id
|
||||
LEFT JOIN ma_type mt on mt.type_id = subquery1.type_id
|
||||
LEFT JOIN ma_machine mm on mm.ma_id = subquery1.maId
|
||||
WHERE mt.manage_type = 0
|
||||
and mt.del_flag = 0
|
||||
and IFNULL( subquery1.outNum, 0 ) - IFNULL( subquery2.backNum, 0 ) > 0
|
||||
and subquery1.type_id = #{typeId}
|
||||
bcd.ma_id, mt.type_id
|
||||
) AS subquery2 ON subquery1.maId = subquery2.maId
|
||||
LEFT JOIN ma_type mt ON mt.type_id = subquery1.type_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = subquery1.maId
|
||||
WHERE
|
||||
mt.manage_type = 0
|
||||
AND mt.del_flag = 0
|
||||
AND IFNULL(subquery1.outNum, 0) - IFNULL(subquery2.backNum, 0) > 0
|
||||
</select>
|
||||
<select id="getzx" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue