<?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>
|