<?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.ccdi.mapper.CcdiEnterpriseBaseInfoMapper">

    <!-- 批量插入实体中介 -->
    <insert id="insertBatch" parameterType="java.util.List">
        INSERT INTO ccdi_enterprise_base_info (
            social_credit_code, enterprise_name, enterprise_type, enterprise_nature,
            industry_class, industry_name, establish_date, register_address,
            legal_representative, legal_cert_type, legal_cert_no,
            shareholder1, shareholder2, shareholder3, shareholder4, shareholder5,
            status, risk_level, ent_source, data_source,
            created_by, updated_by, create_time, update_time
        ) VALUES
        <foreach collection="list" item="item" separator=",">
            (
                #{item.socialCreditCode}, #{item.enterpriseName}, #{item.enterpriseType}, #{item.enterpriseNature},
                #{item.industryClass}, #{item.industryName}, #{item.establishDate}, #{item.registerAddress},
                #{item.legalRepresentative}, #{item.legalCertType}, #{item.legalCertNo},
                #{item.shareholder1}, #{item.shareholder2}, #{item.shareholder3}, #{item.shareholder4}, #{item.shareholder5},
                #{item.status}, #{item.riskLevel}, #{item.entSource}, #{item.dataSource},
                #{item.createdBy}, #{item.updatedBy}, #{item.createTime}, #{item.updateTime}
            )
        </foreach>
    </insert>

    <!-- 批量更新实体中介 -->
    <update id="updateBatch" parameterType="java.util.List">
        <foreach collection="list" item="item" separator=";">
            UPDATE ccdi_enterprise_base_info
            <set>
                <if test="item.enterpriseName != null and item.enterpriseName != ''">enterprise_name = #{item.enterpriseName},</if>
                <if test="item.enterpriseType != null">enterprise_type = #{item.enterpriseType},</if>
                <if test="item.enterpriseNature != null">enterprise_nature = #{item.enterpriseNature},</if>
                <if test="item.industryClass != null">industry_class = #{item.industryClass},</if>
                <if test="item.industryName != null">industry_name = #{item.industryName},</if>
                <if test="item.establishDate != null">establish_date = #{item.establishDate},</if>
                <if test="item.registerAddress != null">register_address = #{item.registerAddress},</if>
                <if test="item.legalRepresentative != null">legal_representative = #{item.legalRepresentative},</if>
                <if test="item.legalCertType != null">legal_cert_type = #{item.legalCertType},</if>
                <if test="item.legalCertNo != null">legal_cert_no = #{item.legalCertNo},</if>
                <if test="item.shareholder1 != null">shareholder1 = #{item.shareholder1},</if>
                <if test="item.shareholder2 != null">shareholder2 = #{item.shareholder2},</if>
                <if test="item.shareholder3 != null">shareholder3 = #{item.shareholder3},</if>
                <if test="item.shareholder4 != null">shareholder4 = #{item.shareholder4},</if>
                <if test="item.shareholder5 != null">shareholder5 = #{item.shareholder5},</if>
                <if test="item.status != null">status = #{item.status},</if>
                <if test="item.riskLevel != null">risk_level = #{item.riskLevel},</if>
                <if test="item.entSource != null">ent_source = #{item.entSource},</if>
                <if test="item.dataSource != null">data_source = #{item.dataSource},</if>
                <if test="item.updatedBy != null">updated_by = #{item.updatedBy},</if>
                update_time = #{item.updateTime}
            </set>
            WHERE social_credit_code = #{item.socialCreditCode}
        </foreach>
    </update>

</mapper>
