<?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.MidCsComplaintDetailMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="org.springblade.audit.entity.MidCsComplaintDetail">
        <result column="THEMONTH" property="themonth" />
        <result column="IMPORT_TIME" property="importTime" />
        <result column="DATA_SOURCE" property="dataSource" />
        <result column="WORKSHEETID" property="worksheetid" />
        <result column="ACCEPT_TIME" property="acceptTime" />
        <result column="DIAL_PHONENUM" property="dialPhonenum" />
        <result column="ACCEPT_PHONENUM" property="acceptPhonenum" />
        <result column="SERVICE_STYLE" property="serviceStyle" />
        <result column="SERVICE_TYPE" property="serviceType" />
        <result column="SPNAME" property="spname" />
        <result column="PROVINCE" property="province" />
        <result column="AREA" property="area" />
        <result column="ACCEPT_WAY" property="acceptWay" />
        <result column="COMPLAINT_TYPE" property="complaintType" />
        <result column="REFUND_REASON" property="refundReason" />
        <result column="DESCRIBE" property="describe" />
        <result column="HANDLE_RESULT" property="handleResult" />
        <result column="IS_REFUND" property="isRefund" />
        <result column="REFUND_TIMES" property="refundTimes" />
        <result column="REFUND_MONEY" property="refundMoney" />
        <result column="IS_HIGH_REFUND" property="isHighRefund" />
        <result column="OVER_TIME" property="overTime" />
        <result column="COMPLAINT_UPGRADE" property="complaintUpgrade" />
        <result column="ACCEPT_DAY" property="acceptDay" />
        <result column="IMPORT_DAY" property="importDay" />
        <result column="SPID" property="spid" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        THEMONTH, IMPORT_TIME, DATA_SOURCE, WORKSHEETID, ACCEPT_TIME, DIAL_PHONENUM, ACCEPT_PHONENUM, SERVICE_STYLE, SERVICE_TYPE, SPNAME, PROVINCE, AREA, ACCEPT_WAY, COMPLAINT_TYPE, REFUND_REASON, DESCRIBE, HANDLE_RESULT, IS_REFUND, REFUND_TIMES, REFUND_MONEY, IS_HIGH_REFUND, OVER_TIME, COMPLAINT_UPGRADE, ACCEPT_DAY, IMPORT_DAY, SPID
    </sql>

    <update id="updateSpid">
        update MID_CS_COMPLAINT_DETAIL a
        set spid= (select max(spid) from DIM_CS_KC_SPNAME b where a.spname=b.CS_SPNAME)
        where spid is null
    </update>

    <update id="updateSpidf">
        update MID_CS_COMPLAINT_DETAIL a
        set spid=(select max(spid) from dim_product_category b where a.spname=b.spname)
    </update>


</mapper>
