CreditGrantingInfoMapper.xml 17.7 KB
<?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.lhcredit.project.business.creditGrantingInfo.mapper.CreditGrantingInfoMapper">

    <resultMap type="CreditGrantingInfo" id="CreditGrantingInfoResult">
        <result property="id"    column="id"    />
        <result property="ename"    column="ename"    />
        <result property="basicInfo"    column="basicInfo"    />
        <result property="effectiveDate"    column="effectiveDate"    />
        <result property="deadline"    column="deadline"    />
        <result property="companyType"    column="companyType"    />
        <result property="companyNature"    column="CompanyNature"    />
        <result property="collateralList"    column="collateralList"    />
        <result property="guaranteeContract"    column="guaranteeContract"    />
        <result property="historicalTransactions"    column="historicalTransactions"    />
        <result property="historicalTransactionsAnnex"    column="historicalTransactionsAnnex"    />
        <result property="comprehensiveRate"    column="comprehensiveRate"    />
        <result property="comprehensiveRateSub"    column="comprehensiveRateSub"    />
        <result property="comprehensiveRateSubInfo"    column="comprehensiveRateSubInfo"    />
        <result property="comprehensiveRateImg"    column="comprehensiveRateImg"    />
        <result property="creditAnalysis"    column="creditAnalysis"    />
        <result property="radarImg"    column="radarImg"    />
        <result property="creditLv"    column="creditLv"    />
        <result property="creditRemark"    column="creditRemark"    />
        <result property="creditReport"    column="creditReport"    />
        <result property="creditLimit"    column="creditLimit"    />
        <result property="creditLimitLast"    column="creditLimitLast"    />
        <result property="creditLimitAdd"    column="creditLimitAdd"    />
        <result property="creditLimitAddInfo"    column="creditLimitAddInfo"    />
        <result property="creditLimitAddAnnex"    column="creditLimitAddAnnex"    />
        <result property="userId"    column="user_id"    />
        <result property="orgId"    column="org_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectCreditGrantingInfoVo">
        select id, ename, basicInfo, effectiveDate, deadline, companyType, CompanyNature, collateralList, guaranteeContract, historicalTransactions, historicalTransactionsAnnex, comprehensiveRate, comprehensiveRateSub, comprehensiveRateSubInfo, comprehensiveRateImg, creditAnalysis, radarImg, creditLv, creditRemark, creditReport, creditLimit, creditLimitLast, creditLimitAdd, creditLimitAddInfo, creditLimitAddAnnex, user_id, org_id, del_flag, create_time, update_time, update_by from credit_granting_info
    </sql>

    <select id="selectCreditGrantingInfoList" parameterType="CreditGrantingInfo" resultMap="CreditGrantingInfoResult">
        <include refid="selectCreditGrantingInfoVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="ename != null  and ename != '' "> and ename = #{ename}</if>
            <if test="basicInfo != null  and basicInfo != '' "> and basicInfo = #{basicInfo}</if>
            <if test="effectiveDate != null "> and effectiveDate = #{effectiveDate}</if>
            <if test="deadline != null "> and deadline = #{deadline}</if>
            <if test="companyType != null  and companyType != '' "> and companyType = #{companyType}</if>
            <if test="companyNature != null  and companyNature != '' "> and CompanyNature = #{companyNature}</if>
            <if test="collateralList != null  and collateralList != '' "> and collateralList = #{collateralList}</if>
            <if test="guaranteeContract != null  and guaranteeContract != '' "> and guaranteeContract = #{guaranteeContract}</if>
            <if test="historicalTransactions != null  and historicalTransactions != '' "> and historicalTransactions = #{historicalTransactions}</if>
            <if test="historicalTransactionsAnnex != null  and historicalTransactionsAnnex != '' "> and historicalTransactionsAnnex = #{historicalTransactionsAnnex}</if>
            <if test="comprehensiveRate != null "> and comprehensiveRate = #{comprehensiveRate}</if>
            <if test="comprehensiveRateSub != null "> and comprehensiveRateSub = #{comprehensiveRateSub}</if>
            <if test="comprehensiveRateSubInfo != null  and comprehensiveRateSubInfo != '' "> and comprehensiveRateSubInfo = #{comprehensiveRateSubInfo}</if>
            <if test="comprehensiveRateImg != null  and comprehensiveRateImg != '' "> and comprehensiveRateImg = #{comprehensiveRateImg}</if>
            <if test="creditAnalysis != null  and creditAnalysis != '' "> and creditAnalysis = #{creditAnalysis}</if>
            <if test="radarImg != null  and radarImg != '' "> and radarImg = #{radarImg}</if>
            <if test="creditLv != null  and creditLv != '' "> and creditLv = #{creditLv}</if>
            <if test="creditRemark != null  and creditRemark != '' "> and creditRemark = #{creditRemark}</if>
            <if test="creditReport != null  and creditReport != '' "> and creditReport = #{creditReport}</if>
            <if test="creditLimit != null "> and creditLimit = #{creditLimit}</if>
            <if test="creditLimitLast != null "> and creditLimitLast = #{creditLimitLast}</if>
            <if test="creditLimitAdd != null "> and creditLimitAdd = #{creditLimitAdd}</if>
            <if test="creditLimitAddInfo != null  and creditLimitAddInfo != '' "> and creditLimitAddInfo = #{creditLimitAddInfo}</if>
            <if test="creditLimitAddAnnex != null  and creditLimitAddAnnex != '' "> and creditLimitAddAnnex = #{creditLimitAddAnnex}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="orgId != null "> and org_id = #{orgId}</if>
            <if test="delFlag != null  and delFlag != '' "> and del_flag = #{delFlag}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="updateBy != null  and updateBy != '' "> and update_by = #{updateBy}</if>
        </where>
    </select>

    <select id="selectCreditGrantingInfoById" parameterType="Long" resultMap="CreditGrantingInfoResult">
        <include refid="selectCreditGrantingInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertCreditGrantingInfo" parameterType="CreditGrantingInfo" useGeneratedKeys="true" keyProperty="id">
        insert into credit_granting_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">ename,</if>
            <if test="basicInfo != null  and basicInfo != ''  ">basicInfo,</if>
            <if test="effectiveDate != null  ">effectiveDate,</if>
            <if test="deadline != null  ">deadline,</if>
            <if test="companyType != null  and companyType != ''  ">companyType,</if>
            <if test="companyNature != null  and companyNature != ''  ">CompanyNature,</if>
            <if test="collateralList != null  and collateralList != ''  ">collateralList,</if>
            <if test="guaranteeContract != null  and guaranteeContract != ''  ">guaranteeContract,</if>
            <if test="historicalTransactions != null  and historicalTransactions != ''  ">historicalTransactions,</if>
            <if test="historicalTransactionsAnnex != null  and historicalTransactionsAnnex != ''  ">historicalTransactionsAnnex,</if>
            <if test="comprehensiveRate != null  ">comprehensiveRate,</if>
            <if test="comprehensiveRateSub != null  ">comprehensiveRateSub,</if>
            <if test="comprehensiveRateSubInfo != null  and comprehensiveRateSubInfo != ''  ">comprehensiveRateSubInfo,</if>
            <if test="comprehensiveRateImg != null  and comprehensiveRateImg != ''  ">comprehensiveRateImg,</if>
            <if test="creditAnalysis != null  and creditAnalysis != ''  ">creditAnalysis,</if>
            <if test="radarImg != null  and radarImg != ''  ">radarImg,</if>
            <if test="creditLv != null  and creditLv != ''  ">creditLv,</if>
            <if test="creditRemark != null  and creditRemark != ''  ">creditRemark,</if>
            <if test="creditReport != null  and creditReport != ''  ">creditReport,</if>
            <if test="creditLimit != null  ">creditLimit,</if>
            <if test="creditLimitLast != null  ">creditLimitLast,</if>
            <if test="creditLimitAdd != null  ">creditLimitAdd,</if>
            <if test="creditLimitAddInfo != null  and creditLimitAddInfo != ''  ">creditLimitAddInfo,</if>
            <if test="creditLimitAddAnnex != null  and creditLimitAddAnnex != ''  ">creditLimitAddAnnex,</if>
            <if test="userId != null  ">user_id,</if>
            <if test="orgId != null  ">org_id,</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag,</if>
            <if test="createTime != null  ">create_time,</if>
            <if test="updateTime != null  ">update_time,</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">#{ename},</if>
            <if test="basicInfo != null  and basicInfo != ''  ">#{basicInfo},</if>
            <if test="effectiveDate != null  ">#{effectiveDate},</if>
            <if test="deadline != null  ">#{deadline},</if>
            <if test="companyType != null  and companyType != ''  ">#{companyType},</if>
            <if test="companyNature != null  and companyNature != ''  ">#{companyNature},</if>
            <if test="collateralList != null  and collateralList != ''  ">#{collateralList},</if>
            <if test="guaranteeContract != null  and guaranteeContract != ''  ">#{guaranteeContract},</if>
            <if test="historicalTransactions != null  and historicalTransactions != ''  ">#{historicalTransactions},</if>
            <if test="historicalTransactionsAnnex != null  and historicalTransactionsAnnex != ''  ">#{historicalTransactionsAnnex},</if>
            <if test="comprehensiveRate != null  ">#{comprehensiveRate},</if>
            <if test="comprehensiveRateSub != null  ">#{comprehensiveRateSub},</if>
            <if test="comprehensiveRateSubInfo != null  and comprehensiveRateSubInfo != ''  ">#{comprehensiveRateSubInfo},</if>
            <if test="comprehensiveRateImg != null  and comprehensiveRateImg != ''  ">#{comprehensiveRateImg},</if>
            <if test="creditAnalysis != null  and creditAnalysis != ''  ">#{creditAnalysis},</if>
            <if test="radarImg != null  and radarImg != ''  ">#{radarImg},</if>
            <if test="creditLv != null  and creditLv != ''  ">#{creditLv},</if>
            <if test="creditRemark != null  and creditRemark != ''  ">#{creditRemark},</if>
            <if test="creditReport != null  and creditReport != ''  ">#{creditReport},</if>
            <if test="creditLimit != null  ">#{creditLimit},</if>
            <if test="creditLimitLast != null  ">#{creditLimitLast},</if>
            <if test="creditLimitAdd != null  ">#{creditLimitAdd},</if>
            <if test="creditLimitAddInfo != null  and creditLimitAddInfo != ''  ">#{creditLimitAddInfo},</if>
            <if test="creditLimitAddAnnex != null  and creditLimitAddAnnex != ''  ">#{creditLimitAddAnnex},</if>
            <if test="userId != null  ">#{userId},</if>
            <if test="orgId != null  ">#{orgId},</if>
            <if test="delFlag != null  and delFlag != ''  ">#{delFlag},</if>
            <if test="createTime != null  ">#{createTime},</if>
            <if test="updateTime != null  ">#{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''  ">#{updateBy},</if>
        </trim>
    </insert>

    <update id="updateCreditGrantingInfo" parameterType="CreditGrantingInfo">
        update credit_granting_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="ename != null  and ename != ''  ">ename = #{ename},</if>
            <if test="basicInfo != null  and basicInfo != ''  ">basicInfo = #{basicInfo},</if>
            <if test="effectiveDate != null  ">effectiveDate = #{effectiveDate},</if>
            <if test="deadline != null  ">deadline = #{deadline},</if>
            <if test="companyType != null  and companyType != ''  ">companyType = #{companyType},</if>
            <if test="companyNature != null  and companyNature != ''  ">CompanyNature = #{companyNature},</if>
            <if test="collateralList != null  and collateralList != ''  ">collateralList = #{collateralList},</if>
            <if test="guaranteeContract != null  and guaranteeContract != ''  ">guaranteeContract = #{guaranteeContract},</if>
            <if test="historicalTransactions != null  and historicalTransactions != ''  ">historicalTransactions = #{historicalTransactions},</if>
            <if test="historicalTransactionsAnnex != null  and historicalTransactionsAnnex != ''  ">historicalTransactionsAnnex = #{historicalTransactionsAnnex},</if>
            <if test="comprehensiveRate != null  ">comprehensiveRate = #{comprehensiveRate},</if>
            <if test="comprehensiveRateSub != null  ">comprehensiveRateSub = #{comprehensiveRateSub},</if>
            <if test="comprehensiveRateSubInfo != null  and comprehensiveRateSubInfo != ''  ">comprehensiveRateSubInfo = #{comprehensiveRateSubInfo},</if>
            <if test="comprehensiveRateImg != null  and comprehensiveRateImg != ''  ">comprehensiveRateImg = #{comprehensiveRateImg},</if>
            <if test="creditAnalysis != null  and creditAnalysis != ''  ">creditAnalysis = #{creditAnalysis},</if>
            <if test="radarImg != null  and radarImg != ''  ">radarImg = #{radarImg},</if>
            <if test="creditLv != null  and creditLv != ''  ">creditLv = #{creditLv},</if>
            <if test="creditRemark != null  and creditRemark != ''  ">creditRemark = #{creditRemark},</if>
            <if test="creditReport != null  and creditReport != ''  ">creditReport = #{creditReport},</if>
            <if test="creditLimit != null  ">creditLimit = #{creditLimit},</if>
            <if test="creditLimitLast != null  ">creditLimitLast = #{creditLimitLast},</if>
            <if test="creditLimitAdd != null  ">creditLimitAdd = #{creditLimitAdd},</if>
            <if test="creditLimitAddInfo != null  and creditLimitAddInfo != ''  ">creditLimitAddInfo = #{creditLimitAddInfo},</if>
            <if test="creditLimitAddAnnex != null  and creditLimitAddAnnex != ''  ">creditLimitAddAnnex = #{creditLimitAddAnnex},</if>
            <if test="userId != null  ">user_id = #{userId},</if>
            <if test="orgId != null  ">org_id = #{orgId},</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag = #{delFlag},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
            <if test="updateBy != null  and updateBy != ''  ">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCreditGrantingInfoById" parameterType="Long">
        delete from credit_granting_info where id = #{id}
    </delete>

    <delete id="deleteCreditGrantingInfoByIds" parameterType="String">
        delete from credit_granting_info where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

    <select id="selectPageList"
            resultMap="CreditGrantingInfoResult">
        <include refid="selectCreditGrantingInfoVo"/>
        <where>
            <if test="orgId!= null">
               and  org_id in (SELECT dept_id FROM`org_dept` WHERE org_id=#{orgId})
            </if>
            <if test="ename != null  and ename != '' "> and ename like concat("%",#{ename},"%")</if>

            <if test="creditLimitSt != null "> and creditLimitLast <![CDATA[ >= ]]> #{creditLimitSt}</if>
            <if test="creditLimitEd != null "> and creditLimitLast <![CDATA[ <= ]]> #{creditLimitEd}</if>
            <if test="creditLv != null  and creditLv != '' "> and creditLv = #{creditLv}</if>
            <if test="creditStatus != null  and creditStatus != ''  ">
                <if test="creditStatus == '待生效'">and effectiveDate  <![CDATA[ > ]]> NOW() </if>
                <if test="creditStatus == '已失效'">and deadline  <![CDATA[ < ]]> NOW() </if>
                <if test="creditStatus == '生效中'">and effectiveDate  <![CDATA[ <= ]]> NOW() AND deadline <![CDATA[ >= ]]> NOW() </if>
            </if>
            <if test="creditTimeSt != null "> and effectiveDate <![CDATA[ >= ]]> #{creditTimeSt}</if>
            <if test="creditTimeEd != null "> and deadline <![CDATA[ <= ]]> #{creditTimeEd}</if>
        </where>
        <if test="sort !=null">
            <if test="sort == 1">order by effectiveDate desc</if>
            <if test="sort == 2">order by creditLimitLast desc</if>
            <if test="sort == 3">order by creditLimitLast asc</if>
            <if test="sort == 4">order by comprehensiveRate desc</if>
            <if test="sort == 5">order by comprehensiveRate asc</if>
        </if>
    </select>
    <select id="selectCreditGrantingInfoListApplication"
            resultMap="CreditGrantingInfoResult">
        <include refid="selectCreditGrantingInfoVo"/>
        where creditLimitAdd is not null
        <if test="ename != null  and ename != '' "> and ename like concat("%",#{ename},"%")</if>
        order by create_time desc
    </select>

</mapper>