2025-01-23 15:51:16 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.bonus.material.push.mapper.IwsCostPushMapper">
|
|
|
|
|
|
|
|
|
|
<select id="findAgreement" resultType="com.bonus.material.push.domain.IwsCostPushBean">
|
|
|
|
|
SELECT
|
2025-01-23 16:40:53 +08:00
|
|
|
bp.pro_id AS projectId,
|
2025-01-23 15:51:16 +08:00
|
|
|
bp.pro_name AS projectName,
|
2025-01-23 16:13:37 +08:00
|
|
|
bp.pro_code AS projectCode,
|
2025-01-23 15:51:16 +08:00
|
|
|
bu.unit_name AS unitName,
|
|
|
|
|
bma.`agreement_code` AS agreementCode,
|
|
|
|
|
bma.is_slt AS isSettlement,
|
|
|
|
|
bma.sign_time AS settlementTime,
|
|
|
|
|
bma.is_push AS isPush
|
|
|
|
|
FROM bm_agreement_info bma
|
|
|
|
|
LEFT JOIN bm_project bp ON bp.pro_id = bma.project_id
|
|
|
|
|
LEFT JOIN bm_unit bu ON bu.unit_id = bma.unit_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="agreementCode != null and agreementCode != ''">
|
|
|
|
|
AND bma.agreement_code LIKE CONCAT('%',#{agreementCode},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
|
|
AND bma.project_id = #{projectId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
AND bma.unit_id = #{unitId}
|
|
|
|
|
</if>
|
2025-01-23 16:13:37 +08:00
|
|
|
<if test="isPush != null">
|
2025-01-23 15:51:16 +08:00
|
|
|
AND bma.is_push = #{isPush}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isSettlement != null and isSettlement != ''">
|
|
|
|
|
AND bma.is_slt = #{isSettlement}
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-01-23 16:40:53 +08:00
|
|
|
<update id="updateAgreementIsPush">
|
|
|
|
|
UPDATE bm_agreement_info
|
|
|
|
|
SET is_push = #{isPush}
|
|
|
|
|
WHERE agreement_id IN
|
|
|
|
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
2025-01-23 17:51:20 +08:00
|
|
|
|
|
|
|
|
<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,
|
2025-01-24 15:08:08 +08:00
|
|
|
bma.agreement_code AS agreementCode, bma.is_slt AS isSettlement,
|
2025-01-23 17:51:20 +08:00
|
|
|
bp.pro_name AS projectName,
|
|
|
|
|
bu.unit_name AS unitName,
|
|
|
|
|
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
|
|
|
|
|
FROM
|
|
|
|
|
project_month_costs pmc
|
|
|
|
|
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
|
|
|
|
|
WHERE
|
|
|
|
|
( 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>
|
|
|
|
|
<if test="agreementCode != null and agreementCode != ''">
|
|
|
|
|
AND bma.agreement_code LIKE CONCAT('%',#{agreementCode},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="projectId != null and projectId != ''">
|
|
|
|
|
AND bma.project_id = #{projectId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="unitId != null and unitId != ''">
|
|
|
|
|
AND bma.unit_id = #{unitId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="isSettlement != null and isSettlement != ''">
|
|
|
|
|
AND bma.is_slt = #{isSettlement}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
GROUP BY
|
|
|
|
|
pmc.AGREEMENT_ID
|
|
|
|
|
</select>
|
2025-01-23 15:51:16 +08:00
|
|
|
</mapper>
|