<?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.ruoyi.system.mapper.LoanApplicationMapper">
    
    <resultMap type="LoanApplication" id="LoanApplicationResult">
        <result property="loanApplicationId"    column="loan_application_id"    />
        <result property="loanApplicationNumber"    column="loan_application_number"    />
        <result property="applicationType"    column="application_type"    />
        <result property="applicationAmount"    column="application_amount"    />
        <result property="applicationBank"    column="application_bank"    />
        <result property="usagePeriod"    column="usage_period"    />
        <result property="purposeFunds"    column="purpose_funds"    />
        <result property="repaymentSource"    column="repayment_source"    />
        <result property="enterpriseId"    column="enterprise_id"    />
        <result property="enterpriseName"    column="enterprise_name"    />
        <result property="categoryType"    column="category_type"    />
        <result property="isMake"    column="is_make"    />
        <result property="isNew"    column="is_new"    />
        <result property="isSmall"    column="is_small"    />
        <result property="isDuty"    column="is_duty"    />
        <result property="companyIntroduction"    column="company_introduction"    />
        <result property="customerType"    column="customer_type"    />
        <result property="corporationFront"    column="corporation_front"    />
        <result property="corporationBack"    column="corporation_back"    />
        <result property="corporationName"    column="corporation_name"    />
        <result property="corporationIdCard"    column="corporation_id_card"    />
        <result property="corporationPhone"    column="corporation_phone"    />
        <result property="corporationAddress"    column="corporation_address"    />
        <result property="corporationExpirationDate"    column="corporation_expiration_date"    />
        <result property="familyPopulation"    column="family_population"    />
        <result property="corporationJob"    column="corporation_job"    />
        <result property="isLoan"    column="is_loan"    />
        <result property="receivablePay"    column="receivable_pay"    />
        <result property="businessSituation"    column="business_situation"    />
        <result property="businessEfficiency"    column="business_efficiency"    />
        <result property="corporationMaritalStatus"    column="corporation_marital_status"    />
        <result property="spouseFront"    column="spouse_front"    />
        <result property="spouseBack"    column="spouse_back"    />
        <result property="spouseName"    column="spouse_name"    />
        <result property="spouseIdCard"    column="spouse_id_card"    />
        <result property="spousePhone"    column="spouse_phone"    />
        <result property="guaranteeType"    column="guarantee_type"    />
        <result property="guaranteeFront"    column="guarantee_front"    />
        <result property="guaranteeBack"    column="guarantee_back"    />
        <result property="guaranteeName"    column="guarantee_name"    />
        <result property="guaranteeIdCard"    column="guarantee_id_card"    />
        <result property="guaranteePhone"    column="guarantee_phone"    />
        <result property="guaranteeMaritalStatus"    column="guarantee_marital_status"    />
        <result property="guaranteeSpouseFront"    column="guarantee_spouse_front"    />
        <result property="guaranteeSpouseBack"    column="guarantee_spouse_back"    />
        <result property="guaranteeSpouseName"    column="guarantee_spouse_name"    />
        <result property="guaranteeSpouseIdCard"    column="guarantee_spouse_id_card"    />
        <result property="guaranteeSpousePhone"    column="guarantee_spouse_phone"    />
        <result property="userId"    column="user_id"    />
        <result property="idCard"    column="id_card"    />
        <result property="applicationTime"    column="application_time"    />
        <result property="fileTime"    column="file_time"    />
        <result property="loanSchedule"    column="loan_schedule"    />
        <result property="auditSchedule"    column="audit_schedule"    />
        <result property="auditType"    column="audit_type"    />
        <result property="loanApplicationType"    column="loan_application_type"    />
        <result property="aUserId"    column="a_user_id"    />
        <result property="aUserName"    column="a_user_name"    />
        <result property="bUserId"    column="b_user_id"    />
        <result property="bUserName"    column="b_user_name"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectLoanApplicationVo">
        select loan_application_id, loan_application_number, application_type,application_amount,enterprise_id, application_bank, usage_period, purpose_funds, repayment_source, enterprise_name, category_type, is_make, is_new, is_small, is_duty, company_introduction, customer_type, corporation_front, corporation_back, corporation_name, corporation_id_card, corporation_phone,corporation_address,corporation_expiration_date, family_population, corporation_job, is_loan, receivable_pay, business_situation, business_efficiency, corporation_marital_status, spouse_front, spouse_back, spouse_name, spouse_id_card, spouse_phone, guarantee_type, guarantee_front, guarantee_back, guarantee_name, guarantee_id_card, guarantee_phone, guarantee_marital_status, guarantee_spouse_front, guarantee_spouse_back, guarantee_spouse_name, guarantee_spouse_id_card, guarantee_spouse_phone, user_id, id_card, application_time, file_time, loan_schedule, audit_schedule, audit_type, loan_application_type, a_user_id, a_user_name, b_user_id, b_user_name, create_by, create_time, update_by, update_time, remark from loan_application
    </sql>

    <select id="selectLoanApplicationList" parameterType="LoanApplication" resultMap="LoanApplicationResult">
        <include refid="selectLoanApplicationVo"/>
        <where>  
            <if test="applicationAmount != null "> and application_amount = #{applicationAmount}</if>
            <if test="applicationType != null and applicationType != ''"> and application_type = #{applicationType}</if>
            <if test="applicationBank != null  and applicationBank != ''"> and application_bank = #{applicationBank}</if>
            <if test="usagePeriod != null  and usagePeriod != ''"> and usage_period = #{usagePeriod}</if>
            <if test="purposeFunds != null  and purposeFunds != ''"> and purpose_funds = #{purposeFunds}</if>
            <if test="repaymentSource != null  and repaymentSource != ''"> and repayment_source = #{repaymentSource}</if>
            <if test="enterpriseName != null  and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
            <if test="categoryType != null  and categoryType != ''"> and category_type = #{categoryType}</if>
            <if test="isMake != null  and isMake != ''"> and is_make = #{isMake}</if>
            <if test="isNew != null  and isNew != ''"> and is_new = #{isNew}</if>
            <if test="isSmall != null  and isSmall != ''"> and is_small = #{isSmall}</if>
            <if test="isDuty != null  and isDuty != ''"> and is_duty = #{isDuty}</if>
            <if test="companyIntroduction != null  and companyIntroduction != ''"> and company_introduction = #{companyIntroduction}</if>
            <if test="customerType != null  and customerType != ''"> and customer_type = #{customerType}</if>
            <if test="corporationFront != null  and corporationFront != ''"> and corporation_front = #{corporationFront}</if>
            <if test="corporationBack != null  and corporationBack != ''"> and corporation_back = #{corporationBack}</if>
            <if test="corporationName != null  and corporationName != ''"> and corporation_name like concat('%', #{corporationName}, '%')</if>
            <if test="corporationIdCard != null  and corporationIdCard != ''"> and corporation_id_card = #{corporationIdCard}</if>
            <if test="corporationPhone != null  and corporationPhone != ''"> and corporation_phone = #{corporationPhone}</if>
            <if test="familyPopulation != null  and familyPopulation != ''"> and family_population = #{familyPopulation}</if>
            <if test="corporationJob != null  and corporationJob != ''"> and corporation_job = #{corporationJob}</if>
            <if test="isLoan != null  and isLoan != ''"> and is_loan = #{isLoan}</if>
            <if test="receivablePay != null  and receivablePay != ''"> and receivable_pay = #{receivablePay}</if>
            <if test="businessSituation != null  and businessSituation != ''"> and business_situation = #{businessSituation}</if>
            <if test="businessEfficiency != null  and businessEfficiency != ''"> and business_efficiency = #{businessEfficiency}</if>
            <if test="corporationMaritalStatus != null  and corporationMaritalStatus != ''"> and corporation_marital_status = #{corporationMaritalStatus}</if>
            <if test="spouseFront != null  and spouseFront != ''"> and spouse_front = #{spouseFront}</if>
            <if test="spouseBack != null  and spouseBack != ''"> and spouse_back = #{spouseBack}</if>
            <if test="spouseName != null  and spouseName != ''"> and spouse_name like concat('%', #{spouseName}, '%')</if>
            <if test="spouseIdCard != null  and spouseIdCard != ''"> and spouse_id_card = #{spouseIdCard}</if>
            <if test="spousePhone != null  and spousePhone != ''"> and spouse_phone = #{spousePhone}</if>
            <if test="guaranteeType != null  and guaranteeType != ''"> and guarantee_type = #{guaranteeType}</if>
            <if test="guaranteeFront != null  and guaranteeFront != ''"> and guarantee_front = #{guaranteeFront}</if>
            <if test="guaranteeBack != null  and guaranteeBack != ''"> and guarantee_back = #{guaranteeBack}</if>
            <if test="guaranteeName != null  and guaranteeName != ''"> and guarantee_name like concat('%', #{guaranteeName}, '%')</if>
            <if test="guaranteeIdCard != null  and guaranteeIdCard != ''"> and guarantee_id_card = #{guaranteeIdCard}</if>
            <if test="guaranteePhone != null  and guaranteePhone != ''"> and guarantee_phone = #{guaranteePhone}</if>
            <if test="guaranteeMaritalStatus != null  and guaranteeMaritalStatus != ''"> and guarantee_marital_status = #{guaranteeMaritalStatus}</if>
            <if test="guaranteeSpouseFront != null  and guaranteeSpouseFront != ''"> and guarantee_spouse_front = #{guaranteeSpouseFront}</if>
            <if test="guaranteeSpouseBack != null  and guaranteeSpouseBack != ''"> and guarantee_spouse_back = #{guaranteeSpouseBack}</if>
            <if test="guaranteeSpouseName != null  and guaranteeSpouseName != ''"> and guarantee_spouse_name like concat('%', #{guaranteeSpouseName}, '%')</if>
            <if test="guaranteeSpouseIdCard != null  and guaranteeSpouseIdCard != ''"> and guarantee_spouse_id_card = #{guaranteeSpouseIdCard}</if>
            <if test="guaranteeSpousePhone != null  and guaranteeSpousePhone != ''"> and guarantee_spouse_phone = #{guaranteeSpousePhone}</if>
            <if test="idCard != null  and idCard != ''"> and id_card = #{idCard}</if>
            <if test="applicationTime != null ">AND date_format(application_time,'%Y%m%d') &gt;= date_format(#{applicationTime},'%Y%m%d')</if>
            <if test="fileTime != null "> and file_time = #{fileTime}</if>
            <if test="loanSchedule != null  and loanSchedule != ''"> and loan_schedule = #{loanSchedule}</if>
            <if test="auditSchedule != null  and auditSchedule != ''"> and audit_schedule = #{auditSchedule}</if>
            <if test="auditType != null  and auditType != ''"> and audit_type = #{auditType}</if>
            <if test="loanApplicationType != null  and loanApplicationType != ''"> and loan_application_type = #{loanApplicationType}</if>
            <if test="userId != null "> and (a_user_id = #{userId} or (b_user_id = #{userId} and audit_schedule = '3') or  user_id = #{userId})</if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
                AND date_format(create_time,'%Y') = #{params.beginTime}
            </if>
        </where>
        order by create_time DESC
    </select>

    <select id="selectLoanApplicationListStatistics" parameterType="LoanApplication" resultMap="LoanApplicationResult">
        <include refid="selectLoanApplicationVo"/>
        <where>
            <if test="type != null and type == '1'.toString()"><!-- 开始时间检索 -->
                AND date_format(application_time,'%Y') = #{params.beginTime}
            </if>
            <if test="type != null and type == '2'.toString()"><!-- 开始时间检索 -->
                AND date_format(application_time,'%Y%m') = #{params.beginTime}
            </if>
        </where>
    </select>
    
    <select id="selectLoanApplicationByLoanApplicationId" parameterType="Long" resultMap="LoanApplicationResult">
        <include refid="selectLoanApplicationVo"/>
        where loan_application_id = #{loanApplicationId}
    </select>
        
    <insert id="insertLoanApplication" parameterType="LoanApplication" useGeneratedKeys="true" keyProperty="loanApplicationId">
        insert into loan_application
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="loanApplicationNumber != null">loan_application_number,</if>
            <if test="applicationType  != null and applicationType != ''">application_type,</if>
            <if test="applicationAmount != null">application_amount,</if>
            <if test="applicationBank != null and applicationBank != ''">application_bank,</if>
            <if test="usagePeriod != null and usagePeriod != ''">usage_period,</if>
            <if test="purposeFunds != null and purposeFunds != ''">purpose_funds,</if>
            <if test="repaymentSource != null and repaymentSource != ''">repayment_source,</if>
            <if test="enterpriseId != null and enterpriseId != ''">enterprise_id,</if>
            <if test="enterpriseName != null and enterpriseName != ''">enterprise_name,</if>
            <if test="categoryType != null and categoryType != ''">category_type,</if>
            <if test="isMake != null">is_make,</if>
            <if test="isNew != null">is_new,</if>
            <if test="isSmall != null">is_small,</if>
            <if test="isDuty != null">is_duty,</if>
            <if test="companyIntroduction != null">company_introduction,</if>
            <if test="customerType != null and customerType != ''">customer_type,</if>
            <if test="corporationFront != null and corporationFront != ''">corporation_front,</if>
            <if test="corporationBack != null and corporationBack != ''">corporation_back,</if>
            <if test="corporationName != null and corporationName != ''">corporation_name,</if>
            <if test="corporationIdCard != null and corporationIdCard != ''">corporation_id_card,</if>
            <if test="corporationPhone != null and corporationPhone != ''">corporation_phone,</if>
            <if test="corporationAddress != null and corporationAddress != ''">corporation_address,</if>
            <if test="corporationExpirationDate != null and corporationExpirationDate != ''">corporation_expiration_date,</if>
            <if test="familyPopulation != null and familyPopulation != ''">family_population,</if>
            <if test="corporationJob != null and corporationJob != ''">corporation_job,</if>
            <if test="isLoan != null">is_loan,</if>
            <if test="receivablePay != null">receivable_pay,</if>
            <if test="businessSituation != null">business_situation,</if>
            <if test="businessEfficiency != null">business_efficiency,</if>
            <if test="corporationMaritalStatus != null">corporation_marital_status,</if>
            <if test="spouseFront != null and spouseFront != ''">spouse_front,</if>
            <if test="spouseBack != null and spouseBack != ''">spouse_back,</if>
            <if test="spouseName != null and spouseName != ''">spouse_name,</if>
            <if test="spouseIdCard != null and spouseIdCard != ''">spouse_id_card,</if>
            <if test="spousePhone != null and spousePhone != ''">spouse_phone,</if>
            <if test="guaranteeType != null and guaranteeType != ''">guarantee_type,</if>
            <if test="guaranteeFront != null and guaranteeFront != ''">guarantee_front,</if>
            <if test="guaranteeBack != null and guaranteeBack != ''">guarantee_back,</if>
            <if test="guaranteeName != null and guaranteeName != ''">guarantee_name,</if>
            <if test="guaranteeIdCard != null and guaranteeIdCard != ''">guarantee_id_card,</if>
            <if test="guaranteePhone != null and guaranteePhone != ''">guarantee_phone,</if>
            <if test="guaranteeMaritalStatus != null">guarantee_marital_status,</if>
            <if test="guaranteeSpouseFront != null and guaranteeSpouseFront != ''">guarantee_spouse_front,</if>
            <if test="guaranteeSpouseBack != null and guaranteeSpouseBack != ''">guarantee_spouse_back,</if>
            <if test="guaranteeSpouseName != null and guaranteeSpouseName != ''">guarantee_spouse_name,</if>
            <if test="guaranteeSpouseIdCard != null and guaranteeSpouseIdCard != ''">guarantee_spouse_id_card,</if>
            <if test="guaranteeSpousePhone != null and guaranteeSpousePhone != ''">guarantee_spouse_phone,</if>
            <if test="userId != null">user_id,</if>
            <if test="idCard != null">id_card,</if>
            <if test="applicationTime != null">application_time,</if>
            <if test="fileTime != null">file_time,</if>
            <if test="loanSchedule != null and loanSchedule != ''">loan_schedule,</if>
            <if test="auditSchedule != null and auditSchedule != ''">audit_schedule,</if>
            <if test="auditType != null and auditType != ''">audit_type,</if>
            <if test="loanApplicationType != null and loanApplicationType != ''">loan_application_type,</if>
            <if test="aUserId != null">a_user_id,</if>
            <if test="aUserName != null">a_user_name,</if>
            <if test="bUserId != null">b_user_id,</if>
            <if test="bUserName != null">b_user_name,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            create_time
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="loanApplicationNumber != null">#{loanApplicationNumber},</if>
            <if test="applicationType != null and applicationType != ''">#{applicationType},</if>
            <if test="applicationAmount != null">#{applicationAmount},</if>
            <if test="applicationBank != null and applicationBank != ''">#{applicationBank},</if>
            <if test="usagePeriod != null and usagePeriod != ''">#{usagePeriod},</if>
            <if test="purposeFunds != null and purposeFunds != ''">#{purposeFunds},</if>
            <if test="repaymentSource != null and repaymentSource != ''">#{repaymentSource},</if>
            <if test="enterpriseId != null and enterpriseId != ''">#{enterpriseId},</if>
            <if test="enterpriseName != null and enterpriseName != ''">#{enterpriseName},</if>
            <if test="categoryType != null and categoryType != ''">#{categoryType},</if>
            <if test="isMake != null">#{isMake},</if>
            <if test="isNew != null">#{isNew},</if>
            <if test="isSmall != null">#{isSmall},</if>
            <if test="isDuty != null">#{isDuty},</if>
            <if test="companyIntroduction != null">#{companyIntroduction},</if>
            <if test="customerType != null and customerType != ''">#{customerType},</if>
            <if test="corporationFront != null and corporationFront != ''">#{corporationFront},</if>
            <if test="corporationBack != null and corporationBack != ''">#{corporationBack},</if>
            <if test="corporationName != null and corporationName != ''">#{corporationName},</if>
            <if test="corporationIdCard != null and corporationIdCard != ''">#{corporationIdCard},</if>
            <if test="corporationPhone != null and corporationPhone != ''">#{corporationPhone},</if>
            <if test="corporationAddress != null and corporationAddress != ''">#{corporationAddress},</if>
            <if test="corporationExpirationDate != null and corporationExpirationDate != ''">#{corporationExpirationDate},</if>
            <if test="familyPopulation != null and familyPopulation != ''">#{familyPopulation},</if>
            <if test="corporationJob != null and corporationJob != ''">#{corporationJob},</if>
            <if test="isLoan != null">#{isLoan},</if>
            <if test="receivablePay != null">#{receivablePay},</if>
            <if test="businessSituation != null">#{businessSituation},</if>
            <if test="businessEfficiency != null">#{businessEfficiency},</if>
            <if test="corporationMaritalStatus != null">#{corporationMaritalStatus},</if>
            <if test="spouseFront != null and spouseFront != ''">#{spouseFront},</if>
            <if test="spouseBack != null and spouseBack != ''">#{spouseBack},</if>
            <if test="spouseName != null and spouseName != ''">#{spouseName},</if>
            <if test="spouseIdCard != null and spouseIdCard != ''">#{spouseIdCard},</if>
            <if test="spousePhone != null and spousePhone != ''">#{spousePhone},</if>
            <if test="guaranteeType != null and guaranteeType != ''">#{guaranteeType},</if>
            <if test="guaranteeFront != null and guaranteeFront != ''">#{guaranteeFront},</if>
            <if test="guaranteeBack != null and guaranteeBack != ''">#{guaranteeBack},</if>
            <if test="guaranteeName != null and guaranteeName != ''">#{guaranteeName},</if>
            <if test="guaranteeIdCard != null and guaranteeIdCard != ''">#{guaranteeIdCard},</if>
            <if test="guaranteePhone != null and guaranteePhone != ''">#{guaranteePhone},</if>
            <if test="guaranteeMaritalStatus != null">#{guaranteeMaritalStatus},</if>
            <if test="guaranteeSpouseFront != null and guaranteeSpouseFront != ''">#{guaranteeSpouseFront},</if>
            <if test="guaranteeSpouseBack != null and guaranteeSpouseBack != ''">#{guaranteeSpouseBack},</if>
            <if test="guaranteeSpouseName != null and guaranteeSpouseName != ''">#{guaranteeSpouseName},</if>
            <if test="guaranteeSpouseIdCard != null and guaranteeSpouseIdCard != ''">#{guaranteeSpouseIdCard},</if>
            <if test="guaranteeSpousePhone != null and guaranteeSpousePhone != ''">#{guaranteeSpousePhone},</if>
            <if test="userId != null">#{userId},</if>
            <if test="idCard != null">#{idCard},</if>
            <if test="applicationTime != null">#{applicationTime},</if>
            <if test="fileTime != null">#{fileTime},</if>
            <if test="loanSchedule != null and loanSchedule != ''">#{loanSchedule},</if>
            <if test="auditSchedule != null and auditSchedule != ''">#{auditSchedule},</if>
            <if test="auditType != null and auditType != ''">#{auditType},</if>
            <if test="loanApplicationType != null and loanApplicationType != ''">#{loanApplicationType},</if>
            <if test="aUserId != null">#{aUserId},</if>
            <if test="aUserName != null">#{aUserName},</if>
            <if test="bUserId != null">#{bUserId},</if>
            <if test="bUserName != null">#{bUserName},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            sysdate()
         </trim>
    </insert>

    <update id="updateLoanApplication" parameterType="LoanApplication">
        update loan_application
        <trim prefix="SET" suffixOverrides=",">
            <if test="loanApplicationNumber != null">loan_application_number = #{loanApplicationNumber},</if>
            <if test="applicationType != null and applicationType != ''">application_type = #{applicationType},</if>
            <if test="applicationAmount != null">application_amount = #{applicationAmount},</if>
            <if test="applicationBank != null and applicationBank != ''">application_bank = #{applicationBank},</if>
            <if test="usagePeriod != null and usagePeriod != ''">usage_period = #{usagePeriod},</if>
            <if test="purposeFunds != null and purposeFunds != ''">purpose_funds = #{purposeFunds},</if>
            <if test="repaymentSource != null and repaymentSource != ''">repayment_source = #{repaymentSource},</if>
            <if test="enterpriseId != null and enterpriseId != ''">enterprise_id = #{enterpriseId},</if>
            <if test="enterpriseName != null and enterpriseName != ''">enterprise_name = #{enterpriseName},</if>
            <if test="categoryType != null and categoryType != ''">category_type = #{categoryType},</if>
            <if test="isMake != null">is_make = #{isMake},</if>
            <if test="isNew != null">is_new = #{isNew},</if>
            <if test="isSmall != null">is_small = #{isSmall},</if>
            <if test="isDuty != null">is_duty = #{isDuty},</if>
            <if test="companyIntroduction != null">company_introduction = #{companyIntroduction},</if>
            <if test="customerType != null and customerType != ''">customer_type = #{customerType},</if>
            <if test="corporationFront != null and corporationFront != ''">corporation_front = #{corporationFront},</if>
            <if test="corporationBack != null and corporationBack != ''">corporation_back = #{corporationBack},</if>
            <if test="corporationName != null and corporationName != ''">corporation_name = #{corporationName},</if>
            <if test="corporationIdCard != null and corporationIdCard != ''">corporation_id_card = #{corporationIdCard},</if>
            <if test="corporationPhone != null and corporationPhone != ''">corporation_phone = #{corporationPhone},</if>
            <if test="corporationAddress != null and corporationAddress != ''">corporation_address = #{corporationAddress},</if>
            <if test="corporationExpirationDate != null and corporationExpirationDate != ''">corporation_expiration_date = #{corporationExpirationDate},</if>
            <if test="familyPopulation != null and familyPopulation != ''">family_population = #{familyPopulation},</if>
            <if test="corporationJob != null and corporationJob != ''">corporation_job = #{corporationJob},</if>
            <if test="isLoan != null">is_loan = #{isLoan},</if>
            <if test="receivablePay != null">receivable_pay = #{receivablePay},</if>
            <if test="businessSituation != null">business_situation = #{businessSituation},</if>
            <if test="businessEfficiency != null">business_efficiency = #{businessEfficiency},</if>
            <if test="corporationMaritalStatus != null">corporation_marital_status = #{corporationMaritalStatus},</if>
            <if test="spouseFront != null and spouseFront != ''">spouse_front = #{spouseFront},</if>
            <if test="spouseBack != null and spouseBack != ''">spouse_back = #{spouseBack},</if>
            <if test="spouseName != null and spouseName != ''">spouse_name = #{spouseName},</if>
            <if test="spouseIdCard != null and spouseIdCard != ''">spouse_id_card = #{spouseIdCard},</if>
            <if test="spousePhone != null and spousePhone != ''">spouse_phone = #{spousePhone},</if>
            <if test="guaranteeType != null and guaranteeType != ''">guarantee_type = #{guaranteeType},</if>
            <if test="guaranteeFront != null and guaranteeFront != ''">guarantee_front = #{guaranteeFront},</if>
            <if test="guaranteeBack != null and guaranteeBack != ''">guarantee_back = #{guaranteeBack},</if>
            <if test="guaranteeName != null and guaranteeName != ''">guarantee_name = #{guaranteeName},</if>
            <if test="guaranteeIdCard != null and guaranteeIdCard != ''">guarantee_id_card = #{guaranteeIdCard},</if>
            <if test="guaranteePhone != null and guaranteePhone != ''">guarantee_phone = #{guaranteePhone},</if>
            <if test="guaranteeMaritalStatus != null">guarantee_marital_status = #{guaranteeMaritalStatus},</if>
            <if test="guaranteeSpouseFront != null and guaranteeSpouseFront != ''">guarantee_spouse_front = #{guaranteeSpouseFront},</if>
            <if test="guaranteeSpouseBack != null and guaranteeSpouseBack != ''">guarantee_spouse_back = #{guaranteeSpouseBack},</if>
            <if test="guaranteeSpouseName != null and guaranteeSpouseName != ''">guarantee_spouse_name = #{guaranteeSpouseName},</if>
            <if test="guaranteeSpouseIdCard != null and guaranteeSpouseIdCard != ''">guarantee_spouse_id_card = #{guaranteeSpouseIdCard},</if>
            <if test="guaranteeSpousePhone != null and guaranteeSpousePhone != ''">guarantee_spouse_phone = #{guaranteeSpousePhone},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="idCard != null">id_card = #{idCard},</if>
            <if test="applicationTime != null">application_time = #{applicationTime},</if>
            <if test="fileTime != null">file_time = #{fileTime},</if>
            <if test="loanSchedule != null and loanSchedule != ''">loan_schedule = #{loanSchedule},</if>
            <if test="auditSchedule != null and auditSchedule != ''">audit_schedule = #{auditSchedule},</if>
            <if test="auditType != null and auditType != ''">audit_type = #{auditType},</if>
            <if test="loanApplicationType != null and loanApplicationType != ''">loan_application_type = #{loanApplicationType},</if>
            <if test="aUserId != null">a_user_id = #{aUserId},</if>
            <if test="aUserName != null">a_user_name = #{aUserName},</if>
            <if test="bUserId != null">b_user_id = #{bUserId},</if>
            <if test="bUserName != null">b_user_name = #{bUserName},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="remark != null">remark = #{remark},</if>
            update_time = sysdate(),
        </trim>
        where loan_application_id = #{loanApplicationId}
    </update>

    <delete id="deleteLoanApplicationByLoanApplicationId" parameterType="Long">
        delete from loan_application where loan_application_id = #{loanApplicationId}
    </delete>

    <delete id="deleteLoanApplicationByLoanApplicationIds" parameterType="String">
        delete from loan_application where loan_application_id in 
        <foreach item="loanApplicationId" collection="array" open="(" separator="," close=")">
            #{loanApplicationId}
        </foreach>
    </delete>
</mapper>