<?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.jeeplus.test.cw.contractRegistration.mapper.ContractFilePaperMapper">
    <update id="updateStatusById">
        UPDATE cw_work_contract_file_paper SET filed_paper_type = #{filedType}, filed_data = NOW()
        WHERE del_flag = 0 AND contract_info_id = #{id}
    </update>
    <delete id="deleteFileInfo">
        delete from work_attachment where attachment_id = #{attachmentId}
    </delete>
    <select id="selectFilePaperByContractInfoId"
            resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper">
        SELECT * FROM `cw_work_contract_file_paper` WHERE del_flag = 0 AND contract_info_id = #{id}
    </select>
    <select id="getById" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper">
        select * from cw_work_contract_file_paper where id = #{id}
    </select>
    <select id="findList" resultType="com.jeeplus.test.oss.domain.WorkAttachment">
        SELECT * FROM work_attachment WHERE del_flag = 0 AND attachment_id = #{id}
    </select>
    <select id="findIsExit" resultType="java.lang.Integer">
        SELECT
			COUNT( 0 )
		FROM
			work_attachment
		WHERE
			del_flag = 0
			AND attachment_id in (#{id}, #{contractInfoId})
			AND attachment_name = #{name}
    </select>

</mapper>
