<?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.hzya.frame.plugin.cinvoice.dao.impl.CInvoiceImportHDaoImpl">
    <resultMap id="get-CInvoiceImportHEntity-result" type="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
        <result property="id" column="id" />
        <result property="tab_name" column="tab_name" />
        <result property="yd_res_field" column="yd_res_field" />
        <result property="bill_type" column="bill_type" />
        <result property="bill_code" column="bill_code" />
        <result property="push_status" column="push_status" />
        <result property="push_field" column="push_field" />
        <result property="start_date" column="start_date" />

    </resultMap>

    <select id="entity_list_base" resultMap="get-CInvoiceImportHEntity-result" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
        select  * from v_hzya_invoice_import f
        <trim prefix="where" prefixOverrides="and">
            <if test="id != null and id != ''">f.id = #{id}</if>
            <if test="bill_code != null and bill_code != ''">and f.bill_code = #{bill_code}</if>
            and push_status is null
            -- and start_date >= '2025-05-26'
        </trim>
    </select>

    <update id="entity_update" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
        update ${tab_name} set ${yd_res_field} = #{yd_result} where id = #{id}
    </update>

    <update id="entity_update_status" parameterType="com.hzya.frame.plugin.cinvoice.entity.CInvoiceImportHEntity">
        update ${tab_name} set ${push_field} = '1' where id = #{id}
    </update>
</mapper>
