二级库

This commit is contained in:
sxu 2024-07-24 11:27:54 +08:00
parent 886a093818
commit 1e37e8aea8
2 changed files with 30 additions and 15 deletions

View File

@ -102,5 +102,15 @@ public class SecondaryWarehouse {
private String nuitName; private String nuitName;
private String keyword; private String keyword;
/**
* 租赁类型 0工程1长期
*/
@Excel(name = "租赁类型")
private String leaseType;
/**
* 领用数量
*/
@Excel(name = "领用数量")
private Integer receiveNum;
} }

View File

@ -11,29 +11,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse"> <select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
SELECT SELECT
bui.unit_id AS unitId, bui.unit_id AS unitId,
sai.agreement_id AS agreementId, tta.agreement_id AS agreementId,
bui.unit_name AS unitName, bui.unit_name AS unitName,
bp.lot_name AS proName, bp.lot_name AS proName,
mt1.type_name AS typeName, mt1.type_name AS typeName,
mt.type_name AS modelName, mt.type_name AS modelName,
mt.unit_name AS nuitName, mt.unit_name AS nuitName,
sai.type_id AS typeId, lod.type_id AS typeId,
SUM( sai.num ) AS jcNum, SUM( lod.out_num ) AS jcNum,
SUM( CASE WHEN sai.`status` = '1' THEN sai.num ELSE 0 END ) AS tcNum, receive_num as receiveNmu,
SUM( CASE WHEN sai.`status` = '0' THEN sai.num ELSE 0 END ) - IFNULL( tli.num, 0 ) + IFNULL( tli2.num, 0 ) AS kcNum, -- SUM( CASE WHEN sai.`status` = '1' THEN sai.num ELSE 0 END ) AS tcNum,
-- SUM( CASE WHEN sai.`status` = '0' THEN sai.num ELSE 0 END ) - IFNULL( tli.num, 0 ) + IFNULL( tli2.num, 0 ) AS kcNum,
IFNULL( tli.num, 0 ) AS ckNum, IFNULL( tli.num, 0 ) AS ckNum,
IFNULL( tli2.num, 0 ) AS zkNum IFNULL( tli2.num, 0 ) AS zkNum
FROM from lease_out_details lod
slt_agreement_info sai left join lease_apply_info lai on lod.parent_id=lai.id
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id left join tm_task_agreement tta on lai.task_id=tta.task_id
LEFT JOIN bm_agreement_info bai ON tta.agreement_id = bai.agreement_id
LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id LEFT JOIN bm_project_lot bp ON bp.lot_id = bai.project_id
LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id LEFT JOIN bm_unit_info bui ON bui.unit_id = bai.unit_id
LEFT JOIN ma_type mt ON sai.type_id = mt.type_id LEFT JOIN ma_type mt ON lod.type_id = mt.type_id
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
LEFT JOIN ( SELECT SUM( num ) AS num, agreement_id, type_id FROM team_lease_info WHERE type = '1' GROUP BY agreement_id, type_id ) tli ON tli.agreement_id = sai.agreement_id LEFT JOIN ( SELECT SUM( num ) AS num, agreement_id, type_id FROM team_lease_info WHERE type = '1' GROUP BY agreement_id, type_id ) tli ON tli.agreement_id = tta.agreement_id
AND tli.type_id = sai.type_id AND tli.type_id = lod.type_id
LEFT JOIN ( SELECT SUM( num ) AS num, agreement_id, type_id FROM team_lease_info WHERE type = '2' GROUP BY agreement_id, type_id ) tli2 ON tli2.agreement_id = sai.agreement_id LEFT JOIN ( SELECT SUM( num ) AS num, agreement_id, type_id FROM team_lease_info WHERE type = '2' GROUP BY agreement_id, type_id ) tli2 ON tli2.agreement_id = tta.agreement_id
AND tli2.type_id = sai.type_id AND tli2.type_id = lod.type_id
WHERE 1=1 WHERE 1=1
<if test="unitId != null and unitId != ''"> <if test="unitId != null and unitId != ''">
and bui.unit_id = #{unitId} and bui.unit_id = #{unitId}
@ -47,6 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="modelId != null and modelId != ''"> <if test="modelId != null and modelId != ''">
and mt.type_id = #{modelId} and mt.type_id = #{modelId}
</if> </if>
<if test="leaseType != null and leaseType != ''">
and lai.lease_type = #{leaseType}
</if>
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
and (bui.unit_name like concat('%', #{keyword}, '%') or and (bui.unit_name like concat('%', #{keyword}, '%') or
bp.lot_name like concat('%', #{keyword}, '%') or bp.lot_name like concat('%', #{keyword}, '%') or
@ -55,8 +60,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) )
</if> </if>
GROUP BY GROUP BY
sai.agreement_id, tta.agreement_id,
sai.type_id lod.type_id
</select> </select>
<select id="getOperateList" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo"> <select id="getOperateList" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
SELECT SELECT