<?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.chinaweal.aiccs.aiccs.business.mapper.BizCorrectionsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.business.entity.BizCorrections">
        <id column="corrections_id" property="correctionsId" />
        <result column="bizseq" property="bizseq" />
        <result column="bus_id" property="busId" />
        <result column="pripid" property="pripid" />
        <result column="regno" property="regno" />
        <result column="uniscid" property="uniscid" />
        <result column="entname" property="entname" />
        <result column="p_reason" property="pReason" />
        <result column="reason" property="reason" />
        <result column="p_fact_desc" property="pFactDesc" />
        <result column="fact_desc" property="factDesc" />
        <result column="bustype" property="bustype" />
        <result column="creator_id" property="creatorId" />
        <result column="state" property="state" />
        <result column="entType" property="entType" />
        <result column="create_time" property="createTime" />
        <result column="lauptime" property="lauptime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        corrections_id, bizseq, bus_id, pripid, regno, uniscid, entname, p_reason, reason, p_fact_desc, fact_desc,
        bustype, creator_id, state, create_time, lauptime, entType
    </sql>
    <!--更新列异勘误结果至列异记录-->
    <update id="updateAbnormalCorrectionsMsg">
        update tsabnlist
        set SPECAUSE = (select reason from biz_corrections where corrections_id = #{bizId}),
            SPEREASONS = (select fact_desc from biz_corrections where corrections_id = #{bizId})
        where ABNLISTID = (select bus_id from biz_corrections where corrections_id = #{bizId})
    </update>
    <!--更新列严勘误结果至列严记录-->
    <update id="updateIllegalCorrectionsMsg">
        update tsserillegallist
        set SERILLREA = (select reason from biz_corrections where corrections_id = #{bizId}),
            LOSTCREDITEXPLAIN = (select fact_desc from biz_corrections where corrections_id = #{bizId})
        where ILLEGALLISTID = (select bus_id from biz_corrections where corrections_id = #{bizId})
    </update>

</mapper>
