huliguo
15 小时以前 c5d38d650d2ac4101b1293a4f17346e7d5420076
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
70
71
72
73
74
75
76
77
<?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.ShopRelTagMapper">
 
    <resultMap type="ShopRelTag" id="ShopRelTagResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="shopId"    column="shop_id"    />
        <result property="tagId"    column="tag_id"    />
    </resultMap>
 
    <sql id="selectShopRelTagVo">
        select id, del_flag, shop_id, tag_id from t_shop_rel_tag
    </sql>
 
    <select id="selectShopRelTagList" parameterType="ShopRelTag" resultMap="ShopRelTagResult">
        <include refid="selectShopRelTagVo"/>
        <where>
            <if test="shopId != null "> and shop_id = #{shopId}</if>
            <if test="tagId != null "> and tag_id = #{tagId}</if>
        </where>
    </select>
 
    <select id="selectShopRelTagById" parameterType="Long" resultMap="ShopRelTagResult">
        <include refid="selectShopRelTagVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertShopRelTag" parameterType="ShopRelTag" useGeneratedKeys="true" keyProperty="id">
        insert into t_shop_rel_tag
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">del_flag,</if>
            <if test="shopId != null">shop_id,</if>
            <if test="tagId != null">tag_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="delFlag != null">#{delFlag},</if>
            <if test="shopId != null">#{shopId},</if>
            <if test="tagId != null">#{tagId},</if>
        </trim>
    </insert>
 
    <update id="updateShopRelTag" parameterType="ShopRelTag">
        update t_shop_rel_tag
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="shopId != null">shop_id = #{shopId},</if>
            <if test="tagId != null">tag_id = #{tagId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteShopRelTagById" parameterType="Long">
        delete from t_shop_rel_tag where id = #{id}
    </delete>
 
    <delete id="deleteShopRelTagByIds" parameterType="String">
        delete from t_shop_rel_tag where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="deleteByShopId">
        UPDATE t_shop_rel_tag SET del_flag = 1 WHERE shop_id = #{shopId}
    </update>
 
    <select id="listShopTagVo" resultType="com.ruoyi.shop.domain.vo.MgtShopTagVo">
        SELECT
        srt.tag_id tagId,
        st.tag_name tagName,
        CASE WHEN srt.id IS NULL THEN 0 ELSE 1 END selectFlag
        FROM sys_tag st
        LEFT JOIN t_shop_rel_tag srt ON srt.tag_id = st.tag_id
        WHERE srt.del_flag = 0 AND shop_id = #{shopId}
    </select>
</mapper>