|
@@ -0,0 +1,223 @@
|
|
|
+<?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.caimei365.commodity.mapper.CmProductArchiveContentMapper">
|
|
|
+
|
|
|
+ <select id="getByCmProductArchiveContent" parameterType="CmProductArchiveVO" resultType="CmProductArchiveVO">
|
|
|
+ select
|
|
|
+ cm_product_archive_content.id,
|
|
|
+ cm_product_archive_content.productArchiveId,
|
|
|
+ cm_product_archive_content.title,
|
|
|
+ cm_product_archive_content.type,
|
|
|
+ cm_product_archive_content.content,
|
|
|
+ cm_product_archive_content.stageStatus,
|
|
|
+ cm_product_archive_content.allStatus,
|
|
|
+ cm_product_archive_content.labelIds,
|
|
|
+ (SELECT GROUP_CONCAT(cusf.keyword) FROM cm_user_search_frequency cusf WHERE FIND_IN_SET(cusf.id ,cm_product_archive_content.labelIds)) as keywords,
|
|
|
+ cm_product_archive_content.addTime,
|
|
|
+ cm_product_archive_content.spId,
|
|
|
+ cpa.productId,
|
|
|
+ cpa.productName,
|
|
|
+ cpa.shopName,
|
|
|
+ cpa.productImage as image,
|
|
|
+ cpa.productType,
|
|
|
+ cpa.productClassify
|
|
|
+ ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = 1 and cm_product_archive_content.id = c.authorId ), 0) as pv
|
|
|
+ from cm_product_archive_content AS cm_product_archive_content
|
|
|
+ left join cm_product_archive cpa on cpa.id = cm_product_archive_content.productArchiveId
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">and cm_product_archive_content.id = #{id}</if>
|
|
|
+ <if test="productArchiveId != null ">and cm_product_archive_content.productArchiveId = #{productArchiveId}
|
|
|
+ </if>
|
|
|
+ <if test="title != null and title != ''">and cm_product_archive_content.title like concat('%', #{title}, '%')</if>
|
|
|
+ <if test="type != null and type != ''">and cm_product_archive_content.type = #{type}</if>
|
|
|
+ <if test="content != null and content != ''">and cm_product_archive_content.content = #{content}</if>
|
|
|
+ <if test="stageStatus != null ">and cm_product_archive_content.stageStatus = #{stageStatus}</if>
|
|
|
+ <if test="allStatus != null ">and cm_product_archive_content.allStatus = #{allStatus}</if>
|
|
|
+ <if test="labelIds != null and labelIds != ''">and cm_product_archive_content.labelIds like concat('%', #{labelIds}, '%')</if>
|
|
|
+ <if test="spId != null ">and cm_product_archive_content.spId = #{spId}</if>
|
|
|
+ <if test="productId != null "> and cpa.productId = #{productId}</if>
|
|
|
+ <if test="productName != null and productName != ''"> and cpa.productName like concat('%', #{productName}, '%')</if>
|
|
|
+ <if test="shopName != null and shopName != ''"> and cpa.shopName like concat('%', #{shopName}, '%')</if>
|
|
|
+ <if test="productType != null and productType != ''"> and cpa.productType = #{productType}</if>
|
|
|
+ <if test="productClassify != null "> and cpa.productClassify = #{productClassify}</if>
|
|
|
+ </where>
|
|
|
+ limit 0,1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmProductArchiveContentList" parameterType="CmProductArchiveVO" resultType="CmProductArchiveVO">
|
|
|
+ select
|
|
|
+ cm_product_archive_content.id,
|
|
|
+ cm_product_archive_content.productArchiveId,
|
|
|
+ cm_product_archive_content.title,
|
|
|
+ cm_product_archive_content.type,
|
|
|
+ cm_product_archive_content.content,
|
|
|
+ cm_product_archive_content.stageStatus,
|
|
|
+ cm_product_archive_content.allStatus,
|
|
|
+ cm_product_archive_content.labelIds,
|
|
|
+ (SELECT GROUP_CONCAT(cusf.keyword) FROM cm_user_search_frequency cusf WHERE FIND_IN_SET(cusf.id ,cm_product_archive_content.labelIds)) as keywords,
|
|
|
+ cm_product_archive_content.addTime,
|
|
|
+ cm_product_archive_content.spId,
|
|
|
+ cpa.productId,
|
|
|
+ cpa.productName,
|
|
|
+ cpa.shopName,
|
|
|
+ cpa.productImage as image,
|
|
|
+ cpa.productType,
|
|
|
+ cpa.productClassify
|
|
|
+ from cm_product_archive_content AS cm_product_archive_content
|
|
|
+ left join cm_product_archive cpa on cpa.id = cm_product_archive_content.productArchiveId
|
|
|
+ <where>
|
|
|
+ <if test="id != null and id != ''">and cm_product_archive_content.id = #{id}</if>
|
|
|
+ <if test="productArchiveId != null ">and cm_product_archive_content.productArchiveId = #{productArchiveId}
|
|
|
+ </if>
|
|
|
+ <if test="title != null and title != ''">and cm_product_archive_content.title like concat('%', #{title}, '%')</if>
|
|
|
+ <if test="type != null and type != ''">and cm_product_archive_content.type = #{type}</if>
|
|
|
+ <if test="content != null and content != ''">and cm_product_archive_content.content = #{content}</if>
|
|
|
+ <if test="stageStatus != null ">and cm_product_archive_content.stageStatus = #{stageStatus}</if>
|
|
|
+ <if test="allStatus != null ">and cm_product_archive_content.allStatus = #{allStatus}</if>
|
|
|
+ <if test="labelIds != null and labelIds != ''">
|
|
|
+ AND
|
|
|
+ cm_product_archive_content.labelIds like concat('%', #{labelIds}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="spId != null ">and cm_product_archive_content.spId = #{spId}</if>
|
|
|
+ <if test="productId != null "> and cpa.productId = #{productId}</if>
|
|
|
+ <if test="productName != null and productName != ''"> and cpa.productName like concat('%', #{productName}, '%')</if>
|
|
|
+ <if test="shopName != null and shopName != ''"> and cpa.shopName like concat('%', #{shopName}, '%')</if>
|
|
|
+ <if test="productType != null and productType != ''"> and cpa.productType = #{productType}</if>
|
|
|
+ <if test="productClassify != null "> and cpa.productClassify = #{productClassify}</if>
|
|
|
+ </where>
|
|
|
+ order by cm_product_archive_content.addTime desc
|
|
|
+ limit #{pageNum},5
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmProductArchiveInfoList" resultType="CmProductArchiveVO">
|
|
|
+ select
|
|
|
+ info.id,
|
|
|
+ info.guidanceImage as image,
|
|
|
+ info.title,
|
|
|
+ info.createDate as addTime,
|
|
|
+ 6 as type
|
|
|
+ from info AS info
|
|
|
+ where info.delFlag=0
|
|
|
+ and info.onlineStatus=2
|
|
|
+ and info.enabledStatus=1
|
|
|
+ <if test="labelIds != null and labelIds != ''">
|
|
|
+ AND
|
|
|
+ info.labelIds like concat('%', #{labelIds}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="title != null and title != ''">and info.title like concat('%', #{title}, '%')</if>
|
|
|
+ order by info.createDate desc
|
|
|
+ limit #{pageNum},5
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCmProductArchiveBaikeList" resultType="CmProductArchiveVO">
|
|
|
+ select
|
|
|
+ cbp.id,
|
|
|
+ cbp.image as image,
|
|
|
+ cbp.name as title,
|
|
|
+ cbp.addTime,
|
|
|
+ 7 as type
|
|
|
+ from cm_baike_product AS cbp
|
|
|
+ where cbp.delFlag=0
|
|
|
+ and cbp.onlineStatus=2
|
|
|
+ and cbp.status=1
|
|
|
+ <if test="labelIds != null and labelIds != ''">
|
|
|
+ AND
|
|
|
+ cbp.labelIds like concat('%', #{labelIds}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="title != null and title != ''">and cbp.name like concat('%', #{title}, '%')</if>
|
|
|
+ order by cbp.addTime desc
|
|
|
+ limit #{pageNum},5
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProductArchiveFileList" resultType="String">
|
|
|
+ select
|
|
|
+ ifnull(waterOssUrl,ossUrl)
|
|
|
+ from cm_product_archive_file
|
|
|
+ <where>
|
|
|
+ archiveContentId=#{id}
|
|
|
+ </where>
|
|
|
+ order by uploadTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="addCmProductArchiveContent" parameterType="CmProductArchiveVO" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into cm_product_archive_content
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">id,</if>
|
|
|
+ <if test="productArchiveId != null">productArchiveId,</if>
|
|
|
+ <if test="title != null and title != ''">title,</if>
|
|
|
+ <if test="type != null and type != ''">type,</if>
|
|
|
+ <if test="content != null and content != ''">content,</if>
|
|
|
+ <if test="stageStatus != null">stageStatus,</if>
|
|
|
+ <if test="allStatus != null">allStatus,</if>
|
|
|
+ <if test="labelIds != null and labelIds != ''">labelIds,</if>
|
|
|
+ <if test="addTime != null">addTime,</if>
|
|
|
+ <if test="createBy != null and createBy != ''">createBy,</if>
|
|
|
+ <if test="spId != null">spId,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null and id != ''">#{id},</if>
|
|
|
+ <if test="productArchiveId != null">#{productArchiveId},</if>
|
|
|
+ <if test="title != null and title != ''">#{title},</if>
|
|
|
+ <if test="type != null and type != ''">#{type},</if>
|
|
|
+ <if test="content != null and content != ''">#{content},</if>
|
|
|
+ <if test="stageStatus != null">#{stageStatus},</if>
|
|
|
+ <if test="allStatus != null">#{allStatus},</if>
|
|
|
+ <if test="labelIds != null and labelIds != ''">#{labelIds},</if>
|
|
|
+ <if test="addTime != null">#{addTime},</if>
|
|
|
+ <if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
|
+ <if test="spId != null">#{spId},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateCmProductArchiveContent" parameterType="CmProductArchiveVO">
|
|
|
+ update cm_product_archive_content
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="productArchiveId != null">productArchiveId = #{productArchiveId},</if>
|
|
|
+ <if test="title != null and title != ''">title = #{title},</if>
|
|
|
+ <if test="type != null and type != ''">type = #{type},</if>
|
|
|
+ <if test="content != null and content != ''">content = #{content},</if>
|
|
|
+ <if test="stageStatus != null">stageStatus = #{stageStatus},</if>
|
|
|
+ <if test="allStatus != null">allStatus = #{allStatus},</if>
|
|
|
+ <if test="labelIds != null and labelIds != ''">labelIds = #{labelIds},</if>
|
|
|
+ <if test="addTime != null">addTime = #{addTime},</if>
|
|
|
+ <if test="createBy != null and createBy != ''">createBy = #{createBy},</if>
|
|
|
+ <if test="spId != null">spId = #{spId},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="delCmProductArchiveContentById" parameterType="String">
|
|
|
+ delete
|
|
|
+ from cm_product_archive_content
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+ <select id="findKeyWordList" resultType="KeyPo">
|
|
|
+ SELECT cusf.id as k, cusf.keyword as v
|
|
|
+ FROM cm_user_search_frequency cusf
|
|
|
+ WHERE cusf.delStatus = 1
|
|
|
+ <if test="v != null and v != ''">and cusf.keyword like concat('%', #{v}, '%')</if>
|
|
|
+ and FIND_IN_SET(cusf.id ,(SELECT GROUP_CONCAT(cpac.labelIds) from cm_product_archive_content cpac))
|
|
|
+ ORDER BY cusf.frequency DESC, cusf.searchTime DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findProductList" resultType="CmProductArchiveVO">
|
|
|
+ SELECT a.shopName as shopName,
|
|
|
+ ifnull(a.productName,p.name) as productName,
|
|
|
+ a.`productID` as productId,
|
|
|
+ ifnull(a.productImage,p.mainImage) as image
|
|
|
+ FROM cm_product_archive a
|
|
|
+ left join product p on p.productID=a.productId
|
|
|
+ WHERE 1=1
|
|
|
+ <if test="productId != null ">and a.productId = #{productId}</if>
|
|
|
+ <if test="productName != null and productName != ''">
|
|
|
+ and (a.productName like concat('%', #{productName}, '%') or p.name like concat('%', #{productName}, '%'))
|
|
|
+ </if>
|
|
|
+ <if test="shopName != null and shopName != ''">and a.shopName like concat('%', #{shopName}, '%')</if>
|
|
|
+ and a.productId is not null
|
|
|
+ group by a.productID
|
|
|
+ order by a.productID desc
|
|
|
+ </select>
|
|
|
+</mapper>
|