<?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.dxhy.erp.dao.TdxDkCountDao">
    <select id="selectCountByTaxNo" resultType="com.dxhy.erp.entity.TdxDkCount">
        select taxno,
               taxname,
               skssq,
               apply_status applyStatus,
               apply_msg    applyMsg,
               sign_status  signStatus,
               create_date  createDate,
               tj_status    tjStatus,
               qs_status    qsStatus,
               sfdqskssq,
               apply_type   applyType,
               tj_date      tjDate,
               cxtj_status  cxtjStatus,
               cxqs_status  cxqsStatus
        from t_dx_dk_count
        where taxno = #{taxno}
          and sfdqskssq = '1'
    </select>
    <update id="updateDkCount">
        update t_dx_dk_count
        set apply_status=#{dkCount.applyStatus},
            tj_status=#{dkCount.tjStatus},
            apply_type=#{dkCount.applyType},
            cxtj_status=#{dkCount.cxtjStatus},
            cxqs_status=#{dkCount.cxqsStatus},
            qs_status=#{dkCount.qsStatus}
        where taxno = #{dkCount.taxno}
          and skssq = #{dkCount.skssq}
    </update>
    <insert id="insertStateRecord">
        insert into t_dx_state_record (id, buyer_tax_no, tj_month, batch_no, state_type, apply_type, state_time)
        values (#{state.id}, #{state.buyerTaxNo}, #{state.tjMonth}, #{state.batchNo}, #{state.stateType},
                #{state.applyType}, #{state.stateTime})
    </insert>
    <select id="selectStateRecord" resultType="com.dxhy.erp.entity.TdxStateRecord">
        select *
        from t_dx_state_record
        where batch_no = #{batchNo}
    </select>
    <select id="selectStateResult" resultType="com.dxhy.erp.entity.TdxDkCount">
        select *
        from t_dx_dk_count
        where taxno = #{taxno}
          and skssq = #{skssq}
    </select>
    <select id="selectCountDetail" resultType="com.dxhy.erp.entity.TdxDkCountDetail">
        select *
        from t_dx_dk_count_detail
        where taxno = #{taxno}
          and tj_month = #{skssq}
    </select>
</mapper>
