<?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.cool.store.mapper.QualificationsInfoMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.QualificationsInfoDO">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="audit_id" jdbcType="BIGINT" property="auditId" />
    <result column="partner_id" jdbcType="VARCHAR" property="partnerId" />
    <result column="line_id" jdbcType="BIGINT" property="lineId" />
    <result column="join_type" jdbcType="BIT" property="joinType" />
    <result column="id_card_no" jdbcType="VARCHAR" property="idCardNo" />
    <result column="front_of_id_card" jdbcType="VARCHAR" property="frontOfIdCard" />
    <result column="back_of_id_card" jdbcType="VARCHAR" property="backOfIdCard" />
    <result column="marital_status" jdbcType="BIT" property="maritalStatus" />
    <result column="education_level" jdbcType="BIT" property="educationLevel" />
    <result column="household_registration_address" jdbcType="VARCHAR" property="householdRegistrationAddress" />
    <result column="settlement_card_no" jdbcType="VARCHAR" property="settlementCardNo" />
    <result column="settlement_opening_bank" jdbcType="VARCHAR" property="settlementOpeningBank" />
    <result column="settlement_card_pic" jdbcType="VARCHAR" property="settlementCardPic" />
    <result column="entrepreneurial_experience" jdbcType="BIT" property="entrepreneurialExperience" />
    <result column="previously_engaged_industries" jdbcType="VARCHAR" property="previouslyEngagedIndustries" />
    <result column="bank_statements_pic" jdbcType="VARCHAR" property="bankStatementsPic" />
    <result column="old_brands" jdbcType="VARCHAR" property="oldBrands" />
    <result column="new_brands" jdbcType="VARCHAR" property="newBrands" />
    <result column="enterprise_name" jdbcType="VARCHAR" property="enterpriseName" />
    <result column="company_registered_address" jdbcType="VARCHAR" property="companyRegisteredAddress" />
    <result column="office_address" jdbcType="VARCHAR" property="officeAddress" />
    <result column="legal_name" jdbcType="VARCHAR" property="legalName" />
    <result column="legal_id_card_no" jdbcType="VARCHAR" property="legalIdCardNo" />
    <result column="legal_id_card_front" jdbcType="VARCHAR" property="legalIdCardFront" />
    <result column="legal_id_card_back" jdbcType="VARCHAR" property="legalIdCardBack" />
    <result column="business_leader_name" jdbcType="VARCHAR" property="businessLeaderName" />
    <result column="business_leader_mobile" jdbcType="VARCHAR" property="businessLeaderMobile" />
    <result column="financial_manager_name" jdbcType="VARCHAR" property="financialManagerName" />
    <result column="financial_manager_mobile" jdbcType="VARCHAR" property="financialManagerMobile" />
    <result column="business_license" jdbcType="VARCHAR" property="businessLicense" />
    <result column="unified_social_credit_code" jdbcType="VARCHAR" property="unifiedSocialCreditCode" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
  </resultMap>

  <insert id="insertOrUpdate" keyProperty="id" parameterType="com.cool.store.entity.QualificationsInfoDO" useGeneratedKeys="true">
    INSERT INTO xfsg_qualifications_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="request.auditId != null">audit_id,</if>
      <if test="request.partnerId != null">partner_id,</if>
      <if test="request.lineId != null">line_id,</if>
      <if test="request.joinType != null">join_type,</if>
      <if test="request.idCardNo != null">id_card_no,</if>
      <if test="request.frontOfIdCard != null">front_of_id_card,</if>
      <if test="request.backOfIdCard != null">back_of_id_card,</if>
      <if test="request.maritalStatus != null">marital_status,</if>
      <if test="request.educationLevel != null">education_level,</if>
      <if test="request.householdRegistrationAddress != null">household_registration_address,</if>
      <if test="request.settlementCardNo != null">settlement_card_no,</if>
      <if test="request.settlementOpeningBank != null">settlement_opening_bank,</if>
      <if test="request.settlementCardPic != null">settlement_card_pic,</if>
      <if test="request.entrepreneurialExperience != null">entrepreneurial_experience,</if>
      <if test="request.previouslyEngagedIndustries != null">previously_engaged_industries,</if>
      <if test="request.bankStatementsPic != null">bank_statements_pic,</if>
      <if test="request.oldBrands != null">old_brands,</if>
      <if test="request.newBrands != null">new_brands,</if>
      <if test="request.enterpriseName != null">enterprise_name,</if>
      <if test="request.companyRegisteredAddress != null">company_registered_address,</if>
      <if test="request.officeAddress != null">office_address,</if>
      <if test="request.legalName != null">legal_name,</if>
      <if test="request.legalMobile != null">legal_mobile,</if>
      <if test="request.legalIdCardNo != null">legal_id_card_no,</if>
      <if test="request.legalIdCardFront != null">legal_id_card_front,</if>
      <if test="request.legalIdCardBack != null">legal_id_card_back,</if>
      <if test="request.businessLeaderName != null">business_leader_name,</if>
      <if test="request.businessLeaderMobile != null">business_leader_mobile,</if>
      <if test="request.financialManagerName != null">financial_manager_name,</if>
      <if test="request.financialManagerMobile != null">financial_manager_mobile,</if>
      <if test="request.businessLicense != null">business_license,</if>
      <if test="request.unifiedSocialCreditCode != null">unified_social_credit_code,</if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="request.auditId != null">#{request.auditId},</if>
      <if test="request.partnerId != null">#{request.partnerId},</if>
      <if test="request.lineId != null">#{request.lineId},</if>
      <if test="request.joinType != null">#{request.joinType},</if>
      <if test="request.idCardNo != null">#{request.idCardNo},</if>
      <if test="request.frontOfIdCard != null">#{request.frontOfIdCard},</if>
      <if test="request.backOfIdCard != null">#{request.backOfIdCard},</if>
      <if test="request.maritalStatus != null">#{request.maritalStatus},</if>
      <if test="request.educationLevel != null">#{request.educationLevel},</if>
      <if test="request.householdRegistrationAddress != null">#{request.householdRegistrationAddress},</if>
      <if test="request.settlementCardNo != null">#{request.settlementCardNo},</if>
      <if test="request.settlementOpeningBank != null">#{request.settlementOpeningBank},</if>
      <if test="request.settlementCardPic != null">#{request.settlementCardPic},</if>
      <if test="request.entrepreneurialExperience != null">#{request.entrepreneurialExperience},</if>
      <if test="request.previouslyEngagedIndustries != null">#{request.previouslyEngagedIndustries},</if>
      <if test="request.bankStatementsPic != null">#{request.bankStatementsPic},</if>
      <if test="request.oldBrands != null">#{request.oldBrands},</if>
      <if test="request.newBrands != null">#{request.newBrands},</if>
      <if test="request.enterpriseName != null">#{request.enterpriseName},</if>
      <if test="request.companyRegisteredAddress != null">#{request.companyRegisteredAddress},</if>
      <if test="request.officeAddress != null">#{request.officeAddress},</if>
      <if test="request.legalName != null">#{request.legalName},</if>
      <if test="request.legalMobile != null">#{request.legalMobile},</if>
      <if test="request.legalIdCardNo != null">#{request.legalIdCardNo},</if>
      <if test="request.legalIdCardFront != null">#{request.legalIdCardFront},</if>
      <if test="request.legalIdCardBack != null">#{request.legalIdCardBack},</if>
      <if test="request.businessLeaderName != null">#{request.businessLeaderName},</if>
      <if test="request.businessLeaderMobile != null">#{request.businessLeaderMobile},</if>
      <if test="request.financialManagerName != null">#{request.financialManagerName},</if>
      <if test="request.financialManagerMobile != null">#{request.financialManagerMobile},</if>
      <if test="request.businessLicense != null">#{request.businessLicense},</if>
      <if test="request.unifiedSocialCreditCode != null">#{request.unifiedSocialCreditCode},</if>
    </trim>
    ON DUPLICATE KEY UPDATE
    <trim suffixOverrides=",">
      <if test="request.auditId != null">audit_id = #{request.auditId},</if>
      <if test="request.partnerId != null">partner_id = #{request.partnerId},</if>
      <if test="request.lineId != null">line_id = #{request.lineId},</if>
      <if test="request.joinType != null">join_type = #{request.joinType},</if>
      <if test="request.idCardNo != null">id_card_no = #{request.idCardNo},</if>
      <if test="request.frontOfIdCard != null">front_of_id_card = #{request.frontOfIdCard},</if>
      <if test="request.backOfIdCard != null">back_of_id_card = #{request.backOfIdCard},</if>
      <if test="request.maritalStatus != null">marital_status = #{request.maritalStatus},</if>
      <if test="request.educationLevel != null">education_level = #{request.educationLevel},</if>
      <if test="request.householdRegistrationAddress != null">household_registration_address = #{request.householdRegistrationAddress},</if>
      <if test="request.settlementCardNo != null">settlement_card_no = #{request.settlementCardNo},</if>
      <if test="request.settlementOpeningBank != null">settlement_opening_bank = #{request.settlementOpeningBank},</if>
      <if test="request.settlementCardPic != null">settlement_card_pic = #{request.settlementCardPic},</if>
      <if test="request.entrepreneurialExperience != null">entrepreneurial_experience = #{request.entrepreneurialExperience},</if>
      <if test="request.previouslyEngagedIndustries != null">previously_engaged_industries = #{request.previouslyEngagedIndustries},</if>
      <if test="request.bankStatementsPic != null">bank_statements_pic = #{request.bankStatementsPic},</if>
      <if test="request.oldBrands != null">old_brands = #{request.oldBrands},</if>
      <if test="request.newBrands != null">new_brands = #{request.newBrands},</if>
      <if test="request.enterpriseName != null">enterprise_name = #{request.enterpriseName},</if>
      <if test="request.companyRegisteredAddress != null">company_registered_address = #{request.companyRegisteredAddress},</if>
      <if test="request.officeAddress != null">office_address = #{request.officeAddress},</if>
      <if test="request.legalName != null">legal_name = #{request.legalName},</if>
      <if test="request.legalMobile != null">legal_mobile = #{request.legalMobile},</if>
      <if test="request.legalIdCardNo != null">legal_id_card_no = #{request.legalIdCardNo},</if>
      <if test="request.legalIdCardFront != null">legal_id_card_front = #{request.legalIdCardFront},</if>
      <if test="request.legalIdCardBack != null">legal_id_card_back = #{request.legalIdCardBack},</if>
      <if test="request.businessLeaderName != null">business_leader_name = #{request.businessLeaderName},</if>
      <if test="request.businessLeaderMobile != null">business_leader_mobile = #{request.businessLeaderMobile},</if>
      <if test="request.financialManagerName != null">financial_manager_name = #{request.financialManagerName},</if>
      <if test="request.financialManagerMobile != null">financial_manager_mobile = #{request.financialManagerMobile},</if>
      <if test="request.businessLicense != null">business_license = #{request.businessLicense},</if>
      <if test="request.unifiedSocialCreditCode != null">unified_social_credit_code = #{request.unifiedSocialCreditCode},</if>
    </trim>
  </insert>

  <update id="updateAuditIdByLineId">
    update xfsg_qualifications_info
    set audit_id = #{auditId}
    where line_id = #{lineId}
  </update>

  <select id="getByLineId" resultType="com.cool.store.entity.QualificationsInfoDO">
    select
    *
    from xfsg_qualifications_info
    where line_id = #{lineId}
    and deleted = 0
  </select>







</mapper>