<?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.MallGoodsFollowMapper">
    
    <resultMap type="MallGoodsFollow" id="MallGoodsFollowResult">
        <result property="id"    column="id"    />
        <result property="memberId"    column="member_id"    />
        <result property="goodsId"    column="goods_id"    />
        <result property="createAt"    column="create_at"    />
    </resultMap>

    <sql id="selectMallGoodsFollowVo">
        select id, member_id, goods_id, create_at from mall_goods_follow
    </sql>

    <select id="selectMallGoodsFollowList" parameterType="MallGoodsFollow" resultMap="MallGoodsFollowResult">
        <include refid="selectMallGoodsFollowVo"/>
        <where>  
        </where>
    </select>
    
    <select id="selectMallGoodsFollowById" parameterType="Long" resultMap="MallGoodsFollowResult">
        <include refid="selectMallGoodsFollowVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertMallGoodsFollow" parameterType="MallGoodsFollow" useGeneratedKeys="true" keyProperty="id">
        insert into mall_goods_follow
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="memberId != null">member_id,</if>
            <if test="goodsId != null">goods_id,</if>
            <if test="createAt != null">create_at,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="memberId != null">#{memberId},</if>
            <if test="goodsId != null">#{goodsId},</if>
            <if test="createAt != null">#{createAt},</if>
         </trim>
    </insert>

    <update id="updateMallGoodsFollow" parameterType="MallGoodsFollow">
        update mall_goods_follow
        <trim prefix="SET" suffixOverrides=",">
            <if test="memberId != null">member_id = #{memberId},</if>
            <if test="goodsId != null">goods_id = #{goodsId},</if>
            <if test="createAt != null">create_at = #{createAt},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteMallGoodsFollowById" parameterType="Long">
        delete from mall_goods_follow where id = #{id}
    </delete>

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