二级库
This commit is contained in:
parent
886a093818
commit
1e37e8aea8
|
|
@ -102,5 +102,15 @@ public class SecondaryWarehouse {
|
|||
private String nuitName;
|
||||
private String keyword;
|
||||
|
||||
/**
|
||||
* 租赁类型 0工程1长期
|
||||
*/
|
||||
@Excel(name = "租赁类型")
|
||||
private String leaseType;
|
||||
|
||||
/**
|
||||
* 领用数量
|
||||
*/
|
||||
@Excel(name = "领用数量")
|
||||
private Integer receiveNum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,29 +11,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="getList" resultType="com.bonus.sgzb.material.domain.SecondaryWarehouse">
|
||||
SELECT
|
||||
bui.unit_id AS unitId,
|
||||
sai.agreement_id AS agreementId,
|
||||
tta.agreement_id AS agreementId,
|
||||
bui.unit_name AS unitName,
|
||||
bp.lot_name AS proName,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS modelName,
|
||||
mt.unit_name AS nuitName,
|
||||
sai.type_id AS typeId,
|
||||
SUM( sai.num ) AS jcNum,
|
||||
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,
|
||||
lod.type_id AS typeId,
|
||||
SUM( lod.out_num ) AS jcNum,
|
||||
receive_num as receiveNmu,
|
||||
-- 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( tli2.num, 0 ) AS zkNum
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
from lease_out_details lod
|
||||
left join lease_apply_info lai on lod.parent_id=lai.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_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 ( 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
|
||||
AND tli.type_id = sai.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
|
||||
AND tli2.type_id = sai.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 = tta.agreement_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 = tta.agreement_id
|
||||
AND tli2.type_id = lod.type_id
|
||||
WHERE 1=1
|
||||
<if test="unitId != null and unitId != ''">
|
||||
and bui.unit_id = #{unitId}
|
||||
|
|
@ -47,6 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="modelId != null and modelId != ''">
|
||||
and mt.type_id = #{modelId}
|
||||
</if>
|
||||
<if test="leaseType != null and leaseType != ''">
|
||||
and lai.lease_type = #{leaseType}
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (bui.unit_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>
|
||||
GROUP BY
|
||||
sai.agreement_id,
|
||||
sai.type_id
|
||||
tta.agreement_id,
|
||||
lod.type_id
|
||||
</select>
|
||||
<select id="getOperateList" resultType="com.bonus.sgzb.material.domain.TeamLeaseInfo">
|
||||
SELECT
|
||||
|
|
|
|||
Loading…
Reference in New Issue