机具费用推送修改
This commit is contained in:
parent
4f1d529512
commit
c6d84fa4f5
|
|
@ -43,24 +43,73 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getCostPushCheckList" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
||||
SELECT
|
||||
pmc.id AS id, pmc.AGREEMENT_ID AS agreementId, IF(ISNULL(pmc.check_status), 0, pmc.check_status) AS checkStatus,
|
||||
pmc.LEASE_MONEY AS leaseMoney, pmc.LOST_MONEY AS lostMoney, pmc.REPAIR_MONEY AS repairMoney, pmc.SCRAP_MONEY AS scrapMoney,
|
||||
bma.agreement_code AS agreementCode, bma.is_slt AS isSettlement, pmc.TYPE AS settlementType,
|
||||
bp.pro_name AS projectName, bu.unit_name AS unitName,cpm.id as taskId,
|
||||
ROUND(
|
||||
SUM(ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.REPAIR_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 )), 2
|
||||
) AS money
|
||||
pmc.id AS id, pmc.AGREEMENT_ID AS agreementId, IF(ISNULL(pmc.check_status), 0, pmc.check_status) AS checkStatus,
|
||||
pmc.LEASE_MONEY AS leaseMoney, pmc.LOST_MONEY AS lostMoney, pmc.REPAIR_MONEY AS repairMoney, pmc.SCRAP_MONEY AS scrapMoney,
|
||||
bma.agreement_code AS agreementCode, bma.is_slt AS isSettlement, pmc.TYPE AS settlementType,
|
||||
bp.pro_name AS projectName, bu.unit_name AS unitName,cpm.id as taskId,
|
||||
ROUND(
|
||||
SUM(ifnull( pmc.LEASE_MONEY, 0 )+ ifnull( pmc.LOST_MONEY, 0 )+ ifnull( pmc.REPAIR_MONEY, 0 )+ ifnull( pmc.SCRAP_MONEY, 0 )), 2
|
||||
) AS money,
|
||||
a.pushStatus AS pushStatus,
|
||||
a.pushRemark AS pushRemark
|
||||
FROM
|
||||
project_month_costs pmc
|
||||
project_month_costs pmc
|
||||
LEFT JOIN calc_project_month cpm on pmc.task_id = cpm.id
|
||||
LEFT JOIN bm_agreement_info bma ON pmc.AGREEMENT_ID = bma.agreement_id
|
||||
LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id
|
||||
LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id
|
||||
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
pmi.agreementId,pmi.id,pmi.push_status as pushStatus,
|
||||
pmi.push_remark as pushRemark
|
||||
FROM calc_project_month cpm
|
||||
LEFT JOIN project_month_info pmi ON pmi.taskId = cpm.id
|
||||
WHERE cpm.`MONTH` = #{month} GROUP BY pmi.agreementId
|
||||
|
||||
UNION
|
||||
SELECT
|
||||
bma.agreement_id AS agreementId,
|
||||
sad.id,sad.push_status as pushStatus,
|
||||
sad.push_remark as pushRemark
|
||||
FROM
|
||||
slt_agreement_details sad
|
||||
left join slt_agreement_apply saa on sad.apply_id = saa.id
|
||||
LEFT JOIN bm_agreement_info bma ON bma.agreement_id = saa.agreement_id
|
||||
WHERE LEFT(saa.create_time,7) = #{month} AND sad.slt_type = 2
|
||||
GROUP BY bma.agreement_id
|
||||
|
||||
UNION
|
||||
SELECT
|
||||
bma.agreement_id AS agreementId,
|
||||
sad.id,sad.push_status as pushStatus,
|
||||
sad.push_remark as pushRemark
|
||||
FROM
|
||||
slt_agreement_details sad
|
||||
left join slt_agreement_apply saa on sad.apply_id = saa.id
|
||||
LEFT JOIN bm_agreement_info bma ON bma.agreement_id = saa.agreement_id
|
||||
WHERE LEFT(saa.create_time,7) = #{month} AND sad.slt_type = 3 and sad.is_charge = 1
|
||||
GROUP BY bma.agreement_id
|
||||
|
||||
UNION
|
||||
SELECT
|
||||
bma.agreement_id AS agreementId,
|
||||
sad.id,sad.push_status as pushStatus,
|
||||
sad.push_remark as pushRemark
|
||||
FROM
|
||||
slt_agreement_details sad
|
||||
left join slt_agreement_apply saa on sad.apply_id = saa.id
|
||||
LEFT JOIN bm_agreement_info bma ON bma.agreement_id = saa.agreement_id
|
||||
WHERE LEFT(saa.create_time,7) = #{month} AND sad.slt_type = 4 and sad.is_charge = 1
|
||||
GROUP BY bma.agreement_id
|
||||
) a ON
|
||||
pmc.AGREEMENT_ID = a.agreementId
|
||||
|
||||
WHERE
|
||||
pmc.type = 1 and
|
||||
( pmc.LEASE_MONEY > 0 OR pmc.LOST_MONEY > 0 OR pmc.REPAIR_MONEY > 0 OR pmc.SCRAP_MONEY > 0 )
|
||||
<if test="checkStatus != null">
|
||||
AND pmc.check_status = #{checkStatus}
|
||||
<if test="pushStatus != null">
|
||||
AND a.pushStatus = #{pushStatus}
|
||||
</if>
|
||||
<if test="agreementCode != null and agreementCode != ''">
|
||||
AND bma.agreement_code LIKE CONCAT('%',#{agreementCode},'%')
|
||||
|
|
@ -83,6 +132,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
GROUP BY
|
||||
pmc.AGREEMENT_ID, pmc.TYPE
|
||||
order by a.pushStatus,bma.agreement_code
|
||||
</select>
|
||||
|
||||
<insert id="insertCalcMonthRecord" parameterType="com.bonus.material.push.domain.IwsCostPushBean" useGeneratedKeys="true" keyProperty="taskId">
|
||||
|
|
@ -526,7 +576,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<foreach collection="agreementIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="type != null">
|
||||
<if test="type != null and (type == 3 or type ==4)">
|
||||
and sad.slt_type = #{type} and sad.is_charge = 1
|
||||
</if>
|
||||
<if test="type != null and (type == 1 or type ==2)">
|
||||
and sad.slt_type = #{type}
|
||||
</if>
|
||||
<if test="settlementType != null">
|
||||
|
|
|
|||
Loading…
Reference in New Issue