puzhibing
2024-01-30 03f1f3372a10a08f96f3308bfa099e86a55046d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?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.shop.mapper.shop.ShopMarketingMapper">
 
    <resultMap type="ShopMarketing" id="ShopMarketingResult">
        <result property="shopId"    column="shop_id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="shopBirthdayFlag"    column="shop_birthday_flag"    />
        <result property="shopCouponCount"    column="shop_coupon_count"    />
        <result property="shopMarketingTotal"    column="shop_marketing_total"    />
    </resultMap>
 
    <sql id="selectShopMarketingVo">
        select shop_id, del_flag, shop_birthday_flag, shop_coupon_count, shop_marketing_total from t_shop_marketing
    </sql>
 
    <select id="selectShopMarketingList" parameterType="ShopMarketing" resultMap="ShopMarketingResult">
        <include refid="selectShopMarketingVo"/>
        <where>
            <if test="shopBirthdayFlag != null "> and shop_birthday_flag = #{shopBirthdayFlag}</if>
            <if test="shopCouponCount != null "> and shop_coupon_count = #{shopCouponCount}</if>
            <if test="shopMarketingTotal != null "> and shop_marketing_total = #{shopMarketingTotal}</if>
        </where>
    </select>
 
    <select id="selectShopMarketingByShopId" parameterType="Long" resultMap="ShopMarketingResult">
        <include refid="selectShopMarketingVo"/>
        where shop_id = #{shopId}
    </select>
 
    <insert id="insertShopMarketing" parameterType="ShopMarketing" useGeneratedKeys="true" keyProperty="shopId">
        insert into t_shop_marketing
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="shopBirthdayFlag != null">shop_birthday_flag,</if>
            <if test="shopCouponCount != null">shop_coupon_count,</if>
            <if test="shopMarketingTotal != null">shop_marketing_total,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="shopBirthdayFlag != null">#{shopBirthdayFlag},</if>
            <if test="shopCouponCount != null">#{shopCouponCount},</if>
            <if test="shopMarketingTotal != null">#{shopMarketingTotal},</if>
        </trim>
    </insert>
 
    <update id="updateShopMarketing" parameterType="ShopMarketing">
        update t_shop_marketing
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="shopBirthdayFlag != null">shop_birthday_flag = #{shopBirthdayFlag},</if>
            <if test="shopCouponCount != null">shop_coupon_count = #{shopCouponCount},</if>
            <if test="shopMarketingTotal != null">shop_marketing_total = #{shopMarketingTotal},</if>
        </trim>
        where shop_id = #{shopId}
    </update>
 
    <delete id="deleteShopMarketingByShopId" parameterType="Long">
        delete from t_shop_marketing where shop_id = #{shopId}
    </delete>
 
    <delete id="deleteShopMarketingByShopIds" parameterType="String">
        delete from t_shop_marketing where shop_id in
        <foreach item="shopId" collection="array" open="(" separator="," close=")">
            #{shopId}
        </foreach>
    </delete>
 
</mapper>