|
@@ -28,8 +28,35 @@
|
|
|
ifnull(p.newvalidflag,0) as p_newvalidflag,
|
|
|
p.productType as p_product_type,
|
|
|
p.relatedLabels as p_labels,
|
|
|
- (select unit from cm_sku where productID=#{productId} order by price asc LIMIT 1) as p_unit,
|
|
|
- (select price from cm_sku where productID=#{productId} order by price asc LIMIT 1) as p_price
|
|
|
+ (select unit from cm_sku where productID=
|
|
|
+ #{productId}
|
|
|
+ order
|
|
|
+ by
|
|
|
+ price
|
|
|
+ asc
|
|
|
+ LIMIT
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ as
|
|
|
+ p_unit,
|
|
|
+ (
|
|
|
+ select
|
|
|
+ price
|
|
|
+ from
|
|
|
+ cm_sku
|
|
|
+ where
|
|
|
+ productID
|
|
|
+ =
|
|
|
+ #{productId}
|
|
|
+ order
|
|
|
+ by
|
|
|
+ price
|
|
|
+ asc
|
|
|
+ LIMIT
|
|
|
+ 1
|
|
|
+ )
|
|
|
+ as
|
|
|
+ p_price
|
|
|
</sql>
|
|
|
<sql id="Product_Joins">
|
|
|
left join tinytype as t on p.tinyTypeID = t.tinyTypeID
|
|
@@ -50,21 +77,21 @@
|
|
|
<select id="findProductCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
from product p
|
|
|
- left join cm_organize_product_info copi on p.productID = copi.productId
|
|
|
+ left join cm_organize_product_info copi on p.productID = copi.productId
|
|
|
where validFlag in (2, 3, 9)
|
|
|
and productCategory = 1
|
|
|
</select>
|
|
|
<select id="findProductInvalidCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
from product p
|
|
|
- left join cm_organize_product_info copi on p.productID = copi.productId
|
|
|
+ left join cm_organize_product_info copi on p.productID = copi.productId
|
|
|
where validFlag in (2, 3, 9)
|
|
|
or productCategory != 1
|
|
|
</select>
|
|
|
<select id="findProductInvalidIds" resultType="java.lang.Integer">
|
|
|
select p.productID
|
|
|
from product p
|
|
|
- left join cm_organize_product_info copi on p.productID = copi.productId
|
|
|
+ left join cm_organize_product_info copi on p.productID = copi.productId
|
|
|
where validFlag in (2, 3, 9)
|
|
|
or productCategory != 1
|
|
|
</select>
|
|
@@ -105,15 +132,15 @@
|
|
|
select count(*)
|
|
|
from shop
|
|
|
where shopType = 1
|
|
|
- and (status not in (90, 9)
|
|
|
- or shopID = 1252)
|
|
|
+ and (status not in (90, 9)
|
|
|
+ or shopID = 1252)
|
|
|
</select>
|
|
|
<select id="findSupplierInvalidIds" resultType="java.lang.Integer">
|
|
|
select shopID
|
|
|
from shop
|
|
|
- where shopType = 1
|
|
|
- and (status not in (90, 9)
|
|
|
- or shopID = 1252)
|
|
|
+ where shopType = 1
|
|
|
+ and (status not in (90, 9)
|
|
|
+ or shopID = 1252)
|
|
|
</select>
|
|
|
<select id="searchSupplierList" resultType="com.caimei365.commodity.model.search.SupplierDO">
|
|
|
select
|
|
@@ -129,7 +156,7 @@
|
|
|
<include refid="Search_Supplier_List"/>
|
|
|
from shop as s
|
|
|
<include refid="Supplier_Joins"/>
|
|
|
- where shopType = 1
|
|
|
+ where shopType = 1
|
|
|
and (status = 90 or status = 9)
|
|
|
and shopID != 1252
|
|
|
and s.shopID = #{shopId}
|
|
@@ -446,7 +473,7 @@
|
|
|
order by a.pubdate desc
|
|
|
</if>
|
|
|
<if test="sortType != 1">
|
|
|
- order by (IFNULL(c.pv, 0) +IFNULL(c.num, 0) + IFNULL(a.basePv, 0) + IFNULL(a.basePraise, 0)) desc
|
|
|
+ order by (IFNULL(c.pv, 0) +IFNULL(c.num, 0) + IFNULL(a.basePv, 0) + IFNULL(a.basePraise, 0)) desc
|
|
|
</if>
|
|
|
</if>
|
|
|
|
|
@@ -523,10 +550,12 @@
|
|
|
DELETE
|
|
|
FROM user_search_history
|
|
|
WHERE userId = #{userId}
|
|
|
- AND id NOT IN (
|
|
|
- SELECT temp.id
|
|
|
- FROM (SELECT id FROM user_search_history WHERE userId = #{userId} ORDER BY searchDate DESC LIMIT 10) AS temp
|
|
|
- )
|
|
|
+ AND id NOT IN (SELECT temp.id
|
|
|
+ FROM (SELECT id
|
|
|
+ FROM user_search_history
|
|
|
+ WHERE userId = #{userId}
|
|
|
+ ORDER BY searchDate DESC
|
|
|
+ LIMIT 10) AS temp)
|
|
|
</delete>
|
|
|
<delete id="deleteAllSearchHistory">
|
|
|
DELETE
|
|
@@ -585,4 +614,10 @@
|
|
|
WHERE (cp.status = 1 OR (cp.status = 2 AND cp.endTime > NOW()))
|
|
|
AND cp.delFlag = 0
|
|
|
</select>
|
|
|
+ <select id="findServiceProductIds" resultType="java.lang.String">
|
|
|
+ SELECT GROUP_CONCAT(cpp.productId SEPARATOR '|') AS ps
|
|
|
+ FROM cm_provider_product cpp
|
|
|
+ LEFT JOIN serviceprovider sp ON cpp.providerId = sp.providerId
|
|
|
+ WHERE sp.serviceProviderId = #{serviceProviderId}
|
|
|
+ </select>
|
|
|
</mapper>
|