<?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.seriousillegal.mapper.TSBizSerIllegallMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegal">
        <id column="ILLEGALLISTID" property="illegallistid" />
        <result column="BIZSEQ" property="bizseq" />
        <result column="ABNLISTID" property="abnlistid" />
        <result column="PRIPID" property="pripid" />
        <result column="REGNO" property="regno" />
        <result column="ENTNAME" property="entname" />
        <result column="SERILLREA" property="serillrea" />
        <result column="APPROVALDATE" property="approvaldate" />
        <result column="DECORG" property="decorg" />
        <result column="AREA_CODE" property="areaCode" />
        <result column="LAUPTIME" property="lauptime" />
        <result column="LOSTCREDITEXPLAIN" property="lostcreditexplain" />
        <result column="ReconsiderationOrg" property="reconsiderationOrg" />
        <result column="GovernmentOrg" property="governmentOrg" />
        <result column="LitiOrg" property="litiOrg" />
        <result column="status" property="status" />
        <result column="intoSponsorIllegal" property="intoSponsorIllegal" />
        <result column="batchAndCase" property="batchAndCase" />
        <result column="endApply" property="endApply" />
        <result column="endReason" property="endReason" />
        <result column="ISHEA" property="ishea" />
        <result column="HEAOP" property="heaop" />
        <result column="JUDDOCTITLE" property="juddoctitle" />
        <result column="JUDDOCNO" property="juddocno" />
        <result column="case_id" property="caseId" />
        <result column="correctBizseq" property="correctBizseq" />
        <result column="heaopinionl" property="heaopinionl" />
        <result column="illoperatingid" property="illoperatingid" />
    </resultMap>

    <select id="selectBizSerIllegalModels" parameterType="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegal" resultMap="BaseResultMap">
        select * from TSBizSerIllegal
        <where>
            <if test=" tsBizSerIllegalModel.bizseq != null and tsBizSerIllegalModel.bizseq != ''">
                and bizseq = #{tsBizSerIllegalModel.bizseq}
            </if>
            <if test=" tsBizSerIllegalModel.abnlistid != null and tsBizSerIllegalModel.abnlistid != ''">
                and abnlistid = #{tsBizSerIllegalModel.abnlistid}
            </if>
            <if test=" tsBizSerIllegalModel.pripid != null and tsBizSerIllegalModel.pripid != ''">
                and pripid = #{tsBizSerIllegalModel.pripid}
            </if>
            <if test=" tsBizSerIllegalModel.regno != null and tsBizSerIllegalModel.regno != ''">
                and regno = #{tsBizSerIllegalModel.regno}
            </if>
        </where>
    </select>

    <select id="selectSerIllegalByPageList" parameterType="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegal" resultMap="BaseResultMap">
        select *  from  TSBizSerIllegal
        <where>
            <if test=" tsBizSerIllegalModel.bizseq != null and tsBizSerIllegalModel.bizseq != ''">
                and bizseq = #{tsBizSerIllegalModel.bizseq}
            </if>
            <if test=" tsBizSerIllegalModel.pripid != null and tsBizSerIllegalModel.pripid != ''">
                and pripid = #{tsBizSerIllegalModel.pripid}
            </if>
            <if test=" tsBizSerIllegalModel.regno != null and tsBizSerIllegalModel.regno != ''">
                and regno = #{tsBizSerIllegalModel.regno}
            </if>
        </where>
    </select>

    <select id="getSerillreasOne" resultType="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegalReas">
       <![CDATA[
        select serIllegalReasID,reaCode,reaProvision,reaName,reaLaws
        from TSBizSerIllegalReas
        where reaCode = '1'
        ]]>
    </select>

    <select id="getSerillreasOthers" resultType="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegalReas">
        <![CDATA[
        select serIllegalReasID,reaCode,reaProvision,reaName,reaLaws
        from TSBizSerIllegalReas
        where reaCode != '1'
        order by serIllegalReasID
        ]]>
    </select>

    <select id="findSerIllegalReas" resultType="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegalReas">
        <![CDATA[
        select serIllegalReasID,reaCode,reaProvision,reaName,reaLaws
        from TSBizSerIllegalReas
        order by serIllegalReasID
        ]]>
    </select>

    <select id="findSerIllegalReaByCode"  parameterType="java.lang.String"
            resultType="com.chinaweal.aiccs.aiccs.seriousillegal.entity.TSBizSerIllegalReas">
        select serIllegalReasID,reaCode,reaProvision,reaName,reaLaws
        from TSBizSerIllegalReas
        where reaCode = #{reaCode,jdbcType=VARCHAR}
    </select>

    <select id="queryByTBYZWFAPPROVE" resultMap="BaseResultMap">
        select sregno as regno, suniscid as uniscid, sapprovecode as bizseq,SREASONCONTENT as lostcreditexplain from tfdb.TB_YZWF_APPROVE
        where sapprovecode = #{SAPPROVECODE}
    </select>

    <select id="queryByTBYZWFBATCHAPPROVE" resultMap="BaseResultMap">
        select  sapprovecode as bizseq,SREASONCONTENT as lostcreditexplain from tfdb.TB_YZWF_BATCH_APPROVE
        where sapprovecode = #{SAPPROVECODE}
    </select>

    <select id="queryEntByTBYZWFBATCHLIST" resultType="com.chinaweal.aiccs.aiccs.abnormal.entity.EBaseinfo">
        select eb.* from tfdb.TB_YZWF_BATCH_LIST tybl
        left join aiccs.e_baseinfo eb on tybl.pripid = eb.pripid
        where sapprovecode = #{SAPPROVECODE}
    </select>
</mapper>
