<?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="SPProductinfoMapper" >
    <!-- 通用查询映射结果 -->
    <select id="findAllList" parameterType="pd" resultType="pd">
        select *
        from s_gxhpz_product_info pi
        left join s_gxhpz_product_dtpinfo di on di.product_code=pi.product_code
        left join s_gxhpz_product_information pf on pf.product_code=pi.product_code
        left join s_gxhpz_product_zg zg on zg.product_code=pi.product_code
        left join s_gxhpz_product_details pd on pd.product_code=pi.product_code
        left join s_gxhpz_product_classification pc on pc.product_code=pi.product_code
        left join s_gxhpz_product_attributes pa on pa.product_code=pi.product_code
        where 1=1
        <if test="product_name != null and product_name != ''">
            and pi.product_name = #{product_name}
        </if>
        <if test="product_code != null and product_code != ''">
            and pi.product_code = #{product_code}
        </if>
    </select>

    <select id="findSPProductinfoList" parameterType="pd" resultType="pd">
        select * from (select pi.id ,
        pi.product_code,
        pi.product_name,
        pi.manufacturer,
        pi.product_status,
        pi.category_maj,
        pi.category_min,
        pi.specification,
        pi.packaging,

        pf.reference_purchase_price,
        pf.national_negotiated_price,

        pc.storage_category,

        zg.approval_number_1


        from s_gxhpz_product_info pi
        left join s_gxhpz_product_dtpinfo di on di.product_code=pi.product_code
        left join s_gxhpz_product_information pf on pf.product_code=pi.product_code
        left join s_gxhpz_product_zg zg on zg.product_code=pi.product_code
        left join s_gxhpz_product_details pd on pd.product_code=pi.product_code
        left join s_gxhpz_product_classification pc on pc.product_code=pi.product_code
        left join s_gxhpz_product_attributes pa on pa.product_code=pi.product_code
        where 1=1
        )pi where 1=1
        <if test="product_name != null and product_name != ''">
            and product_name = #{product_name}
        </if>
        <if test="product_code != null and product_code != ''">
            and product_code = #{product_code}
        </if>
        <if test="manufacturer != null and manufacturer != ''">
            and manufacturer = #{manufacturer}
        </if>
        <if test="product_status != null and product_status != ''">
            and product_status = #{product_status}
        </if>
        <if test="category_maj != null and category_maj != ''">
            and category_maj = #{category_maj}
        </if>
        <if test="category_min != null and category_min != ''">
            and category_min = #{category_min}
        </if>
        <if test="specification != null and specification != ''">
            and specification = #{specification}
        </if>
        <if test="reference_purchase_price != null and reference_purchase_price != ''">
            and reference_purchase_price = #{reference_purchase_price}
        </if>
        <if test="national_negotiated_price != null and national_negotiated_price != ''">
            and national_negotiated_price = #{national_negotiated_price}
        </if>
        <if test="storage_category != null and storage_category != ''">
            and storage_category = #{storage_category}
        </if>
        <if test="approval_number_1 != null and approval_number_1 != ''">
            and approval_number_1 = #{approval_number_1}
        </if>

    </select>
    <select id="findSPProductinfoListBYProductCode" parameterType="pd" resultType="pd">
        select * from s_gxhpz_product_info where 1=1

        <if test="product_code != null and product_code != ''">
            and product_code = #{product_code}
        </if>
    </select>

    <update id="updateSSpglJfspProductinfo" parameterType="pd" >
        update s_gxhpz_product_info
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
            <if test="product_name != null and product_name != ''">
                and product_name = #{product_name}
            </if>
            <if test="product_code != null and product_code != ''">
                and product_code = #{product_code}
            </if>
            <if test="mnemonic_code != null and mnemonic_code != ''">
                and mnemonic_code = #{mnemonic_code}
            </if>
            <if test="product_description != null and product_description != ''">
                and product_description = #{product_description}
            </if>
            <if test="generic_name != null and generic_name != ''">
                and generic_name = #{generic_name}
            </if>
            <if test="generic_mnemonic_code != null and generic_mnemonic_code != ''">
                and generic_mnemonic_code = #{generic_mnemonic_code}
            </if>
            <if test="generic_previous_names != null and generic_previous_names != ''">
                and generic_previous_names = #{generic_previous_names}
            </if>
            <if test="base_unit != null and base_unit != ''">
                and base_unit = #{base_unit}
            </if>
            <if test="trademark != null and trademark != ''">
                and trademark = #{trademark}
            </if>
            <if test="specification != null and specification != ''">
                and specification = #{specification}
            </if>
            <if test="international_barcode != null and international_barcode != ''">
                and international_barcode = #{international_barcode}
            </if>
            <if test="manufacturer != null and manufacturer != ''">
                and manufacturer = #{manufacturer}
            </if>
            <if test="entrusted_manufacturer != null and entrusted_manufacturer != ''">
                and entrusted_manufacturer = #{entrusted_manufacturer}
            </if>
            <if test="manufacturer_abbreviation != null and manufacturer_abbreviation != ''">
                and manufacturer_abbreviation = #{manufacturer_abbreviation}
            </if>
            <if test="origin != null and origin != ''">
                and origin = #{origin}
            </if>
            <if test="category_maj != null and category_maj != ''">
                and category_maj = #{category_maj}
            </if>
            <if test="category_min != null and category_min != ''">
                and category_min = #{category_min}
            </if>
            <if test="product_type != null and product_type != ''">
                and product_type = #{product_type}
            </if>
            <if test="product_status != null and product_status != ''">
                and product_status = #{product_status}
            </if>
            <if test="purchase_tax_rate != null and purchase_tax_rate != ''">
                and purchase_tax_rate = #{purchase_tax_rate}
            </if>
            <if test="sales_tax_rate != null and sales_tax_rate != ''">
                and sales_tax_rate = #{sales_tax_rate}
            </if>
            <if test="import_export_status != null and import_export_status != ''">
                and import_export_status = #{import_export_status}
            </if>
            <if test="major_category != null and major_category != ''">
                and major_category = #{major_category}
            </if>
            <if test="medium_category != null and medium_category != ''">
                and medium_category = #{medium_category}
            </if>
            <if test="minor_category != null and minor_category != ''">
                and minor_category = #{minor_category}
            </if>
            <if test="sub_category != null and sub_category != ''">
                and sub_category = #{sub_category}
            </if>
            <if test="ingredients != null and ingredients != ''">
                and ingredients = #{ingredients}
            </if>
            <if test="dtp_flag != null and dtp_flag != ''">
                and dtp_flag = #{dtp_flag}
            </if>
            <if test="daily_standard_consumption != null and daily_standard_consumption != ''">
                and daily_standard_consumption = #{daily_standard_consumption}
            </if>
            <if test="duplicate_suspected != null and duplicate_suspected != ''">
                and duplicate_suspected = #{duplicate_suspected}
            </if>
            <if test="alternative_code != null and alternative_code != ''">
                and alternative_code = #{alternative_code}
            </if>
            <if test="marketing_authorization_holder != null and marketing_authorization_holder != ''">
                and marketing_authorization_holder = #{marketing_authorization_holder}
            </if>
            <if test="medication_days != null and medication_days != ''">
                and medication_days = #{medication_days}
            </if>
            <if test="small_code_southchina_specific != null and small_code_southchina_specific != ''">
                and small_code_southchina_specific = #{small_code_southchina_specific}
            </if>
            <if test="corresponding_major_code != null and corresponding_major_code != ''">
                and corresponding_major_code = #{corresponding_major_code}
            </if>
            <if test="conversion_ratio_to_alternative != null and conversion_ratio_to_alternative != ''">
                and conversion_ratio_to_alternative = #{conversion_ratio_to_alternative}
            </if>
            <if test="disease_type != null and disease_type != ''">
                and disease_type = #{disease_type}
            </if>
            <if test="brand_manufacturer_name != null and brand_manufacturer_name != ''">
                and brand_manufacturer_name = #{brand_manufacturer_name}
            </if>
            <if test="group_name != null and group_name != ''">
                and group_name = #{group_name}
            </if>
            <if test="external_organization != null and external_organization != ''">
                and external_organization = #{external_organization}
            </if>
            <if test="national_negotiated_product != null and national_negotiated_product != ''">
                and national_negotiated_product = #{national_negotiated_product}
            </if>
            <if test="national_standard_code != null and national_standard_code != ''">
                and national_standard_code = #{national_standard_code}
            </if>
            <if test="national_standard_code_2 != null and national_standard_code_2 != ''">
                and national_standard_code_2 = #{national_standard_code_2}
            </if>
            <if test="medical_insurance_min_dose_unit != null and medical_insurance_min_dose_unit != ''">
                and medical_insurance_min_dose_unit = #{medical_insurance_min_dose_unit}
            </if>
            <if test="medical_market_status != null and medical_market_status != ''">
                and medical_market_status = #{medical_market_status}
            </if>
            <if test="accounting_manufacturer != null and accounting_manufacturer != ''">
                and accounting_manufacturer = #{accounting_manufacturer}
            </if>
            <if test="department_affiliation != null and department_affiliation != ''">
                and department_affiliation = #{department_affiliation}
            </if>
            <if test="chronic_disease_first_line_treatment != null and chronic_disease_first_line_treatment != ''">
                and chronic_disease_first_line_treatment = #{chronic_disease_first_line_treatment}
            </if>
            <if test="is_medical_generic_name != null and is_medical_generic_name != ''">
                and is_medical_generic_name = #{is_medical_generic_name}
            </if>
            <if test="covid_tag != null and covid_tag != ''">
                and covid_tag = #{covid_tag}
            </if>
            <if test="product_remarks != null and product_remarks != ''">
                and product_remarks = #{product_remarks}
            </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SPProductinfoRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_gxhpz_product_info where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addProductAdd" parameterType="pd" >
        insert into s_gxhpz_product_info
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">product_code,</if>
            <if test="storeId != null and storeId != ''">storeId,</if>
            <if test="product_name != null and product_name != ''">product_name,</if>
            <if test="mnemonic_code != null and mnemonic_code != ''">mnemonic_code,</if>
            <if test="product_description != null and product_description != ''">product_description,</if>
            <if test="generic_name != null and generic_name != ''">generic_name,</if>
            <if test="generic_mnemonic_code != null and generic_mnemonic_code != ''">generic_mnemonic_code,</if>
            <if test="generic_previous_names != null and generic_previous_names != ''">generic_previous_names,</if>
            <if test="base_unit != null and base_unit != ''">base_unit,</if>
            <if test="trademark != null and trademark != ''">trademark,</if>
            <if test="specification != null and specification != ''">specification,</if>
            <if test="packaging != null and packaging != ''">packaging,</if>
            <if test="international_barcode != null and international_barcode != ''">international_barcode,</if>
            <if test="manufacturer != null and manufacturer != ''">manufacturer,</if>
            <if test="entrusted_manufacturer != null and entrusted_manufacturer != ''">entrusted_manufacturer,</if>
            <if test="manufacturer_abbreviation != null and manufacturer_abbreviation != ''">manufacturer_abbreviation,</if>
            <if test="origin != null and origin != ''">origin,</if>
            <if test="category_maj != null and category_maj != ''">category_maj,</if>
            <if test="category_min != null and category_min != ''">category_min,</if>
            <if test="product_type != null and product_type != ''">product_type,</if>
            <if test="product_status != null and product_status != ''">product_status,</if>
            <if test="purchase_tax_rate != null and purchase_tax_rate != ''">purchase_tax_rate,</if>
            <if test="sales_tax_rate != null and sales_tax_rate != ''">sales_tax_rate,</if>
            <if test="import_export_status != null and import_export_status != ''">import_export_status,</if>
            <if test="major_category != null and major_category != ''">major_category,</if>
            <if test="medium_category != null and medium_category != ''">medium_category,</if>
            <if test="minor_category != null and minor_category != ''">minor_category,</if>
            <if test="sub_category != null and sub_category != ''">sub_category,</if>
            <if test="ingredients != null and ingredients != ''">ingredients,</if>
            <if test="dtp_flag != null and dtp_flag != ''">dtp_flag,</if>
            <if test="daily_standard_consumption != null and daily_standard_consumption != ''">daily_standard_consumption,</if>
            <if test="duplicate_suspected != null and duplicate_suspected != ''">duplicate_suspected,</if>
            <if test="alternative_code != null and alternative_code != ''">alternative_code,</if>
            <if test="marketing_authorization_holder != null and marketing_authorization_holder != ''">marketing_authorization_holder,</if>
            <if test="medication_days != null and medication_days != ''">medication_days,</if>
            <if test="small_code_southchina_specific != null and small_code_southchina_specific != ''">small_code_southchina_specific,</if>
            <if test="corresponding_major_code != null and corresponding_major_code != ''">corresponding_major_code,</if>
            <if test="conversion_ratio_to_alternative != null and conversion_ratio_to_alternative != ''">conversion_ratio_to_alternative,</if>
            <if test="disease_type != null and disease_type != ''">disease_type,</if>
            <if test="brand_manufacturer_name != null and brand_manufacturer_name != ''">brand_manufacturer_name,</if>
            <if test="group_name != null and group_name != ''">group_name,</if>
            <if test="external_organization != null and external_organization != ''">external_organization,</if>
            <if test="national_negotiated_product != null and national_negotiated_product != ''">national_negotiated_product,</if>
            <if test="national_standard_code != null and national_standard_code != ''">national_standard_code,</if>
            <if test="national_standard_code_2 != null and national_standard_code_2 != ''">national_standard_code_2,</if>
            <if test="medical_insurance_min_dose_unit != null and medical_insurance_min_dose_unit != ''">medical_insurance_min_dose_unit,</if>
            <if test="medical_market_status != null and medical_market_status != ''">medical_market_status,</if>
            <if test="accounting_manufacturer != null and accounting_manufacturer != ''">accounting_manufacturer,</if>
            <if test="department_affiliation != null and department_affiliation != ''">department_affiliation,</if>
            <if test="chronic_disease_first_line_treatment != null and chronic_disease_first_line_treatment != ''">chronic_disease_first_line_treatment,</if>
            <if test="is_medical_generic_name != null and is_medical_generic_name != ''">is_medical_generic_name,</if>
            <if test="covid_tag != null and covid_tag != ''">covid_tag,</if>
            <if test="product_remarks != null and product_remarks != ''">product_remarks,</if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">#{product_code},</if>
            <if test="storeId != null and storeId != ''">#{storeId},</if>
            <if test="product_name != null and product_name != ''">#{product_name},</if>
            <if test="mnemonic_code != null and mnemonic_code != ''">#{mnemonic_code},</if>
            <if test="product_description != null and product_description != ''">#{product_description},</if>
            <if test="generic_name != null and generic_name != ''">#{generic_name},</if>
            <if test="generic_mnemonic_code != null and generic_mnemonic_code != ''">#{generic_mnemonic_code},</if>
            <if test="generic_previous_names != null and generic_previous_names != ''">#{generic_previous_names},</if>
            <if test="base_unit != null and base_unit != ''">#{base_unit},</if>
            <if test="trademark != null and trademark != ''">#{trademark},</if>
            <if test="specification != null and specification != ''">#{specification},</if>
            <if test="packaging != null and packaging != ''">#{packaging},</if>
            <if test="international_barcode != null and international_barcode != ''">#{international_barcode},</if>
            <if test="manufacturer != null and manufacturer != ''">#{manufacturer},</if>
            <if test="entrusted_manufacturer != null and entrusted_manufacturer != ''">#{entrusted_manufacturer},</if>
            <if test="manufacturer_abbreviation != null and manufacturer_abbreviation != ''">#{manufacturer_abbreviation},</if>
            <if test="origin != null and origin != ''">#{origin},</if>
            <if test="category_maj != null and category_maj != ''">#{category_maj},</if>
            <if test="category_min != null and category_min != ''">#{category_min},</if>
            <if test="product_type != null and product_type != ''">#{product_type},</if>
            <if test="product_status != null and product_status != ''">#{product_status},</if>
            <if test="purchase_tax_rate != null and purchase_tax_rate != ''">#{purchase_tax_rate},</if>
            <if test="sales_tax_rate != null and sales_tax_rate != ''">#{sales_tax_rate},</if>
            <if test="import_export_status != null and import_export_status != ''">#{import_export_status},</if>
            <if test="major_category != null and major_category != ''">#{major_category},</if>
            <if test="medium_category != null and medium_category != ''">#{medium_category},</if>
            <if test="minor_category != null and minor_category != ''">#{minor_category},</if>
            <if test="sub_category != null and sub_category != ''">#{sub_category},</if>
            <if test="ingredients != null and ingredients != ''">#{ingredients},</if>
            <if test="dtp_flag != null and dtp_flag != ''">#{dtp_flag},</if>
            <if test="daily_standard_consumption != null and daily_standard_consumption != ''">#{daily_standard_consumption},</if>
            <if test="duplicate_suspected != null and duplicate_suspected != ''">#{duplicate_suspected},</if>
            <if test="alternative_code != null and alternative_code != ''">#{alternative_code},</if>
            <if test="marketing_authorization_holder != null and marketing_authorization_holder != ''">#{marketing_authorization_holder},</if>
            <if test="medication_days != null and medication_days != ''">#{medication_days},</if>
            <if test="small_code_southchina_specific != null and small_code_southchina_specific != ''">#{small_code_southchina_specific},</if>
            <if test="corresponding_major_code != null and corresponding_major_code != ''">#{corresponding_major_code},</if>
            <if test="conversion_ratio_to_alternative != null and conversion_ratio_to_alternative != ''">#{conversion_ratio_to_alternative},</if>
            <if test="disease_type != null and disease_type != ''">#{disease_type},</if>
            <if test="brand_manufacturer_name != null and brand_manufacturer_name != ''">#{brand_manufacturer_name},</if>
            <if test="group_name != null and group_name != ''">#{group_name},</if>
            <if test="external_organization != null and external_organization != ''">#{external_organization},</if>
            <if test="national_negotiated_product != null and national_negotiated_product != ''">#{national_negotiated_product},</if>
            <if test="national_standard_code != null and national_standard_code != ''">#{national_standard_code},</if>
            <if test="national_standard_code_2 != null and national_standard_code_2 != ''">#{national_standard_code_2},</if>
            <if test="medical_insurance_min_dose_unit != null and medical_insurance_min_dose_unit != ''">#{medical_insurance_min_dose_unit},</if>
            <if test="medical_market_status != null and medical_market_status != ''">#{medical_market_status},</if>
            <if test="accounting_manufacturer != null and accounting_manufacturer != ''">#{accounting_manufacturer},</if>
            <if test="department_affiliation != null and department_affiliation != ''">#{department_affiliation},</if>
            <if test="chronic_disease_first_line_treatment != null and chronic_disease_first_line_treatment != ''">#{chronic_disease_first_line_treatment},</if>
            <if test="is_medical_generic_name != null and is_medical_generic_name != ''">#{is_medical_generic_name},</if>
            <if test="covid_tag != null and covid_tag != ''">#{covid_tag},</if>
            <if test="product_remarks != null and product_remarks != ''">#{product_remarks},</if>
        </trim>

    </insert>

    <insert id="addProductAdd2" parameterType="pd" >
        insert into s_gxhpz_product_information
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                product_code,
            </if>
            <if test="storeId != null and storeId != ''">storeId,</if>
            <if test="reference_purchase_price != null and reference_purchase_price != ''">
                reference_purchase_price,
            </if>
            <if test="is_direct_to_warehouse != null and is_direct_to_warehouse != ''">
                is_direct_to_warehouse,
            </if>
            <if test="purchase_group != null and purchase_group != ''">
                purchase_group,
            </if>
            <if test="channel_attribute != null and channel_attribute != ''">
                channel_attribute,
            </if>
            <if test="purchase_organization != null and purchase_organization != ''">
                purchase_organization,
            </if>
            <if test="is_purchase_prohibited != null and is_purchase_prohibited != ''">
                is_purchase_prohibited,
            </if>
            <if test="group_product_purchase_attribute != null and group_product_purchase_attribute != ''">
                group_product_purchase_attribute,
            </if>
            <if test="is_original_research != null and is_original_research != ''">
                is_original_research,
            </if>
            <if test="brand_attribute != null and brand_attribute != ''">
                brand_attribute,
            </if>
            <if test="consumer_health_own_brand != null and consumer_health_own_brand != ''">
                consumer_health_own_brand,
            </if>
            <if test="health_category != null and health_category != ''">
                health_category,
            </if>
            <if test="registrant_unified_social_credit_code != null and registrant_unified_social_credit_code != ''">
                registrant_unified_social_credit_code,
            </if>
            <if test="is_broad_dtp != null and is_broad_dtp != ''">
                is_broad_dtp,
            </if>
            <if test="purchase_attribute != null and purchase_attribute != ''">
                purchase_attribute,
            </if>
            <if test="operation_attribute != null and operation_attribute != ''">
                operation_attribute,
            </if>
            <if test="archive_number != null and archive_number != ''">
                archive_number,
            </if>
            <if test="special_sales_attribute != null and special_sales_attribute != ''">
                special_sales_attribute,
            </if>
            <if test="is_normal_stock_in_central_warehouse != null and is_normal_stock_in_central_warehouse != ''">
                is_normal_stock_in_central_warehouse,
            </if>
            <if test="is_first_operation != null and is_first_operation != ''">
                is_first_operation,
            </if>
            <if test="data_creation_time != null and data_creation_time != ''">
                data_creation_time,
            </if>
            <if test="product_mid_code_strategy != null and product_mid_code_strategy != ''">
                product_mid_code_strategy,
            </if>
            <if test="is_completed_component_analysis != null and is_completed_component_analysis != ''">
                is_completed_component_analysis,
            </if>
            <if test="sales_control_attribute != null and sales_control_attribute != ''">
                sales_control_attribute,
            </if>
            <if test="four_plus_seven_label != null and four_plus_seven_label != ''">
                four_plus_seven_label,
            </if>
            <if test="platform_common_recommendation != null and platform_common_recommendation != ''">
                platform_common_recommendation,
            </if>
            <if test="commercial_large_circulation_product != null and commercial_large_circulation_product != ''">
                commercial_large_circulation_product,
            </if>
            <if test="unified_procurement_elimination_time != null and unified_procurement_elimination_time != ''">
                unified_procurement_elimination_time,
            </if>
            <if test="centralized_procurement_elimination_time != null and centralized_procurement_elimination_time != ''">
                centralized_procurement_elimination_time,
            </if>
            <if test="zc_special_attributes != null and zc_special_attributes != ''">
                zc_special_attributes,
            </if>
            <if test="old_new_code_conversion_ratio != null and old_new_code_conversion_ratio != ''">
                old_new_code_conversion_ratio,
            </if>
            <if test="dual_channel_drug != null and dual_channel_drug != ''">
                dual_channel_drug,
            </if>
            <if test="national_negotiated_price != null and national_negotiated_price != ''">
                national_negotiated_price,
            </if>
            <if test="guangzhou_pharmaceutical_supervision_code != null and guangzhou_pharmaceutical_supervision_code != ''">
                guangzhou_pharmaceutical_supervision_code,
            </if>
            <if test="coordinated_reimbursement_product != null and coordinated_reimbursement_product != ''">
                coordinated_reimbursement_product,
            </if>
            <if test="two_pantry_goods_attribute != null and two_pantry_goods_attribute != ''">
                two_pantry_goods_attribute,
            </if>
            <if test="is_store_operation_restricted != null and is_store_operation_restricted != ''">
                is_store_operation_restricted,
            </if>
            <if test="can_be_allocated_to_franchise_stores != null and can_be_allocated_to_franchise_stores != ''">
                can_be_allocated_to_franchise_stores,
            </if>
            <if test="franchise_stores_enjoy_unified_procurement_policy != null and franchise_stores_enjoy_unified_procurement_policy != ''">
                franchise_stores_enjoy_unified_procurement_policy,
            </if>
            <if test="medical_insurance_purchase_type != null and medical_insurance_purchase_type != ''">
                medical_insurance_purchase_type,
            </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                #{product_code},
            </if>
            <if test="storeId != null and storeId != ''">#{storeId},</if>
            <if test="reference_purchase_price != null and reference_purchase_price != ''">
                #{reference_purchase_price},
            </if>
            <if test="is_direct_to_warehouse != null and is_direct_to_warehouse != ''">
                #{is_direct_to_warehouse},
            </if>
            <if test="purchase_group != null and purchase_group != ''">
                #{purchase_group},
            </if>
            <if test="channel_attribute != null and channel_attribute != ''">
                #{channel_attribute},
            </if>
            <if test="purchase_organization != null and purchase_organization != ''">
                #{purchase_organization},
            </if>
            <if test="is_purchase_prohibited != null and is_purchase_prohibited != ''">
                #{is_purchase_prohibited},
            </if>
            <if test="group_product_purchase_attribute != null and group_product_purchase_attribute != ''">
                #{group_product_purchase_attribute},
            </if>
            <if test="is_original_research != null and is_original_research != ''">
                #{is_original_research},
            </if>
            <if test="brand_attribute != null and brand_attribute != ''">
                #{brand_attribute},
            </if>
            <if test="consumer_health_own_brand != null and consumer_health_own_brand != ''">
                #{consumer_health_own_brand},
            </if>
            <if test="health_category != null and health_category != ''">
                #{health_category},
            </if>
            <if test="registrant_unified_social_credit_code != null and registrant_unified_social_credit_code != ''">
                #{registrant_unified_social_credit_code},
            </if>
            <if test="is_broad_dtp != null and is_broad_dtp != ''">
                #{is_broad_dtp},
            </if>
            <if test="purchase_attribute != null and purchase_attribute != ''">
                #{purchase_attribute},
            </if>
            <if test="operation_attribute != null and operation_attribute != ''">
                #{operation_attribute},
            </if>
            <if test="archive_number != null and archive_number != ''">
                #{archive_number},
            </if>
            <if test="special_sales_attribute != null and special_sales_attribute != ''">
                #{special_sales_attribute},
            </if>
            <if test="is_normal_stock_in_central_warehouse != null and is_normal_stock_in_central_warehouse != ''">
                #{is_normal_stock_in_central_warehouse},
            </if>
            <if test="is_first_operation != null and is_first_operation != ''">
                #{is_first_operation},
            </if>
            <if test="data_creation_time != null and data_creation_time != ''">
                #{data_creation_time},
            </if>
            <if test="product_mid_code_strategy != null and product_mid_code_strategy != ''">
                #{product_mid_code_strategy},
            </if>
            <if test="is_completed_component_analysis != null and is_completed_component_analysis != ''">
                #{is_completed_component_analysis},
            </if>
            <if test="sales_control_attribute != null and sales_control_attribute != ''">
                #{sales_control_attribute},
            </if>
            <if test="four_plus_seven_label != null and four_plus_seven_label != ''">
                #{four_plus_seven_label},
            </if>
            <if test="platform_common_recommendation != null and platform_common_recommendation != ''">
                #{platform_common_recommendation},
            </if>
            <if test="commercial_large_circulation_product != null and commercial_large_circulation_product != ''">
                #{commercial_large_circulation_product},
            </if>
            <if test="unified_procurement_elimination_time != null and unified_procurement_elimination_time != ''">
                #{unified_procurement_elimination_time},
            </if>
            <if test="centralized_procurement_elimination_time != null and centralized_procurement_elimination_time != ''">
                #{centralized_procurement_elimination_time},
            </if>
            <if test="zc_special_attributes != null and zc_special_attributes != ''">
                #{zc_special_attributes},
            </if>
            <if test="old_new_code_conversion_ratio != null and old_new_code_conversion_ratio != ''">
                #{old_new_code_conversion_ratio},
            </if>
            <if test="dual_channel_drug != null and dual_channel_drug != ''">
                #{dual_channel_drug},
            </if>
            <if test="national_negotiated_price != null and national_negotiated_price != ''">
                #{national_negotiated_price},
            </if>
            <if test="guangzhou_pharmaceutical_supervision_code != null and guangzhou_pharmaceutical_supervision_code != ''">
                #{guangzhou_pharmaceutical_supervision_code},
            </if>
            <if test="coordinated_reimbursement_product != null and coordinated_reimbursement_product != ''">
                #{coordinated_reimbursement_product},
            </if>
            <if test="two_pantry_goods_attribute != null and two_pantry_goods_attribute != ''">
                #{two_pantry_goods_attribute},
            </if>
            <if test="is_store_operation_restricted != null and is_store_operation_restricted != ''">
                #{is_store_operation_restricted},
            </if>
            <if test="can_be_allocated_to_franchise_stores != null and can_be_allocated_to_franchise_stores != ''">
                #{can_be_allocated_to_franchise_stores},
            </if>
            <if test="franchise_stores_enjoy_unified_procurement_policy != null and franchise_stores_enjoy_unified_procurement_policy != ''">
                #{franchise_stores_enjoy_unified_procurement_policy},
            </if>
            <if test="medical_insurance_purchase_type != null and medical_insurance_purchase_type != ''">
                #{medical_insurance_purchase_type},
            </if>
        </trim>

    </insert>

    <insert id="addProductAdd3" parameterType="pd" >
        insert into s_gxhpz_product_classification
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                product_code,
            </if>
            <if test="storeId != null and storeId != ''">storeId,</if>
            <if test="storage_category != null and storage_category != ''">
                storage_category,
            </if>
            <if test="is_fragile != null and is_fragile != ''">
                is_fragile,
            </if>
            <if test="is_hazardous != null and is_hazardous != ''">
                is_hazardous,
            </if>
            <if test="is_odd_shape != null and is_odd_shape != ''">
                is_odd_shape,
            </if>
            <if test="basic_package_length != null and basic_package_length != ''">
                basic_package_length,
            </if>
            <if test="basic_package_width != null and basic_package_width != ''">
                basic_package_width,
            </if>
            <if test="basic_package_height != null and basic_package_height != ''">
                basic_package_height,
            </if>
            <if test="minimum_package_quantity != null and minimum_package_quantity != ''">
                minimum_package_quantity,
            </if>
            <if test="medium_package_quantity != null and medium_package_quantity != ''">
                medium_package_quantity,
            </if>
            <if test="box_package_quantity != null and box_package_quantity != ''">
                box_package_quantity,
            </if>
            <if test="is_medium_package_enabled != null and is_medium_package_enabled != ''">
                is_medium_package_enabled,
            </if>
            <if test="medium_package_request_ratio != null and medium_package_request_ratio != ''">
                medium_package_request_ratio,
            </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                #{product_code},
            </if>
            <if test="storeId != null and storeId != ''">#{storeId},</if>
            <if test="storage_category != null and storage_category != ''">
                #{storage_category},
            </if>
            <if test="is_fragile != null and is_fragile != ''">
                #{is_fragile},
            </if>
            <if test="is_hazardous != null and is_hazardous != ''">
                #{is_hazardous},
            </if>
            <if test="is_odd_shape != null and is_odd_shape != ''">
                #{is_odd_shape},
            </if>
            <if test="basic_package_length != null and basic_package_length != ''">
                #{basic_package_length},
            </if>
            <if test="basic_package_width != null and basic_package_width != ''">
                #{basic_package_width},
            </if>
            <if test="basic_package_height != null and basic_package_height != ''">
                #{basic_package_height},
            </if>
            <if test="minimum_package_quantity != null and minimum_package_quantity != ''">
                #{minimum_package_quantity},
            </if>
            <if test="medium_package_quantity != null and medium_package_quantity != ''">
                #{medium_package_quantity},
            </if>
            <if test="box_package_quantity != null and box_package_quantity != ''">
                #{box_package_quantity},
            </if>
            <if test="is_medium_package_enabled != null and is_medium_package_enabled != ''">
                #{is_medium_package_enabled},
            </if>
            <if test="medium_package_request_ratio != null and medium_package_request_ratio != ''">
                #{medium_package_request_ratio},
            </if>
        </trim>

    </insert>

    <insert id="addProductAdd4" parameterType="pd" >
        insert into s_gxhpz_product_zg
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                product_code,
            </if>
            <if test="storeId != null and storeId != ''">storeId,</if>
            <if test="is_production_batch_management != null and is_production_batch_management != ''">
                is_production_batch_management,
            </if>
            <if test="business_scope != null and business_scope != ''">
                business_scope,
            </if>
            <if test="prescription_category != null and prescription_category != ''">
                prescription_category,
            </if>
            <if test="prescription_category_secondary != null and prescription_category_secondary != ''">
                prescription_category_secondary,
            </if>
            <if test="prescription_category_tertiary != null and prescription_category_tertiary != ''">
                prescription_category_tertiary,
            </if>
            <if test="approval_number_1 != null and approval_number_1 != ''">
                approval_number_1,
            </if>
            <if test="approval_number_1_expiry != null and approval_number_1_expiry != ''">
                approval_number_1_expiry,
            </if>
            <if test="approval_number_2 != null and approval_number_2 != ''">
                approval_number_2,
            </if>
            <if test="approval_number_2_expiry != null and approval_number_2_expiry != ''">
                approval_number_2_expiry,
            </if>
            <if test="registration_certificate_1 != null and registration_certificate_1 != ''">
                registration_certificate_1,
            </if>
            <if test="registration_certificate_1_expiry != null and registration_certificate_1_expiry != ''">
                registration_certificate_1_expiry,
            </if>
            <if test="registration_certificate_2 != null and registration_certificate_2 != ''">
                registration_certificate_2,
            </if>
            <if test="registration_certificate_2_expiry != null and registration_certificate_2_expiry != ''">
                registration_certificate_2_expiry,
            </if>
            <if test="production_license != null and production_license != ''">
                production_license,
            </if>
            <if test="production_license_expiry != null and production_license_expiry != ''">
                production_license_expiry,
            </if>
            <if test="is_cold_chain_drug != null and is_cold_chain_drug != ''">
                is_cold_chain_drug,
            </if>
            <if test="is_second_inspection != null and is_second_inspection != ''">
                is_second_inspection,
            </if>
            <if test="local_code != null and local_code != ''">
                local_code,
            </if>
            <if test="pharmacology_toxicology != null and pharmacology_toxicology != ''">
                pharmacology_toxicology,
            </if>
            <if test="clinical_trial != null and clinical_trial != ''">
                clinical_trial,
            </if>
            <if test="drug_overdose != null and drug_overdose != ''">
                drug_overdose,
            </if>
            <if test="elderly_patient_usage != null and elderly_patient_usage != ''">
                elderly_patient_usage,
            </if>
            <if test="pediatric_patient_usage != null and pediatric_patient_usage != ''">
                pediatric_patient_usage,
            </if>
            <if test="pregnant_breastfeeding_usage != null and pregnant_breastfeeding_usage != ''">
                pregnant_breastfeeding_usage,
            </if>
            <if test="zgingredients != null and zgingredients != ''">
                zgingredients,
            </if>
            <if test="group_quality_status != null and group_quality_status != ''">
                group_quality_status,
            </if>
            <if test="package_specification != null and package_specification != ''">
                package_specification,
            </if>
            <if test="storage_conditions != null and storage_conditions != ''">
                storage_conditions,
            </if>
            <if test="has_traceability_code != null and has_traceability_code != ''">
                has_traceability_code,
            </if>
            <if test="acceptance_period_days != null and acceptance_period_days != ''">
                acceptance_period_days,
            </if>
            <if test="is_serial_number_managed != null and is_serial_number_managed != ''">
                is_serial_number_managed,
            </if>
            <if test="near_expiry_date != null and near_expiry_date != ''">
                near_expiry_date,
            </if>
            <if test="company_approval_expiry != null and company_approval_expiry != ''">
                company_approval_expiry,
            </if>
            <if test="company_registration_expiry != null and company_registration_expiry != ''">
                company_registration_expiry,
            </if>
            <if test="is_scan_traceable != null and is_scan_traceable != ''">
                is_scan_traceable,
            </if>
            <if test="wildlife_management_identification != null and wildlife_management_identification != ''">
                wildlife_management_identification,
            </if>
            <if test="special_sales_control != null and special_sales_control != ''">
                special_sales_control,
            </if>
            <if test="is_udi_scanned != null and is_udi_scanned != ''">
                is_udi_scanned,
            </if>
            <if test="max_prescription_days != null and max_prescription_days != ''">
                max_prescription_days,
            </if>
            <if test="restricted_usage != null and restricted_usage != ''">
                restricted_usage,
            </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                #{product_code},
            </if>
            <if test="storeId != null and storeId != ''"> #{storeId},</if>
            <if test="is_production_batch_management != null and is_production_batch_management != ''">
                #{is_production_batch_management},
            </if>
            <if test="business_scope != null and business_scope != ''">
                #{business_scope},
            </if>
            <if test="prescription_category != null and prescription_category != ''">
                #{prescription_category},
            </if>
            <if test="prescription_category_secondary != null and prescription_category_secondary != ''">
                #{prescription_category_secondary},
            </if>
            <if test="prescription_category_tertiary != null and prescription_category_tertiary != ''">
                #{prescription_category_tertiary},
            </if>
            <if test="approval_number_1 != null and approval_number_1 != ''">
                #{approval_number_1},
            </if>
            <if test="approval_number_1_expiry != null and approval_number_1_expiry != ''">
                #{approval_number_1_expiry},
            </if>
            <if test="approval_number_2 != null and approval_number_2 != ''">
                #{approval_number_2},
            </if>
            <if test="approval_number_2_expiry != null and approval_number_2_expiry != ''">
                #{approval_number_2_expiry},
            </if>
            <if test="registration_certificate_1 != null and registration_certificate_1 != ''">
                #{registration_certificate_1},
            </if>
            <if test="registration_certificate_1_expiry != null and registration_certificate_1_expiry != ''">
                #{registration_certificate_1_expiry},
            </if>
            <if test="registration_certificate_2 != null and registration_certificate_2 != ''">
                #{registration_certificate_2},
            </if>
            <if test="registration_certificate_2_expiry != null and registration_certificate_2_expiry != ''">
                #{registration_certificate_2_expiry},
            </if>
            <if test="production_license != null and production_license != ''">
                #{production_license},
            </if>
            <if test="production_license_expiry != null and production_license_expiry != ''">
                #{production_license_expiry},
            </if>
            <if test="is_cold_chain_drug != null and is_cold_chain_drug != ''">
                #{is_cold_chain_drug},
            </if>
            <if test="is_second_inspection != null and is_second_inspection != ''">
                #{is_second_inspection},
            </if>
            <if test="local_code != null and local_code != ''">
                #{local_code},
            </if>
            <if test="pharmacology_toxicology != null and pharmacology_toxicology != ''">
                #{pharmacology_toxicology},
            </if>
            <if test="clinical_trial != null and clinical_trial != ''">
                #{clinical_trial},
            </if>
            <if test="drug_overdose != null and drug_overdose != ''">
                #{drug_overdose},
            </if>
            <if test="elderly_patient_usage != null and elderly_patient_usage != ''">
                #{elderly_patient_usage},
            </if>
            <if test="pediatric_patient_usage != null and pediatric_patient_usage != ''">
                #{pediatric_patient_usage},
            </if>
            <if test="pregnant_breastfeeding_usage != null and pregnant_breastfeeding_usage != ''">
                #{pregnant_breastfeeding_usage},
            </if>
            <if test="zgingredients != null and zgingredients != ''">
                #{zgingredients},
            </if>
            <if test="group_quality_status != null and group_quality_status != ''">
                #{group_quality_status},
            </if>
            <if test="package_specification != null and package_specification != ''">
                #{package_specification},
            </if>
            <if test="storage_conditions != null and storage_conditions != ''">
                #{storage_conditions},
            </if>
            <if test="has_traceability_code != null and has_traceability_code != ''">
                #{has_traceability_code},
            </if>
            <if test="acceptance_period_days != null and acceptance_period_days != ''">
                #{acceptance_period_days},
            </if>
            <if test="is_serial_number_managed != null and is_serial_number_managed != ''">
                #{is_serial_number_managed},
            </if>
            <if test="near_expiry_date != null and near_expiry_date != ''">
                #{near_expiry_date},
            </if>
            <if test="company_approval_expiry != null and company_approval_expiry != ''">
                #{company_approval_expiry},
            </if>
            <if test="company_registration_expiry != null and company_registration_expiry != ''">
                #{company_registration_expiry},
            </if>
            <if test="is_scan_traceable != null and is_scan_traceable != ''">
                #{is_scan_traceable},
            </if>
            <if test="wildlife_management_identification != null and wildlife_management_identification != ''">
                #{wildlife_management_identification},
            </if>
            <if test="special_sales_control != null and special_sales_control != ''">
                #{special_sales_control},
            </if>
            <if test="is_udi_scanned != null and is_udi_scanned != ''">
                #{is_udi_scanned},
            </if>
            <if test="max_prescription_days != null and max_prescription_days != ''">
                #{max_prescription_days},
            </if>
            <if test="restricted_usage != null and restricted_usage != ''">
                #{restricted_usage},
            </if>
        </trim>
    </insert>

    <insert id="addProductAdd5" parameterType="pd" >
        insert into s_gxhpz_product_details
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                product_code,
            </if>
            <if test="storeId != null and storeId != ''">storeId,</if>
            <if test="reference_retail_price != null and reference_retail_price != ''">
                reference_retail_price,
            </if>
            <if test="online_sales != null and online_sales != ''">
                online_sales,
            </if>
            <if test="mid_platform_product_spuid != null and mid_platform_product_spuid != ''">
                mid_platform_product_spuid,
            </if>
            <if test="mid_platform_product_type != null and mid_platform_product_type != ''">
                mid_platform_product_type,
            </if>
            <if test="external_transmission_system != null and external_transmission_system != ''">
                external_transmission_system,
            </if>
            <if test="online_o2o != null and online_o2o != ''">
                online_o2o,
            </if>
            <if test="online_b2c != null and online_b2c != ''">
                online_b2c,
            </if>
            <if test="online_mutual_medical != null and online_mutual_medical != ''">
                online_mutual_medical,
            </if>
            <if test="online_brand_health != null and online_brand_health != ''">
                online_brand_health,
            </if>
            <if test="xproduct_name != null and xproduct_name != ''">
                xproduct_name,
            </if>
            <if test="minimum_display_quantity != null and minimum_display_quantity != ''">
                minimum_display_quantity,
            </if>
            <if test="sales_attributes != null and sales_attributes != ''">
                sales_attributes,
            </if>
            <if test="prohibit_delivery != null and prohibit_delivery != ''">
                prohibit_delivery,
            </if>
            <if test="prohibit_return_warehouse != null and prohibit_return_warehouse != ''">
                prohibit_return_warehouse,
            </if>
            <if test="prohibit_sales != null and prohibit_sales != ''">
                prohibit_sales,
            </if>
            <if test="can_be_divided != null and can_be_divided != ''">
                can_be_divided,
            </if>
            <if test="division_unit != null and division_unit != ''">
                division_unit,
            </if>
            <if test="division_ratio != null and division_ratio != ''">
                division_ratio,
            </if>
            <if test="daas_business_model != null and daas_business_model != ''">
                daas_business_model,
            </if>
            <if test="promotion_approval != null and promotion_approval != ''">
                promotion_approval,
            </if>
            <if test="wholesale_priority_level != null and wholesale_priority_level != ''">
                wholesale_priority_level,
            </if>
            <if test="external_packaging_path != null and external_packaging_path != ''">
                external_packaging_path,
            </if>
            <if test="can_view != null and can_view != ''">
                can_view,
            </if>
            <if test="can_delete != null and can_delete != ''">
                can_delete,
            </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                #{product_code},
            </if>
            <if test="storeId != null and storeId != ''"> #{storeId},</if>
            <if test="reference_retail_price != null and reference_retail_price != ''">
                #{reference_retail_price},
            </if>
            <if test="online_sales != null and online_sales != ''">
                #{online_sales},
            </if>
            <if test="mid_platform_product_spuid != null and mid_platform_product_spuid != ''">
                #{mid_platform_product_spuid},
            </if>
            <if test="mid_platform_product_type != null and mid_platform_product_type != ''">
                #{mid_platform_product_type},
            </if>
            <if test="external_transmission_system != null and external_transmission_system != ''">
                #{external_transmission_system},
            </if>
            <if test="online_o2o != null and online_o2o != ''">
                #{online_o2o},
            </if>
            <if test="online_b2c != null and online_b2c != ''">
                #{online_b2c},
            </if>
            <if test="online_mutual_medical != null and online_mutual_medical != ''">
                #{online_mutual_medical},
            </if>
            <if test="online_brand_health != null and online_brand_health != ''">
                #{online_brand_health},
            </if>
            <if test="xproduct_name != null and xproduct_name != ''">
                #{xproduct_name},
            </if>
            <if test="minimum_display_quantity != null and minimum_display_quantity != ''">
                #{minimum_display_quantity},
            </if>
            <if test="sales_attributes != null and sales_attributes != ''">
                #{sales_attributes},
            </if>
            <if test="prohibit_delivery != null and prohibit_delivery != ''">
                #{prohibit_delivery},
            </if>
            <if test="prohibit_return_warehouse != null and prohibit_return_warehouse != ''">
                #{prohibit_return_warehouse},
            </if>
            <if test="prohibit_sales != null and prohibit_sales != ''">
                #{prohibit_sales},
            </if>
            <if test="can_be_divided != null and can_be_divided != ''">
                #{can_be_divided},
            </if>
            <if test="division_unit != null and division_unit != ''">
                #{division_unit},
            </if>
            <if test="division_ratio != null and division_ratio != ''">
                #{division_ratio},
            </if>
            <if test="daas_business_model != null and daas_business_model != ''">
                #{daas_business_model},
            </if>
            <if test="promotion_approval != null and promotion_approval != ''">
                #{promotion_approval},
            </if>
            <if test="wholesale_priority_level != null and wholesale_priority_level != ''">
                #{wholesale_priority_level},
            </if>
            <if test="external_packaging_path != null and external_packaging_path != ''">
                #{external_packaging_path},
            </if>
            <if test="can_view != null and can_view != ''">
                #{can_view},
            </if>
            <if test="can_delete != null and can_delete != ''">
                #{can_delete},
            </if>
        </trim>

    </insert>

    <insert id="addProductAdd6" parameterType="pd" >
        insert into s_gxhpz_product_attributes
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                product_code,
            </if>
            <if test="storeId != null and storeId != ''">storeId,</if>
            <if test="platform_property != null and platform_property != ''">
                platform_property,
            </if>
            <if test="company_property != null and company_property != ''">
                company_property,
            </if>
            <if test="product_franchise_attribute != null and product_franchise_attribute != ''">
                product_franchise_attribute,
            </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                #{product_code},
            </if>
            <if test="storeId != null and storeId != ''"> #{storeId},</if>
            <if test="platform_property != null and platform_property != ''">
                #{platform_property},
            </if>
            <if test="company_property != null and company_property != ''">
                #{company_property},
            </if>
            <if test="product_franchise_attribute != null and product_franchise_attribute != ''">
                #{product_franchise_attribute},
            </if>
        </trim>

    </insert>

    <insert id="addProductAdd12" parameterType="pd" >
        insert into s_gxhpz_product_dtpinfo
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                product_code,
            </if>
            <if test="storeId != null and storeId != ''">
                storeId,
            </if>
            <if test="is_insurance_drug != null and is_insurance_drug != ''">
                is_insurance_drug,
            </if>
            <if test="insurance_category != null and insurance_category != ''">
                insurance_category,
            </if>
            <if test="purchase_limit_quantity != null and purchase_limit_quantity != ''">
                purchase_limit_quantity,
            </if>
            <if test="prescription_required != null and prescription_required != ''">
                prescription_required,
            </if>
            <if test="prohibit_ordering != null and prohibit_ordering != ''">
                prohibit_ordering,
            </if>
            <if test="mid_pack_order_logic != null and mid_pack_order_logic != ''">
                mid_pack_order_logic,
            </if>
            <if test="max_order_limit != null and max_order_limit != ''">
                max_order_limit,
            </if>
            <if test="registered_item != null and registered_item != ''">
                registered_item,
            </if>
            <if test="follow_up_item != null and follow_up_item != ''">
                follow_up_item,
            </if>
            <if test="cold_chain_item != null and cold_chain_item != ''">
                cold_chain_item,
            </if>
            <if test="flow_item != null and flow_item != ''">
                flow_item,
            </if>
            <if test="charity_aid_item != null and charity_aid_item != ''">
                charity_aid_item,
            </if>
            <if test="dosage_max != null and dosage_max != ''">
                dosage_max,
            </if>
            <if test="dosage_min != null and dosage_min != ''">
                dosage_min,
            </if>
            <if test="dosage_normal != null and dosage_normal != ''">
                dosage_normal,
            </if>
            <if test="unit_normal != null and unit_normal != ''">
                unit_normal,
            </if>
            <if test="unit_max != null and unit_max != ''">
                unit_max,
            </if>
            <if test="unit_min != null and unit_min != ''">
                unit_min,
            </if>
            <if test="packing_unit != null and packing_unit != ''">
                packing_unit,
            </if>
            <if test="packing_value != null and packing_value != ''">
                packing_value,
            </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
            <if test="product_code != null and product_code != ''">
                #{product_code},
            </if>
            <if test="storeId != null and storeId != ''">
                #{storeId},
            </if>
            <if test="is_insurance_drug != null and is_insurance_drug != ''">
                #{is_insurance_drug},
            </if>
            <if test="insurance_category != null and insurance_category != ''">
                #{insurance_category},
            </if>
            <if test="purchase_limit_quantity != null and purchase_limit_quantity != ''">
                #{purchase_limit_quantity},
            </if>
            <if test="prescription_required != null and prescription_required != ''">
                #{prescription_required},
            </if>
            <if test="prohibit_ordering != null and prohibit_ordering != ''">
                #{prohibit_ordering},
            </if>
            <if test="mid_pack_order_logic != null and mid_pack_order_logic != ''">
                #{mid_pack_order_logic},
            </if>
            <if test="max_order_limit != null and max_order_limit != ''">
                #{max_order_limit},
            </if>
            <if test="registered_item != null and registered_item != ''">
                #{registered_item},
            </if>
            <if test="follow_up_item != null and follow_up_item != ''">
                #{follow_up_item},
            </if>
            <if test="cold_chain_item != null and cold_chain_item != ''">
                #{cold_chain_item},
            </if>
            <if test="flow_item != null and flow_item != ''">
                #{flow_item},
            </if>
            <if test="charity_aid_item != null and charity_aid_item != ''">
                #{charity_aid_item},
            </if>
            <if test="dosage_max != null and dosage_max != ''">
                #{dosage_max},
            </if>
            <if test="dosage_min != null and dosage_min != ''">
                #{dosage_min},
            </if>
            <if test="dosage_normal != null and dosage_normal != ''">
                #{dosage_normal},
            </if>
            <if test="unit_normal != null and unit_normal != ''">
                #{unit_normal},
            </if>
            <if test="unit_max != null and unit_max != ''">
                #{unit_max},
            </if>
            <if test="unit_min != null and unit_min != ''">
                #{unit_min},
            </if>
            <if test="packing_unit != null and packing_unit != ''">
                #{packing_unit},
            </if>
            <if test="packing_value != null and packing_value != ''">
                #{packing_value},
            </if>
        </trim>

    </insert>

    <select id="findSPProductinfoProductCode" parameterType="pd" resultType="pd">
        select product_code from s_gxhpz_product_info where 1=1
        <if test="product_name != null and product_name != ''">
            and product_name = #{product_name}
        </if>
        <if test="product_code != null and product_code != ''">
            and product_code = #{product_code}
        </if>
        <if test="ids != null">
            and id in(${ids})
        </if>
        <if test="id != null">
            and id =#{id}
        </if>
    </select>

    <delete id="deleteProductByCode" parameterType="pd">
        <if test="product_code != null">
            DELETE FROM s_gxhpz_product_zg WHERE product_code = #{product_code}
        </if>
    </delete>

    <delete id="deleteProductInformationByCode" parameterType="string">
        <if test="product_code != null">
            DELETE FROM s_gxhpz_product_information WHERE product_code = #{product_code}
        </if>
    </delete>

    <delete id="deleteProductDetailsByCode" parameterType="string">
        <if test="product_code != null">
            DELETE FROM s_gxhpz_product_details WHERE product_code = #{product_code}
        </if>
    </delete>

    <delete id="deleteProductClassificationByCode" parameterType="string">
        <if test="product_code != null">
            DELETE FROM s_gxhpz_product_classification WHERE product_code = #{product_code}
        </if>
    </delete>

    <delete id="deleteProductAttributesByCode" parameterType="string">
        <if test="product_code != null">
            DELETE FROM s_gxhpz_product_attributes WHERE product_code = #{product_code}
        </if>
    </delete>

    <delete id="deleteProductDtpinfoByCode" parameterType="string">
        <if test="product_code != null">
            DELETE FROM s_gxhpz_product_dtpinfo WHERE product_code = #{product_code}
        </if>
    </delete>


    <update id="productUpdate" parameterType="pd" >
        update s_gxhpz_product_info
        <set>
            <trim suffixOverrides=",">
                <!-- 产品基本信息 -->
                <if test="product_name != null and product_name != ''">
                    product_name=#{product_name},
                </if>
                <if test="mnemonic_code != null and mnemonic_code != ''">
                    mnemonic_code=#{mnemonic_code},
                </if>
                <if test="product_description != null and product_description != ''">
                    product_description=#{product_description},
                </if>
                <if test="generic_name != null and generic_name != ''">
                    generic_name=#{generic_name},
                </if>
                <if test="generic_mnemonic_code != null and generic_mnemonic_code != ''">
                    generic_mnemonic_code=#{generic_mnemonic_code},
                </if>
                <if test="generic_previous_names != null and generic_previous_names != ''">
                    generic_previous_names=#{generic_previous_names},
                </if>

                <!-- 产品规格和包装 -->
                <if test="base_unit != null and base_unit != ''">
                    base_unit=#{base_unit},
                </if>
                <if test="trademark != null and trademark != ''">
                    trademark=#{trademark},
                </if>
                <if test="specification != null and specification != ''">
                    specification=#{specification},
                </if>
                <if test="packaging != null and packaging != ''">
                    packaging=#{packaging},
                </if>
                <if test="international_barcode != null and international_barcode != ''">
                    international_barcode=#{international_barcode},
                </if>

                <!-- 生产商信息 -->
                <if test="manufacturer != null and manufacturer != ''">
                    manufacturer=#{manufacturer},
                </if>
                <if test="entrusted_manufacturer != null and entrusted_manufacturer != ''">
                    entrusted_manufacturer=#{entrusted_manufacturer},
                </if>
                <if test="manufacturer_abbreviation != null and manufacturer_abbreviation != ''">
                    manufacturer_abbreviation=#{manufacturer_abbreviation},
                </if>
                <if test="origin != null and origin != ''">
                    origin=#{origin},
                </if>

                <!-- 分类和状态 -->
                <if test="category_maj != null and category_maj != ''">
                    category_maj=#{category_maj},
                </if>
                <if test="category_min != null and category_min != ''">
                    category_min=#{category_min},
                </if>
                <if test="product_type != null and product_type != ''">
                    product_type=#{product_type},
                </if>
                <if test="product_status != null and product_status != ''">
                    product_status=#{product_status},
                </if>
                <if test="purchase_tax_rate != null and purchase_tax_rate != ''">
                    purchase_tax_rate=#{purchase_tax_rate},
                </if>
                <if test="sales_tax_rate != null and sales_tax_rate != ''">
                    sales_tax_rate=#{sales_tax_rate},
                </if>
                <if test="import_export_status != null and import_export_status != ''">
                    import_export_status=#{import_export_status},
                </if>
                <if test="major_category != null and major_category != ''">
                    major_category=#{major_category},
                </if>
                <if test="medium_category != null and medium_category != ''">
                    medium_category=#{medium_category},
                </if>
                <if test="minor_category != null and minor_category != ''">
                    minor_category=#{minor_category},
                </if>
                <if test="sub_category != null and sub_category != ''">
                    sub_category=#{sub_category},
                </if>

                <!-- 其他属性 -->
                <if test="ingredients != null and ingredients != ''">
                    ingredients=#{ingredients},
                </if>
                <if test="dtp_flag != null and dtp_flag != ''">
                    dtp_flag=#{dtp_flag},
                </if>
                <if test="daily_standard_consumption != null and daily_standard_consumption != ''">
                    daily_standard_consumption=#{daily_standard_consumption},
                </if>
                <if test="duplicate_suspected != null and duplicate_suspected != ''">
                    duplicate_suspected=#{duplicate_suspected},
                </if>
                <if test="alternative_code != null and alternative_code != ''">
                    alternative_code=#{alternative_code},
                </if>
                <if test="marketing_authorization_holder != null and marketing_authorization_holder != ''">
                    marketing_authorization_holder=#{marketing_authorization_holder},
                </if>
                <if test="medication_days != null and medication_days != ''">
                    medication_days=#{medication_days},
                </if>
                <if test="small_code_southchina_specific != null and small_code_southchina_specific != ''">
                    small_code_southchina_specific=#{small_code_southchina_specific},
                </if>
                <if test="corresponding_major_code != null and corresponding_major_code != ''">
                    corresponding_major_code=#{corresponding_major_code},
                </if>
                <if test="conversion_ratio_to_alternative != null and conversion_ratio_to_alternative != ''">
                    conversion_ratio_to_alternative=#{conversion_ratio_to_alternative},
                </if>
                <if test="disease_type != null and disease_type != ''">
                    disease_type=#{disease_type},
                </if>
                <if test="brand_manufacturer_name != null and brand_manufacturer_name != ''">
                    brand_manufacturer_name=#{brand_manufacturer_name},
                </if>
                <if test="group_name != null and group_name != ''">
                    group_name=#{group_name},
                </if>
                <if test="external_organization != null and external_organization != ''">
                    external_organization=#{external_organization},
                </if>
                <if test="national_negotiated_product != null and national_negotiated_product != ''">
                    national_negotiated_product=#{national_negotiated_product},
                </if>
                <if test="national_standard_code != null and national_standard_code != ''">
                    national_standard_code=#{national_standard_code},
                </if>
                <if test="national_standard_code_2 != null and national_standard_code_2 != ''">
                    national_standard_code_2=#{national_standard_code_2},
                </if>
                <if test="medical_insurance_min_dose_unit != null and medical_insurance_min_dose_unit != ''">
                    medical_insurance_min_dose_unit=#{medical_insurance_min_dose_unit},
                </if>
                <if test="medical_market_status != null and medical_market_status != ''">
                    medical_market_status=#{medical_market_status},
                </if>
                <if test="accounting_manufacturer != null and accounting_manufacturer != ''">
                    accounting_manufacturer=#{accounting_manufacturer},
                </if>
                <if test="department_affiliation != null and department_affiliation != ''">
                    department_affiliation=#{department_affiliation},
                </if>
                <if test="chronic_disease_first_line_treatment != null and chronic_disease_first_line_treatment != ''">
                    chronic_disease_first_line_treatment=#{chronic_disease_first_line_treatment},
                </if>
                <if test="is_medical_generic_name != null and is_medical_generic_name != ''">
                    is_medical_generic_name=#{is_medical_generic_name},
                </if>
                <if test="covid_tag != null and covid_tag != ''">
                    covid_tag=#{covid_tag},
                </if>
                <if test="product_remarks != null and product_remarks != ''">
                    product_remarks=#{product_remarks},
                </if>
            </trim>
        </set>
        where product_code = #{product_code}
    </update>

    <update id="productUpdate2" parameterType="pd" >
        update s_gxhpz_product_information
            <trim prefix="SET" suffixOverrides=",">
                <!-- 基本采购属性 -->
                <if test="reference_purchase_price != null and reference_purchase_price != ''">
                    reference_purchase_price=#{reference_purchase_price},
                </if>
                <if test="is_direct_to_warehouse != null and is_direct_to_warehouse != ''">
                    is_direct_to_warehouse=#{is_direct_to_warehouse},
                </if>
                <if test="purchase_group != null and purchase_group != ''">
                    purchase_group=#{purchase_group},
                </if>
                <if test="channel_attribute != null and channel_attribute != ''">
                    channel_attribute=#{channel_attribute},
                </if>
                <if test="purchase_organization != null and purchase_organization != ''">
                    purchase_organization=#{purchase_organization},
                </if>
                <if test="is_purchase_prohibited != null and is_purchase_prohibited != ''">
                    is_purchase_prohibited=#{is_purchase_prohibited},
                </if>

                <!-- 产品和品牌属性 -->
                <if test="group_product_purchase_attribute != null and group_product_purchase_attribute != ''">
                    group_product_purchase_attribute=#{group_product_purchase_attribute},
                </if>
                <if test="is_original_research != null and is_original_research != ''">
                    is_original_research=#{is_original_research},
                </if>
                <if test="brand_attribute != null and brand_attribute != ''">
                    brand_attribute=#{brand_attribute},
                </if>
                <if test="consumer_health_own_brand != null and consumer_health_own_brand != ''">
                    consumer_health_own_brand=#{consumer_health_own_brand},
                </if>
                <if test="health_category != null and health_category != ''">
                    health_category=#{health_category},
                </if>

                <!-- 注册和管理属性 -->
                <if test="registrant_unified_social_credit_code != null and registrant_unified_social_credit_code != ''">
                    registrant_unified_social_credit_code=#{registrant_unified_social_credit_code},
                </if>
                <if test="is_broad_dtp != null and is_broad_dtp != ''">
                    is_broad_dtp=#{is_broad_dtp},
                </if>
                <if test="purchase_attribute != null and purchase_attribute != ''">
                    purchase_attribute=#{purchase_attribute},
                </if>
                <if test="operation_attribute != null and operation_attribute != ''">
                    operation_attribute=#{operation_attribute},
                </if>
                <if test="archive_number != null and archive_number != ''">
                    archive_number=#{archive_number},
                </if>

                <!-- 销售和特殊属性 -->
                <if test="special_sales_attribute != null and special_sales_attribute != ''">
                    special_sales_attribute=#{special_sales_attribute},
                </if>
                <if test="is_normal_stock_in_central_warehouse != null and is_normal_stock_in_central_warehouse != ''">
                    is_normal_stock_in_central_warehouse=#{is_normal_stock_in_central_warehouse},
                </if>
                <if test="is_first_operation != null and is_first_operation != ''">
                    is_first_operation=#{is_first_operation},
                </if>
                <if test="data_creation_time != null and data_creation_time != ''">
                    data_creation_time=#{data_creation_time},
                </if>
                <if test="product_mid_code_strategy != null and product_mid_code_strategy != ''">
                    product_mid_code_strategy=#{product_mid_code_strategy},
                </if>

                <!-- 其他属性 -->
                <if test="is_completed_component_analysis != null and is_completed_component_analysis != ''">
                    is_completed_component_analysis=#{is_completed_component_analysis},
                </if>
                <if test="sales_control_attribute != null and sales_control_attribute != ''">
                    sales_control_attribute=#{sales_control_attribute},
                </if>
                <if test="four_plus_seven_label != null and four_plus_seven_label != ''">
                    four_plus_seven_label=#{four_plus_seven_label},
                </if>
                <if test="platform_common_recommendation != null and platform_common_recommendation != ''">
                    platform_common_recommendation=#{platform_common_recommendation},
                </if>
                <if test="commercial_large_circulation_product != null and commercial_large_circulation_product != ''">
                    commercial_large_circulation_product=#{commercial_large_circulation_product},
                </if>
                <if test="unified_procurement_elimination_time != null and unified_procurement_elimination_time != ''">
                    unified_procurement_elimination_time=#{unified_procurement_elimination_time},
                </if>
                <if test="centralized_procurement_elimination_time != null and centralized_procurement_elimination_time != ''">
                    centralized_procurement_elimination_time=#{centralized_procurement_elimination_time},
                </if>
                <if test="zc_special_attributes != null and zc_special_attributes != ''">
                    zc_special_attributes=#{zc_special_attributes},
                </if>
                <if test="old_new_code_conversion_ratio != null and old_new_code_conversion_ratio != ''">
                    old_new_code_conversion_ratio=#{old_new_code_conversion_ratio},
                </if>
                <if test="dual_channel_drug != null and dual_channel_drug != ''">
                    dual_channel_drug=#{dual_channel_drug},
                </if>
                <if test="national_negotiated_price != null and national_negotiated_price != ''">
                    national_negotiated_price=#{national_negotiated_price},
                </if>
                <if test="guangzhou_pharmaceutical_supervision_code != null and guangzhou_pharmaceutical_supervision_code != ''">
                    guangzhou_pharmaceutical_supervision_code=#{guangzhou_pharmaceutical_supervision_code},
                </if>
                <if test="coordinated_reimbursement_product != null and coordinated_reimbursement_product != ''">
                    coordinated_reimbursement_product=#{coordinated_reimbursement_product},
                </if>
                <if test="two_pantry_goods_attribute != null and two_pantry_goods_attribute != ''">
                    two_pantry_goods_attribute=#{two_pantry_goods_attribute},
                </if>
                <if test="is_store_operation_restricted != null and is_store_operation_restricted != ''">
                    is_store_operation_restricted=#{is_store_operation_restricted},
                </if>
                <if test="can_be_allocated_to_franchise_stores != null and can_be_allocated_to_franchise_stores != ''">
                    can_be_allocated_to_franchise_stores=#{can_be_allocated_to_franchise_stores},
                </if>
                <if test="franchise_stores_enjoy_unified_procurement_policy != null and franchise_stores_enjoy_unified_procurement_policy != ''">
                    franchise_stores_enjoy_unified_procurement_policy=#{franchise_stores_enjoy_unified_procurement_policy},
                </if>
                <if test="medical_insurance_purchase_type != null and medical_insurance_purchase_type != ''">
                    medical_insurance_purchase_type=#{medical_insurance_purchase_type},
                </if>
            </trim>
        where product_code = #{product_code}
    </update>

    <update id="productUpdate3" parameterType="pd" >
        update s_gxhpz_product_classification
        <set>
            <trim suffixOverrides=",">
                <if test="storage_category != null and storage_category != ''">
                    storage_category=#{storage_category},
                </if>
                <if test="is_fragile != null and is_fragile != ''">
                    is_fragile=#{is_fragile},
                </if>
                <if test="is_hazardous != null and is_hazardous != ''">
                    is_hazardous=#{is_hazardous},
                </if>
                <if test="is_odd_shape != null and is_odd_shape != ''">
                    is_odd_shape=#{is_odd_shape},
                </if>
                <if test="basic_package_length != null and basic_package_length != ''">
                    basic_package_length=#{basic_package_length},
                </if>
                <if test="basic_package_width != null and basic_package_width != ''">
                    basic_package_width=#{basic_package_width},
                </if>
                <if test="basic_package_height != null and basic_package_height != ''">
                    basic_package_height=#{basic_package_height},
                </if>
                <if test="minimum_package_quantity != null and minimum_package_quantity != ''">
                    minimum_package_quantity=#{minimum_package_quantity},
                </if>
                <if test="medium_package_quantity != null and medium_package_quantity != ''">
                    medium_package_quantity=#{medium_package_quantity},
                </if>
                <if test="box_package_quantity != null and box_package_quantity != ''">
                    box_package_quantity=#{box_package_quantity},
                </if>
                <if test="is_medium_package_enabled != null and is_medium_package_enabled != ''">
                    is_medium_package_enabled=#{is_medium_package_enabled},
                </if>
                <if test="medium_package_request_ratio != null and medium_package_request_ratio != ''">
                    medium_package_request_ratio=#{medium_package_request_ratio},
                </if>
            </trim>
        </set>
        where product_code = #{product_code}
    </update>

    <update id="productUpdate4" parameterType="pd" >
        update s_gxhpz_product_zg
        <set>
            <trim suffixOverrides=",">
                <if test="is_production_batch_management != null and is_production_batch_management != ''">
                    is_production_batch_management=#{is_production_batch_management},
                </if>
                <if test="business_scope != null and business_scope != ''">
                    business_scope=#{business_scope},
                </if>
                <if test="prescription_category != null and prescription_category != ''">
                    prescription_category=#{prescription_category},
                </if>
                <if test="prescription_category_secondary != null and prescription_category_secondary != ''">
                    prescription_category_secondary=#{prescription_category_secondary},
                </if>
                <if test="prescription_category_tertiary != null and prescription_category_tertiary != ''">
                    prescription_category_tertiary=#{prescription_category_tertiary},
                </if>
                <if test="approval_number_1 != null and approval_number_1 != ''">
                    approval_number_1=#{approval_number_1},
                </if>
                <if test="approval_number_1_expiry != null and approval_number_1_expiry != ''">
                    approval_number_1_expiry=#{approval_number_1_expiry},
                </if>
                <if test="approval_number_2 != null and approval_number_2 != ''">
                    approval_number_2=#{approval_number_2},
                </if>
                <if test="approval_number_2_expiry != null and approval_number_2_expiry != ''">
                    approval_number_2_expiry=#{approval_number_2_expiry},
                </if>
                <if test="registration_certificate_1 != null and registration_certificate_1 != ''">
                    registration_certificate_1=#{registration_certificate_1},
                </if>
                <if test="registration_certificate_1_expiry != null and registration_certificate_1_expiry != ''">
                    registration_certificate_1_expiry=#{registration_certificate_1_expiry},
                </if>
                <if test="registration_certificate_2 != null and registration_certificate_2 != ''">
                    registration_certificate_2=#{registration_certificate_2},
                </if>
                <if test="registration_certificate_2_expiry != null and registration_certificate_2_expiry != ''">
                    registration_certificate_2_expiry=#{registration_certificate_2_expiry},
                </if>
                <if test="production_license != null and production_license != ''">
                    production_license=#{production_license},
                </if>
                <if test="production_license_expiry != null and production_license_expiry != ''">
                    production_license_expiry=#{production_license_expiry},
                </if>
                <if test="is_cold_chain_drug != null and is_cold_chain_drug != ''">
                    is_cold_chain_drug=#{is_cold_chain_drug},
                </if>
                <if test="is_second_inspection != null and is_second_inspection != ''">
                    is_second_inspection=#{is_second_inspection},
                </if>
                <if test="local_code != null and local_code != ''">
                    local_code=#{local_code},
                </if>
                <if test="pharmacology_toxicology != null and pharmacology_toxicology != ''">
                    pharmacology_toxicology=#{pharmacology_toxicology},
                </if>
                <if test="clinical_trial != null and clinical_trial != ''">
                    clinical_trial=#{clinical_trial},
                </if>
                <if test="drug_overdose != null and drug_overdose != ''">
                    drug_overdose=#{drug_overdose},
                </if>
                <if test="elderly_patient_usage != null and elderly_patient_usage != ''">
                    elderly_patient_usage=#{elderly_patient_usage},
                </if>
                <if test="pediatric_patient_usage != null and pediatric_patient_usage != ''">
                    pediatric_patient_usage=#{pediatric_patient_usage},
                </if>
                <if test="pregnant_breastfeeding_usage != null and pregnant_breastfeeding_usage != ''">
                    pregnant_breastfeeding_usage=#{pregnant_breastfeeding_usage},
                </if>
                <if test="zgingredients != null and zgingredients != ''">
                    zgingredients=#{zgingredients},
                </if>
                <if test="group_quality_status != null and group_quality_status != ''">
                    group_quality_status=#{group_quality_status},
                </if>
                <if test="package_specification != null and package_specification != ''">
                    package_specification=#{package_specification},
                </if>
                <if test="storage_conditions != null and storage_conditions != ''">
                    storage_conditions=#{storage_conditions},
                </if>
                <if test="has_traceability_code != null and has_traceability_code != ''">
                    has_traceability_code=#{has_traceability_code},
                </if>
                <if test="acceptance_period_days != null and acceptance_period_days != ''">
                    acceptance_period_days=#{acceptance_period_days},
                </if>
                <if test="is_serial_number_managed != null and is_serial_number_managed != ''">
                    is_serial_number_managed=#{is_serial_number_managed},
                </if>
                <if test="near_expiry_date != null and near_expiry_date != ''">
                    near_expiry_date=#{near_expiry_date},
                </if>
                <if test="company_approval_expiry != null and company_approval_expiry != ''">
                    company_approval_expiry=#{company_approval_expiry},
                </if>
                <if test="company_registration_expiry != null and company_registration_expiry != ''">
                    company_registration_expiry=#{company_registration_expiry},
                </if>
                <if test="is_scan_traceable != null and is_scan_traceable != ''">
                    is_scan_traceable=#{is_scan_traceable},
                </if>
                <if test="wildlife_management_identification != null and wildlife_management_identification != ''">
                    wildlife_management_identification=#{wildlife_management_identification},
                </if>
                <if test="special_sales_control != null and special_sales_control != ''">
                    special_sales_control=#{special_sales_control},
                </if>
                <if test="is_udi_scanned != null and is_udi_scanned != ''">
                    is_udi_scanned=#{is_udi_scanned},
                </if>
                <if test="max_prescription_days != null and max_prescription_days != ''">
                    max_prescription_days=#{max_prescription_days},
                </if>
                <if test="restricted_usage != null and restricted_usage != ''">
                    restricted_usage=#{restricted_usage},
                </if>
            </trim>
        </set>
        where product_code = #{product_code}
    </update>

    <update id="productUpdate5" parameterType="pd" >
        update s_gxhpz_product_details
        <set>
            <trim suffixOverrides=",">
                <if test="reference_retail_price != null and reference_retail_price != ''">
                    reference_retail_price=#{reference_retail_price},
                </if>
                <if test="online_sales != null and online_sales != ''">
                    online_sales=#{online_sales},
                </if>
                <if test="mid_platform_product_spuid != null and mid_platform_product_spuid != ''">
                    mid_platform_product_spuid=#{mid_platform_product_spuid},
                </if>
                <if test="mid_platform_product_type != null and mid_platform_product_type != ''">
                    mid_platform_product_type=#{mid_platform_product_type},
                </if>
                <if test="external_transmission_system != null and external_transmission_system != ''">
                    external_transmission_system=#{external_transmission_system},
                </if>
                <if test="online_o2o != null and online_o2o != ''">
                    online_o2o=#{online_o2o},
                </if>
                <if test="online_b2c != null and online_b2c != ''">
                    online_b2c=#{online_b2c},
                </if>
                <if test="online_mutual_medical != null and online_mutual_medical != ''">
                    online_mutual_medical=#{online_mutual_medical},
                </if>
                <if test="online_brand_health != null and online_brand_health != ''">
                    online_brand_health=#{online_brand_health},
                </if>
                <if test="xproduct_name != null and xproduct_name != ''">
                    xproduct_name=#{xproduct_name},
                </if>
                <if test="minimum_display_quantity != null and minimum_display_quantity != ''">
                    minimum_display_quantity=#{minimum_display_quantity},
                </if>
                <if test="sales_attributes != null and sales_attributes != ''">
                    sales_attributes=#{sales_attributes},
                </if>
                <if test="prohibit_delivery != null and prohibit_delivery != ''">
                    prohibit_delivery=#{prohibit_delivery},
                </if>
                <if test="prohibit_return_warehouse != null and prohibit_return_warehouse != ''">
                    prohibit_return_warehouse=#{prohibit_return_warehouse},
                </if>
                <if test="prohibit_sales != null and prohibit_sales != ''">
                    prohibit_sales=#{prohibit_sales},
                </if>
                <if test="can_be_divided != null and can_be_divided != ''">
                    can_be_divided=#{can_be_divided},
                </if>
                <if test="division_unit != null and division_unit != ''">
                    division_unit=#{division_unit},
                </if>
                <if test="division_ratio != null and division_ratio != ''">
                    division_ratio=#{division_ratio},
                </if>
                <if test="daas_business_model != null and daas_business_model != ''">
                    daas_business_model=#{daas_business_model},
                </if>
                <if test="promotion_approval != null and promotion_approval != ''">
                    promotion_approval=#{promotion_approval},
                </if>
                <if test="wholesale_priority_level != null and wholesale_priority_level != ''">
                    wholesale_priority_level=#{wholesale_priority_level},
                </if>
                <if test="external_packaging_path != null and external_packaging_path != ''">
                    external_packaging_path=#{external_packaging_path},
                </if>
                <if test="can_view != null and can_view != ''">
                    can_view=#{can_view},
                </if>
                <if test="can_delete != null and can_delete != ''">
                    can_delete=#{can_delete},
                </if>
            </trim>
        </set>
        where product_code = #{product_code}
    </update>

    <update id="productUpdate6" parameterType="pd" >
        update s_gxhpz_product_attributes
        <set>
            <trim suffixOverrides=",">
                <if test="platform_property != null and platform_property != ''">
                    platform_property=#{platform_property},
                </if>
                <if test="company_property != null and company_property != ''">
                    company_property=#{company_property},
                </if>
                <if test="product_franchise_attribute != null and product_franchise_attribute != ''">
                    product_franchise_attribute=#{product_franchise_attribute},
                </if>
            </trim>
        </set>
        where product_code = #{product_code}
    </update>

    <update id="productUpdate12" parameterType="pd" >
        update s_gxhpz_product_dtpinfo
        <set>
            <trim suffixOverrides=",">
                <if test="is_insurance_drug != null and is_insurance_drug != ''">
                    is_insurance_drug=#{is_insurance_drug},
                </if>
                <if test="insurance_category != null and insurance_category != ''">
                    insurance_category=#{insurance_category},
                </if>
                <if test="purchase_limit_quantity != null and purchase_limit_quantity != ''">
                    purchase_limit_quantity=#{purchase_limit_quantity},
                </if>
                <if test="prescription_required != null and prescription_required != ''">
                    prescription_required=#{prescription_required},
                </if>
                <if test="prohibit_ordering != null and prohibit_ordering != ''">
                    prohibit_ordering=#{prohibit_ordering},
                </if>
                <if test="mid_pack_order_logic != null and mid_pack_order_logic != ''">
                    mid_pack_order_logic=#{mid_pack_order_logic},
                </if>
                <if test="max_order_limit != null and max_order_limit != ''">
                    max_order_limit=#{max_order_limit},
                </if>
                <if test="registered_item != null and registered_item != ''">
                    registered_item=#{registered_item},
                </if>
                <if test="follow_up_item != null and follow_up_item != ''">
                    follow_up_item=#{follow_up_item},
                </if>
                <if test="drug_delivery_way != null and drug_delivery_way != ''">
                    drug_delivery_way=#{drug_delivery_way},
                </if>
                <if test="cold_chain_item != null and cold_chain_item != ''">
                    cold_chain_item=#{cold_chain_item},
                </if>
                <if test="flow_item != null and flow_item != ''">
                    flow_item=#{flow_item},
                </if>
                <if test="charity_aid_item != null and charity_aid_item != ''">
                    charity_aid_item=#{charity_aid_item},
                </if>
                <if test="dosage_max != null and dosage_max != ''">
                    dosage_max=#{dosage_max},
                </if>
                <if test="dosage_min != null and dosage_min != ''">
                    dosage_min=#{dosage_min},
                </if>
                <if test="dosage_normal != null and dosage_normal != ''">
                    dosage_normal=#{dosage_normal},
                </if>
                <if test="unit_normal != null and unit_normal != ''">
                    unit_normal=#{unit_normal},
                </if>
                <if test="unit_max != null and unit_max != ''">
                    unit_max=#{unit_max},
                </if>
                <if test="unit_min != null and unit_min != ''">
                    unit_min=#{unit_min},
                </if>
                <if test="packing_unit != null and packing_unit != ''">
                    packing_unit=#{packing_unit},
                </if>
                <if test="packing_value != null and packing_value != ''">
                    packing_value=#{packing_value},
                </if>
            </trim>
        </set>
        where product_code = #{product_code}

    </update>
    <select id="findSPProductinfoCode" parameterType="pd" resultType="pd">
        SELECT
            COALESCE(pi.product_code, '0') AS code,
            COALESCE(di.product_code, '0') AS code12,
            COALESCE(pf.product_code, '0') AS code3,
            COALESCE(zg.product_code, '0') AS code4,
            COALESCE(pd.product_code, '0') AS code5,
            COALESCE(pc.product_code, '0') AS code6,
            COALESCE(pa.product_code, '0') AS code7
        FROM s_gxhpz_product_info pi
                 LEFT JOIN s_gxhpz_product_dtpinfo di ON di.product_code = pi.product_code
                 LEFT JOIN s_gxhpz_product_information pf ON pf.product_code = pi.product_code
                 LEFT JOIN s_gxhpz_product_zg zg ON zg.product_code = pi.product_code
                 LEFT JOIN s_gxhpz_product_details pd ON pd.product_code = pi.product_code
                 LEFT JOIN s_gxhpz_product_classification pc ON pc.product_code = pi.product_code
                 LEFT JOIN s_gxhpz_product_attributes pa ON pa.product_code = pi.product_code
        WHERE pi.product_code = #{product_code}

    </select>


</mapper>
