Kaynağa Gözat

内容库V1.0.0

kaick 1 yıl önce
ebeveyn
işleme
69756f373f

+ 9 - 13
src/main/resources/mapper/CmProductArchiveContentMapper.xml

@@ -65,8 +65,8 @@
 		cpa.shopName,
 		cpa.shopName,
 		cpa.productImage as image,
 		cpa.productImage as image,
 		cpa.productType,
 		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
+		cpa.productClassify,
+		cm_product_archive_content.addTime
 		from cm_product_archive_content AS cm_product_archive_content
 		from cm_product_archive_content AS cm_product_archive_content
 		left join cm_product_archive cpa on cpa.id = cm_product_archive_content.productArchiveId
 		left join cm_product_archive cpa on cpa.id = cm_product_archive_content.productArchiveId
 		<where>
 		<where>
@@ -80,9 +80,7 @@
 			<if test="allStatus != null ">and cm_product_archive_content.allStatus = #{allStatus}</if>
 			<if test="allStatus != null ">and cm_product_archive_content.allStatus = #{allStatus}</if>
 			<if test="labelIds != null  and labelIds != ''">
 			<if test="labelIds != null  and labelIds != ''">
 				AND
 				AND
-				<foreach item="labelIdIn" collection="labelIds.split(',')" open="(" separator="or" close=")">
-					 cm_product_archive_content.labelIds like concat('%', #{labelIdIn}, '%')
-				</foreach>
+				cm_product_archive_content.labelIds like concat('%', #{labelIds}, '%')
 			</if>
 			</if>
 			<if test="spId != null ">and cm_product_archive_content.spId = #{spId}</if>
 			<if test="spId != null ">and cm_product_archive_content.spId = #{spId}</if>
 			<if test="productId != null "> and cpa.productId = #{productId}</if>
 			<if test="productId != null "> and cpa.productId = #{productId}</if>
@@ -109,9 +107,7 @@
 		and info.enabledStatus=1
 		and info.enabledStatus=1
 		<if test="labelIds != null  and labelIds != ''">
 		<if test="labelIds != null  and labelIds != ''">
 			AND
 			AND
-			<foreach item="labelIdIn" collection="labelIds.split(',')" open="(" separator="or" close=")">
-				info.labelIds like concat('%', #{labelIdIn}, '%')
-			</foreach>
+			info.labelIds like concat('%', #{labelIds}, '%')
 		</if>
 		</if>
 		<if test="title != null  and title != ''">and info.title like concat('%', #{title}, '%')</if>
 		<if test="title != null  and title != ''">and info.title like concat('%', #{title}, '%')</if>
 		order by info.createDate desc
 		order by info.createDate desc
@@ -131,9 +127,7 @@
 		and cbp.status=1
 		and cbp.status=1
 		<if test="labelIds != null  and labelIds != ''">
 		<if test="labelIds != null  and labelIds != ''">
 		  AND
 		  AND
-			<foreach item="labelIdIn" collection="labelIds.split(',')" open="(" separator="or" close=")">
-				cbp.labelIds like concat('%', #{labelIdIn}, '%')
-			</foreach>
+			cbp.labelIds like concat('%', #{labelIds}, '%')
 		</if>
 		</if>
 		<if test="title != null  and title != ''">and cbp.name like concat('%', #{title}, '%')</if>
 		<if test="title != null  and title != ''">and cbp.name like concat('%', #{title}, '%')</if>
 		order by cbp.addTime desc
 		order by cbp.addTime desc
@@ -207,20 +201,22 @@
 		SELECT cusf.id as k, cusf.keyword as v
 		SELECT cusf.id as k, cusf.keyword as v
 		FROM cm_user_search_frequency cusf
 		FROM cm_user_search_frequency cusf
 		WHERE cusf.delStatus = 1
 		WHERE cusf.delStatus = 1
-		and FIND_IN_SET(cusf.id ,(SELECT GROUP_CONCAT(cpac.labelIds) from cm_product_archive_content cpac))
 		<if test="v != null  and v != ''">and cusf.keyword like concat('%', #{v}, '%')</if>
 		<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
 		ORDER BY cusf.frequency DESC, cusf.searchTime DESC
 	</select>
 	</select>
 
 
 	<select id="findProductList" resultType="CmProductArchiveVO">
 	<select id="findProductList" resultType="CmProductArchiveVO">
 		SELECT a.shopName as shopName,
 		SELECT a.shopName as shopName,
-		a.productName as productName,
+		ifnull(a.productName,(select name from product where productID=a.productId)) as productName,
 		a.`productID` as productId,
 		a.`productID` as productId,
 		a.productImage as image
 		a.productImage as image
 		FROM cm_product_archive a
 		FROM cm_product_archive a
+		WHERE 1=1
 		<if test="productId != null ">and a.productId = #{productId}</if>
 		<if test="productId != null ">and a.productId = #{productId}</if>
 		<if test="productName != null  and productName != ''">and a.productName like concat('%', #{productName}, '%')</if>
 		<if test="productName != null  and productName != ''">and a.productName like concat('%', #{productName}, '%')</if>
 		<if test="shopName != null  and shopName != ''">and a.shopName like concat('%', #{shopName}, '%')</if>
 		<if test="shopName != null  and shopName != ''">and a.shopName like concat('%', #{shopName}, '%')</if>
+		and a.productId is not null
 		group by a.productID
 		group by a.productID
 		order by a.productID desc
 		order by a.productID desc
 	</select>
 	</select>