<?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.financeManage.mapper.FdProjectReceivablesMapper">
    <select id="fingMoreCode" resultType="int">
        select count(1) from fd_project_receivables where CODE =#{code} and del_flag=0
        <if test="id != '' and id != null">
            and id != #{id}
        </if>
        ;
    </select>

    <update id="toExamine">
        UPDATE fd_project_receivables SET state = #{state} where id =#{id}
    </update>

    <update id="updateHeadNum">
        UPDATE fd_project_receivables
          SET contractamount = (SELECT sum(contract_amount) FROM fd_project_receivables_b where pk_head_id = #{id})
        where id =#{id}
    </update>

    <select id="getListAndCreditPeriod" resultType="org.jeecg.modules.financeManage.entity.FdProjectReceivables">
        SELECT *,c.credit_period FROM
        fd_project_receivables pr
        LEFT JOIN fd_customer c on pr.pk_applicant=c.id
    </select>
</mapper>