<?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.springblade.audit.mapper.YksytRefundForCpMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="yksytRefundForCpResultMap" type="org.springblade.audit.entity.YksytRefundForCp">
        <result column="THEMONTH" property="themonth"/>
        <result column="PROVINCE" property="province"/>
        <result column="SPID" property="spid"/>
        <result column="SPNAME" property="spname"/>
        <result column="CPNAME" property="cpname"/>
        <result column="REFUND_MONEY" property="refundMoney"/>
    </resultMap>


    <update id="giveSpidSoul">
        update YKSYT_REFUND_FOR_CP a
        set spid=(select max(spid) from dim_product_category b where a.spname=b.spname)
        where spid is null and themonth = #{theMonth}
    </update>

    <update id="giveSpidSoulTwo">
        update YKSYT_REFUND_FOR_CP a
        set spid= (select max(spid) from DIM_CS_PRM_SPNAME b where a.spname=b.PRM_SPNAME)
        where themonth = #{theMonth} and spid is null
    </update>

    <update id="settingFileTag">
        update INT_IMPORT_FLAG set FLAG_REFUND_4_CP = 1 where themonth = #{theMonth}
    </update>

</mapper>
