<?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="cn.iocoder.yudao.module.shop.mapper.ShopConfigMapper">

    <resultMap type="cn.iocoder.yudao.module.shop.entity.ShopConfig" id="ShopConfigResult">
        <result property="id"    column="id"    />
        <result property="groupTel"    column="group_tel"    />
        <result property="groupAddress"    column="group_address"    />
        <result property="groupLatitude"    column="group_latitude"    />
        <result property="groupLongitude"    column="group_longitude"    />
        <result property="carTel"    column="car_tel"    />
        <result property="userCarPostNum"    column="user_car_post_num"    />
        <result property="inspectionTel"    column="inspection_tel"    />
        <result property="schoolTel"    column="school_tel"    />
        <result property="schoolAddress"    column="school_address"    />
        <result property="schoolLatitude"    column="school_latitude"    />
        <result property="schoolLongitude"    column="school_longitude"    />
        <result property="schoolDeposit"    column="school_deposit"    />
        <result property="dayRescueTel"    column="day_rescue_tel"    />
        <result property="nightRescueTel"    column="night_rescue_tel"    />
        <result property="repairTel"    column="repair_tel"    />
        <result property="inspectionSilver"    column="inspection_silver"    />
        <result property="inspectionGold"    column="inspection_gold"    />
        <result property="inspectionPlatinum"    column="inspection_platinum"    />
        <result property="repairSilver"    column="repair_silver"    />
        <result property="repairGold"    column="repair_gold"    />
        <result property="repairPlatinum"    column="repair_platinum"    />
        <result property="mallSilver"    column="mall_silver"    />
        <result property="mallGold"    column="mall_gold"    />
        <result property="mallPlatinum"    column="mall_platinum"    />
        <result property="shopUserSilver"    column="shop_user_silver"    />
        <result property="shopUserGold"    column="shop_user_gold"    />
        <result property="shopUserPlatinum"    column="shop_user_platinum"    />
        <result property="isRegistrationUpgradePlatinum"    column="is_registration_upgrade_platinum"    />
        <result property="insuranceTel"    column="insurance_tel"    />
        <result property="silverIntro"    column="silver_intro"    />
        <result property="silverConditions"    column="silver_conditions"    />
        <result property="goldIntro"    column="gold_intro"    />
        <result property="goldConditions"    column="gold_conditions"    />
        <result property="platinumIntro"    column="platinum_intro"    />
        <result property="platinumConditions"    column="platinum_conditions"    />
        <result property="inviteRewards"    column="invite_rewards"    />
        <result property="royalty"    column="royalty"    />
        <result property="inspectionSteps"    column="inspection_steps"    />
        <result property="insuranceText"    column="insurance_text"    />
        <result property="fzRatio"    column="fz_ratio"    />
    </resultMap>

    <sql id="selectShopConfigVo">
        select id, group_tel, group_address, group_latitude, group_longitude, car_tel, user_car_post_num, inspection_tel,
        school_tel, school_address, school_latitude, school_longitude, school_deposit/100 as school_deposit, day_rescue_tel,
        night_rescue_tel, repair_tel, inspection_silver, inspection_gold, inspection_platinum, repair_silver, repair_gold,
        repair_platinum, mall_silver, mall_gold, mall_platinum, shop_user_silver, shop_user_gold, shop_user_platinum, is_registration_upgrade_platinum,
        insurance_tel,silver_intro,silver_conditions,gold_intro,gold_conditions,platinum_intro,platinum_conditions,invite_rewards,royalty,inspection_steps,insurance_text,fz_ratio from shop_config
    </sql>

    <select id="selectShopConfigList" parameterType="cn.iocoder.yudao.module.shop.entity.ShopConfig" resultMap="ShopConfigResult">
        <include refid="selectShopConfigVo"/>
        <where>
            <if test="groupTel != null  and groupTel != ''"> and group_tel = #{groupTel}</if>
            <if test="groupAddress != null  and groupAddress != ''"> and group_address = #{groupAddress}</if>
            <if test="groupLatitude != null  and groupLatitude != ''"> and group_latitude = #{groupLatitude}</if>
            <if test="groupLongitude != null  and groupLongitude != ''"> and group_longitude = #{groupLongitude}</if>
            <if test="carTel != null  and carTel != ''"> and car_tel = #{carTel}</if>
            <if test="userCarPostNum != null "> and user_car_post_num = #{userCarPostNum}</if>
            <if test="inspectionTel != null  and inspectionTel != ''"> and inspection_tel = #{inspectionTel}</if>
            <if test="schoolTel != null  and schoolTel != ''"> and school_tel = #{schoolTel}</if>
            <if test="schoolAddress != null  and schoolAddress != ''"> and school_address = #{schoolAddress}</if>
            <if test="schoolLatitude != null  and schoolLatitude != ''"> and school_latitude = #{schoolLatitude}</if>
            <if test="schoolLongitude != null  and schoolLongitude != ''"> and school_longitude = #{schoolLongitude}</if>
            <if test="schoolDeposit != null  and schoolDeposit != ''"> and school_deposit = #{schoolDeposit}</if>
            <if test="dayRescueTel != null  and dayRescueTel != ''"> and day_rescue_tel = #{dayRescueTel}</if>
            <if test="nightRescueTel != null  and nightRescueTel != ''"> and night_rescue_tel = #{nightRescueTel}</if>
            <if test="repairTel != null  and repairTel != ''"> and repair_tel = #{repairTel}</if>
            <if test="inspectionSilver != null "> and inspection_silver = #{inspectionSilver}</if>
            <if test="inspectionGold != null "> and inspection_gold = #{inspectionGold}</if>
            <if test="inspectionPlatinum != null "> and inspection_platinum = #{inspectionPlatinum}</if>
            <if test="repairSilver != null "> and repair_silver = #{repairSilver}</if>
            <if test="repairGold != null "> and repair_gold = #{repairGold}</if>
            <if test="repairPlatinum != null "> and repair_platinum = #{repairPlatinum}</if>
            <if test="mallSilver != null "> and mall_silver = #{mallSilver}</if>
            <if test="mallGold != null "> and mall_gold = #{mallGold}</if>
            <if test="mallPlatinum != null "> and mall_platinum = #{mallPlatinum}</if>
            <if test="shopUserSilver != null "> and shop_user_silver = #{shopUserSilver}</if>
            <if test="shopUserGold != null "> and shop_user_gold = #{shopUserGold}</if>
            <if test="shopUserPlatinum != null "> and shop_user_platinum = #{shopUserPlatinum}</if>
            <if test="isRegistrationUpgradePlatinum != null "> and is_registration_upgrade_platinum = #{isRegistrationUpgradePlatinum}</if>
            <if test="insuranceText != null "> and insurance_text = #{insuranceText}</if>
        </where>
    </select>

    <select id="selectShopConfigById" parameterType="Long" resultMap="ShopConfigResult">
        <include refid="selectShopConfigVo"/>
        where id = #{id}
    </select>

    <insert id="insertShopConfig" parameterType="cn.iocoder.yudao.module.shop.entity.ShopConfig" useGeneratedKeys="true" keyProperty="id">
        insert into shop_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="groupTel != null and groupTel != ''">group_tel,</if>
            <if test="groupAddress != null and groupAddress != ''">group_address,</if>
            <if test="groupLatitude != null and groupLatitude != ''">group_latitude,</if>
            <if test="groupLongitude != null and groupLongitude != ''">group_longitude,</if>
            <if test="carTel != null and carTel != ''">car_tel,</if>
            <if test="userCarPostNum != null">user_car_post_num,</if>
            <if test="inspectionTel != null and inspectionTel != ''">inspection_tel,</if>
            <if test="schoolTel != null and schoolTel != ''">school_tel,</if>
            <if test="schoolAddress != null and schoolAddress != ''">school_address,</if>
            <if test="schoolLatitude != null and schoolLatitude != ''">school_latitude,</if>
            <if test="schoolLongitude != null and schoolLongitude != ''">school_longitude,</if>
            <if test="schoolDeposit != null and schoolDeposit != ''">school_deposit,</if>
            <if test="dayRescueTel != null and dayRescueTel != ''">day_rescue_tel,</if>
            <if test="nightRescueTel != null and nightRescueTel != ''">night_rescue_tel,</if>
            <if test="repairTel != null and repairTel != ''">repair_tel,</if>
            <if test="inspectionSilver != null">inspection_silver,</if>
            <if test="inspectionGold != null">inspection_gold,</if>
            <if test="inspectionPlatinum != null">inspection_platinum,</if>
            <if test="repairSilver != null">repair_silver,</if>
            <if test="repairGold != null">repair_gold,</if>
            <if test="repairPlatinum != null">repair_platinum,</if>
            <if test="mallSilver != null">mall_silver,</if>
            <if test="mallGold != null">mall_gold,</if>
            <if test="mallPlatinum != null">mall_platinum,</if>
            <if test="shopUserSilver != null">shop_user_silver,</if>
            <if test="shopUserGold != null">shop_user_gold,</if>
            <if test="shopUserPlatinum != null">shop_user_platinum,</if>
            <if test="isRegistrationUpgradePlatinum != null">is_registration_upgrade_platinum,</if>
            <if test="insuranceTel != null">insurance_tel,</if>
            <if test="silverIntro != null">silver_intro,</if>
            <if test="silverConditions != null">silver_conditions,</if>
            <if test="goldIntro != null">gold_intro,</if>
            <if test="goldConditions != null">gold_conditions,</if>
            <if test="platinumIntro != null">platinum_intro,</if>
            <if test="platinumConditions != null">platinum_conditions,</if>
            <if test="insuranceText != null">insurance_text,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="groupTel != null and groupTel != ''">#{groupTel},</if>
            <if test="groupAddress != null and groupAddress != ''">#{groupAddress},</if>
            <if test="groupLatitude != null and groupLatitude != ''">#{groupLatitude},</if>
            <if test="groupLongitude != null and groupLongitude != ''">#{groupLongitude},</if>
            <if test="carTel != null and carTel != ''">#{carTel},</if>
            <if test="userCarPostNum != null">#{userCarPostNum},</if>
            <if test="inspectionTel != null and inspectionTel != ''">#{inspectionTel},</if>
            <if test="schoolTel != null and schoolTel != ''">#{schoolTel},</if>
            <if test="schoolAddress != null and schoolAddress != ''">#{schoolAddress},</if>
            <if test="schoolLatitude != null and schoolLatitude != ''">#{schoolLatitude},</if>
            <if test="schoolLongitude != null and schoolLongitude != ''">#{schoolLongitude},</if>
            <if test="schoolDeposit != null and schoolDeposit != ''">#{schoolDeposit} * 100,</if>
            <if test="dayRescueTel != null and dayRescueTel != ''">#{dayRescueTel},</if>
            <if test="nightRescueTel != null and nightRescueTel != ''">#{nightRescueTel},</if>
            <if test="repairTel != null and repairTel != ''">#{repairTel},</if>
            <if test="inspectionSilver != null">#{inspectionSilver},</if>
            <if test="inspectionGold != null">#{inspectionGold},</if>
            <if test="inspectionPlatinum != null">#{inspectionPlatinum},</if>
            <if test="repairSilver != null">#{repairSilver},</if>
            <if test="repairGold != null">#{repairGold},</if>
            <if test="repairPlatinum != null">#{repairPlatinum},</if>
            <if test="mallSilver != null">#{mallSilver},</if>
            <if test="mallGold != null">#{mallGold},</if>
            <if test="mallPlatinum != null">#{mallPlatinum},</if>
            <if test="shopUserSilver != null">#{shopUserSilver},</if>
            <if test="shopUserGold != null">#{shopUserGold},</if>
            <if test="shopUserPlatinum != null">#{shopUserPlatinum},</if>
            <if test="isRegistrationUpgradePlatinum != null">#{isRegistrationUpgradePlatinum},</if>
            <if test="insuranceTel != null">#{insuranceTel},</if>
            <if test="silverIntro != null">#{silverIntro},</if>
            <if test="silverConditions != null">#{silverConditions},</if>
            <if test="goldIntro != null">#{goldIntro},</if>
            <if test="goldConditions != null">#{goldConditions},</if>
            <if test="platinumIntro != null">#{platinumIntro},</if>
            <if test="platinumConditions != null">#{platinumConditions},</if>
            <if test="insuranceText != null">#{insuranceText},</if>
        </trim>
    </insert>

    <update id="updateShopConfig" parameterType="cn.iocoder.yudao.module.shop.entity.ShopConfig">
        update shop_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="groupTel != null and groupTel != ''">group_tel = #{groupTel},</if>
            <if test="groupAddress != null and groupAddress != ''">group_address = #{groupAddress},</if>
            <if test="groupLatitude != null and groupLatitude != ''">group_latitude = #{groupLatitude},</if>
            <if test="groupLongitude != null and groupLongitude != ''">group_longitude = #{groupLongitude},</if>
            <if test="carTel != null and carTel != ''">car_tel = #{carTel},</if>
            <if test="userCarPostNum != null">user_car_post_num = #{userCarPostNum},</if>
            <if test="inspectionTel != null and inspectionTel != ''">inspection_tel = #{inspectionTel},</if>
            <if test="schoolTel != null and schoolTel != ''">school_tel = #{schoolTel},</if>
            <if test="schoolAddress != null and schoolAddress != ''">school_address = #{schoolAddress},</if>
            <if test="schoolLatitude != null and schoolLatitude != ''">school_latitude = #{schoolLatitude},</if>
            <if test="schoolLongitude != null and schoolLongitude != ''">school_longitude = #{schoolLongitude},</if>
            <if test="schoolDeposit != null and schoolDeposit != ''">school_deposit = #{schoolDeposit} * 100,</if>
            <if test="dayRescueTel != null and dayRescueTel != ''">day_rescue_tel = #{dayRescueTel},</if>
            <if test="nightRescueTel != null and nightRescueTel != ''">night_rescue_tel = #{nightRescueTel},</if>
            <if test="repairTel != null and repairTel != ''">repair_tel = #{repairTel},</if>
            <if test="inspectionSilver != null">inspection_silver = #{inspectionSilver},</if>
            <if test="inspectionGold != null">inspection_gold = #{inspectionGold},</if>
            <if test="inspectionPlatinum != null">inspection_platinum = #{inspectionPlatinum},</if>
            <if test="repairSilver != null">repair_silver = #{repairSilver},</if>
            <if test="repairGold != null">repair_gold = #{repairGold},</if>
            <if test="repairPlatinum != null">repair_platinum = #{repairPlatinum},</if>
            <if test="mallSilver != null">mall_silver = #{mallSilver},</if>
            <if test="mallGold != null">mall_gold = #{mallGold},</if>
            <if test="mallPlatinum != null">mall_platinum = #{mallPlatinum},</if>
            <if test="shopUserSilver != null">shop_user_silver = #{shopUserSilver},</if>
            <if test="shopUserGold != null">shop_user_gold = #{shopUserGold},</if>
            <if test="shopUserPlatinum != null">shop_user_platinum = #{shopUserPlatinum},</if>
            <if test="isRegistrationUpgradePlatinum != null">is_registration_upgrade_platinum = #{isRegistrationUpgradePlatinum},</if>
            <if test="insuranceTel != null">insurance_Tel = #{insuranceTel},</if>
            <if test="silverIntro != null">silver_intro = #{silverIntro},</if>
            <if test="silverConditions != null">silver_conditions = #{silverConditions},</if>
            <if test="goldIntro != null">gold_intro = #{goldIntro},</if>
            <if test="goldConditions != null">gold_conditions = #{goldConditions},</if>
            <if test="platinumIntro != null">platinum_intro = #{platinumIntro},</if>
            <if test="platinumConditions != null">platinum_conditions = #{platinumConditions},</if>
            <if test="inviteRewards != null">invite_rewards = #{inviteRewards},</if>
            <if test="royalty != null">royalty = #{royalty},</if>
            <if test="inspectionSteps != null">inspection_steps = #{inspectionSteps},</if>
            <if test="insuranceText != null">insurance_text = #{insuranceText},</if>

        </trim>
        where id = #{id}
    </update>

    <delete id="deleteShopConfigById" parameterType="Long">
        delete from shop_config where id = #{id}
    </delete>

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