<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.mall.mapper.MallShopConfigMapper">
    
    <resultMap type="MallShopConfig" id="MallShopConfigResult">
        <result property="id"    column="id"    />
        <result property="vipPrice"    column="vip_price"    />
        <result property="vipReturnRatio"    column="vip_return_ratio"    />
        <result property="vipPrivilegeImg"    column="vip_privilege_img"    />
        <result property="module1Name"    column="module1_name"    />
        <result property="module1Img"    column="module1_img"    />
        <result property="module2Name"    column="module2_name"    />
        <result property="module2Img"    column="module2_img"    />
        <result property="shareImg"    column="share_img"    />
    </resultMap>

    <sql id="selectMallShopConfigVo">
        select id, vip_price, vip_return_ratio, vip_privilege_img, module1_name, module1_img, module2_name, module2_img, share_img from mall_shop_config
    </sql>

    <select id="selectMallShopConfigList" parameterType="MallShopConfig" resultMap="MallShopConfigResult">
        <include refid="selectMallShopConfigVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectMallShopConfigById" parameterType="Long" resultMap="MallShopConfigResult">
        <include refid="selectMallShopConfigVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMallShopConfig" parameterType="MallShopConfig" useGeneratedKeys="true" keyProperty="id">
        insert into mall_shop_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="vipPrice != null">vip_price,</if>
            <if test="vipReturnRatio != null">vip_return_ratio,</if>
            <if test="vipPrivilegeImg != null">vip_privilege_img,</if>
            <if test="module1Name != null">module1_name,</if>
            <if test="module1Img != null">module1_img,</if>
            <if test="module2Name != null">module2_name,</if>
            <if test="module2Img != null">module2_img,</if>
            <if test="shareImg != null">share_img,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="vipPrice != null">#{vipPrice},</if>
            <if test="vipReturnRatio != null">#{vipReturnRatio},</if>
            <if test="vipPrivilegeImg != null">#{vipPrivilegeImg},</if>
            <if test="module1Name != null">#{module1Name},</if>
            <if test="module1Img != null">#{module1Img},</if>
            <if test="module2Name != null">#{module2Name},</if>
            <if test="module2Img != null">#{module2Img},</if>
            <if test="shareImg != null">#{shareImg},</if>
         </trim>
    </insert>

    <update id="updateMallShopConfig" parameterType="MallShopConfig">
        update mall_shop_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="vipPrice != null">vip_price = #{vipPrice},</if>
            <if test="vipReturnRatio != null">vip_return_ratio = #{vipReturnRatio},</if>
            <if test="vipPrivilegeImg != null">vip_privilege_img = #{vipPrivilegeImg},</if>
            <if test="module1Name != null">module1_name = #{module1Name},</if>
            <if test="module1Img != null">module1_img = #{module1Img},</if>
            <if test="module2Name != null">module2_name = #{module2Name},</if>
            <if test="module2Img != null">module2_img = #{module2Img},</if>
            <if test="shareImg != null">share_img = #{shareImg},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMallShopConfigById" parameterType="Long">
        delete from mall_shop_config where id = #{id}
    </delete>

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