<?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="org.jeecg.modules.finance.mapper.FdSupplementaryContractReceivablesMapper">

    <select id="querySupplementartByConId" resultType="org.jeecg.modules.finance.entity.FdSupplementaryContractReceivables">
        SELECT
            pf.id AS pkProjectFile,
            pf.project_name AS projectName,
            pf.contract_party AS pkContractParty,
            con.`code` AS contractCode,
            con.id AS pkContract,
            con.currency_type as currency,
            con.currency_type_name as currencyName,
            pf.bd AS BDPersonInCharge,
            pf.project_manager_id AS PMPersonInCharge,
            cus.`name` AS bidpartyname,
            cus.id AS pkbidparty,
            cus.abbreviation AS bidpartynameAbbreviation,
            cus.credit_period as creditPeriod,
            pfc.compound AS compound,
            con.project_description as contractDescription,
            con.final_total_amount as finalTotalAmount,
            pf.project_file_no,
            con.payer_name
        FROM
            fd_project_file pf
            LEFT JOIN fd_customer cus ON pf.customer_id = cus.id
            LEFT JOIN fd_contract con ON pf.contract_id = con.id
            LEFT JOIN fd_project_file_compound pfc ON pf.id = pfc.project_id
        WHERE
            con.del_flag = '0'
            AND pfc.sort = '1'
            and pf.id=#{0}
    </select>

    <update id="auditBatch" parameterType="java.util.List">
        update fd_supplementary_contract_receivables set status = '0' where id in
        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
    </update>


    <update id="reviewBatch" parameterType="java.util.List">
        update fd_supplementary_contract_receivables set status = '1' where id in
        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
    </update>

    <select id="getListAndCreditPeriod" resultType="org.jeecg.modules.finance.entity.FdSupplementaryContractReceivables">
        SELECT *,c.credit_period FROM
        fd_supplementary_contract_receivables scr
        LEFT JOIN fd_customer c on scr.pk_bidparty=c.id
    </select>
</mapper>