<?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.MallGoodsPostFeeMapper">
    
    <resultMap type="MallGoodsPostFee" id="MallGoodsPostFeeResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="postFee"    column="post_fee"    />
        <result property="goodsId"    column="goods_id"    />
    </resultMap>

    <sql id="selectMallGoodsPostFeeVo">
        select id, name, post_fee, goods_id from mall_goods_post_fee
    </sql>

    <select id="selectMallGoodsPostFeeList" parameterType="MallGoodsPostFee" resultMap="MallGoodsPostFeeResult">
        <include refid="selectMallGoodsPostFeeVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
        </where>
    </select>
    
    <select id="selectMallGoodsPostFeeById" parameterType="Long" resultMap="MallGoodsPostFeeResult">
        <include refid="selectMallGoodsPostFeeVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMallGoodsPostFee" parameterType="MallGoodsPostFee" useGeneratedKeys="true" keyProperty="id">
        insert into mall_goods_post_fee
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null and name != ''">name,</if>
            <if test="postFee != null">post_fee,</if>
            <if test="goodsId != null">goods_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null and name != ''">#{name},</if>
            <if test="postFee != null">#{postFee},</if>
            <if test="goodsId != null">#{goodsId},</if>
         </trim>
    </insert>

    <update id="updateMallGoodsPostFee" parameterType="MallGoodsPostFee">
        update mall_goods_post_fee
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null and name != ''">name = #{name},</if>
            <if test="postFee != null">post_fee = #{postFee},</if>
            <if test="goodsId != null">goods_id = #{goodsId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMallGoodsPostFeeById" parameterType="Long">
        delete from mall_goods_post_fee where id = #{id}
    </delete>

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