|
|
@@ -0,0 +1,65 @@
|
|
|
+<?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.fs.hisStore.mapper.FsStoreProductTagScrmMapper">
|
|
|
+
|
|
|
+ <resultMap id="BaseResultMap" type="com.fs.hisStore.domain.FsStoreProductTagScrm">
|
|
|
+ <id property="id" column="id"/>
|
|
|
+ <result property="storeId" column="store_id"/>
|
|
|
+ <result property="tagName" column="tag_name"/>
|
|
|
+ <result property="status" column="status"/>
|
|
|
+ <result property="sort" column="sort"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="updateTime" column="update_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="Base_Column_List">id, store_id, tag_name, status, sort, create_time, update_time</sql>
|
|
|
+
|
|
|
+ <select id="selectById" resultMap="BaseResultMap">
|
|
|
+ select <include refid="Base_Column_List"/> from fs_store_product_tag_scrm where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectListVO" resultType="com.fs.hisStore.vo.FsStoreProductTagListVO">
|
|
|
+ select t.id, t.store_id, t.tag_name, t.status, t.sort, t.create_time,
|
|
|
+ (select count(*) from fs_store_product_tag_relation_scrm r where r.tag_id = t.id) as product_count
|
|
|
+ from fs_store_product_tag_scrm t
|
|
|
+ <where>
|
|
|
+ <if test="storeId != null">and t.store_id = #{storeId}</if>
|
|
|
+ <if test="tagName != null and tagName != ''">and t.tag_name like concat('%', #{tagName}, '%')</if>
|
|
|
+ <if test="status != null">and t.status = #{status}</if>
|
|
|
+ </where>
|
|
|
+ order by t.sort asc, t.create_time desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insert" parameterType="com.fs.hisStore.domain.FsStoreProductTagScrm" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into fs_store_product_tag_scrm (store_id, tag_name, status, sort, create_time, update_time)
|
|
|
+ values (#{storeId}, #{tagName}, #{status}, #{sort}, #{createTime}, #{updateTime})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.fs.hisStore.domain.FsStoreProductTagScrm">
|
|
|
+ update fs_store_product_tag_scrm
|
|
|
+ <set>
|
|
|
+ <if test="tagName != null">tag_name = #{tagName},</if>
|
|
|
+ <if test="status != null">status = #{status},</if>
|
|
|
+ <if test="sort != null">sort = #{sort},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete from fs_store_product_tag_scrm where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteByIds">
|
|
|
+ delete from fs_store_product_tag_scrm where id in
|
|
|
+ <foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectProductsByTagId" resultType="com.fs.hisStore.vo.FsStoreTagProductVO">
|
|
|
+ select p.product_id as productId, p.product_name as productName, p.image as image, p.price as price, p.is_show as isShow
|
|
|
+ from fs_store_product_scrm p
|
|
|
+ inner join fs_store_product_tag_relation_scrm r on p.product_id = r.product_id
|
|
|
+ where r.tag_id = #{tagId} and (p.is_del is null or p.is_del = 0)
|
|
|
+ order by p.create_time desc
|
|
|
+ </select>
|
|
|
+</mapper>
|