<?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.core.dao.FileMigrationDao">


    <select id="selectInvoiceImageFileGroup" parameterType="java.util.Map"
            resultType="com.dxhy.core.entity.TDxInvoiceImg">
        SELECT *
        FROM t_dx_invoice_img
        WHERE migration_type = '0'
          and DATE_FORMAT(create_date, '%Y') = #{createYear}
        group by DATE_FORMAT(create_date, '%Y-%m')
        order by create_date

    </select>
    <select id="selectInvoiceImageFile" parameterType="java.util.Map" resultType="com.dxhy.core.entity.TDxInvoiceImg">
        SELECT *
        FROM t_dx_invoice_img
        WHERE migration_type = '0'
          and DATE_FORMAT(create_date, '%Y-%m') = #{createMonth}
        order by create_date

    </select>

    <update id="updateMigrationStatus">
        update t_dx_invoice_img
        set migration_type = '1'
        where DATE_FORMAT(create_date, '%Y-%m') = #{createMonth}
        and id in
        <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>

    </update>

</mapper>
