|
@@ -31,7 +31,7 @@
|
|
|
a.updateTime AS "updateTime",
|
|
|
a.sellNumber AS "sellNumber",
|
|
|
-- a.weekSellNumber AS "weekSellNumber",
|
|
|
--- a.beforeValidFlag AS "beforeValidFlag",
|
|
|
+ a.beforeValidFlag AS "beforeValidFlag",
|
|
|
copi.validFlag AS "validFlag",
|
|
|
a.favoriteTimes AS "favoriteTimes",
|
|
|
a.commentScore AS "commentScore",
|
|
@@ -126,7 +126,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
WHERE a.productID = #{id}
|
|
|
- and a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+ group by a.productID
|
|
|
</select>
|
|
|
|
|
|
|
|
@@ -144,7 +144,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="productID !=null and productID !=''">
|
|
|
AND a.productID=#{productID}
|
|
|
</if>
|
|
@@ -199,6 +199,7 @@
|
|
|
AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
|
|
|
and a.productCategory = 1
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
<choose>
|
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
ORDER BY ${page.orderBy}
|
|
@@ -216,7 +217,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="productID !=null and productID !=''">
|
|
|
AND a.productID=#{productID}
|
|
|
</if>
|
|
@@ -255,7 +256,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="id !=null and id !=''">
|
|
|
AND a.productID=#{id}
|
|
|
</if>
|
|
@@ -334,7 +335,7 @@
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
a.productCategory = 1
|
|
|
- and a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
</where>
|
|
|
group by a.productID
|
|
|
<choose>
|
|
@@ -366,7 +367,7 @@
|
|
|
addTime,
|
|
|
updateTime,
|
|
|
-- weekSellNumber,
|
|
|
--- beforeValidFlag,
|
|
|
+ beforeValidFlag,
|
|
|
validFlag,
|
|
|
favoriteTimes,
|
|
|
commentScore,
|
|
@@ -446,7 +447,7 @@
|
|
|
#{addTime},
|
|
|
#{updateTime},
|
|
|
-- #{weekSellNumber},
|
|
|
--- #{beforeValidFlag},
|
|
|
+ #{beforeValidFlag},
|
|
|
#{validFlag},
|
|
|
#{favoriteTimes},
|
|
|
#{commentScore},
|
|
@@ -528,7 +529,7 @@
|
|
|
updateTime = #{updateTime},
|
|
|
sellNumber = #{sellNumber},
|
|
|
-- weekSellNumber = #{weekSellNumber},
|
|
|
--- beforeValidFlag = #{beforeValidFlag},
|
|
|
+ beforeValidFlag = #{beforeValidFlag},
|
|
|
validFlag = #{validFlag},
|
|
|
favoriteTimes = #{favoriteTimes},
|
|
|
commentScore = #{commentScore},
|
|
@@ -571,6 +572,7 @@
|
|
|
and a.productID=#{productID}
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
</select>
|
|
|
<select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
|
|
|
SELECT
|
|
@@ -578,7 +580,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="productID !=null">
|
|
|
AND a.productID=#{productID}
|
|
|
</if>
|
|
@@ -603,6 +605,7 @@
|
|
|
# AND p.showFlag!=2
|
|
|
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
# 在设置重点关注时给排序值1000为了让重点关注始终在列表前端
|
|
|
order by a.sortIndex desc,a.newshowTime DESC
|
|
|
</select>
|
|
@@ -900,7 +903,7 @@
|
|
|
`addTime`,
|
|
|
`updateTime`,
|
|
|
-- `weekSellNumber`,
|
|
|
--- `beforeValidFlag`,
|
|
|
+ `beforeValidFlag`,
|
|
|
`validFlag`,
|
|
|
`favoriteTimes`,
|
|
|
`commentScore`,
|
|
@@ -965,7 +968,7 @@
|
|
|
#{addTime},
|
|
|
#{updateTime},
|
|
|
-- #{weekSellNumber},
|
|
|
--- #{beforeValidFlag},
|
|
|
+ #{beforeValidFlag},
|
|
|
#{validFlag},
|
|
|
#{favoriteTimes},
|
|
|
#{commentScore},
|
|
@@ -1118,7 +1121,7 @@
|
|
|
left join cm_brand b on b.id = a.brandID
|
|
|
WHERE
|
|
|
csrp.tinyTypeId = #{tinyTypeID}
|
|
|
- and a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="name != null and name != ''">
|
|
|
AND a.name like concat('%', #{name} ,'%')
|
|
|
</if>
|
|
@@ -1134,6 +1137,7 @@
|
|
|
and a.productCategory = 1
|
|
|
AND copi.validFlag != 0
|
|
|
AND csrp.delFlag =0
|
|
|
+ group by a.productID
|
|
|
ORDER BY csrp.sort DESC
|
|
|
</select>
|
|
|
|
|
@@ -1184,8 +1188,9 @@
|
|
|
|
|
|
<select id="findProductIdBySku" resultType="java.lang.String">
|
|
|
select productId
|
|
|
- from cm_sku
|
|
|
+ from cm_sku cs
|
|
|
where skuId = #{productId}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=#{productId})
|
|
|
</select>
|
|
|
|
|
|
<select id="toAddProductList" resultType="product">
|
|
@@ -1200,7 +1205,7 @@
|
|
|
WHERE
|
|
|
NOT EXISTS (select * from cm_search_recommend_product csrp where csrp.productID = a.productID and
|
|
|
csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
|
|
|
- and copi.validFlag = '2' and p.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+ and copi.validFlag = '2'
|
|
|
<if test="name != null and name != ''">
|
|
|
and a.name like concat('%', #{name} ,'%')
|
|
|
</if>
|
|
@@ -1211,6 +1216,7 @@
|
|
|
AND b.name like concat('%', #{brandName} ,'%')
|
|
|
</if>
|
|
|
and a.productCategory = 1
|
|
|
+ group by a.productID
|
|
|
</select>
|
|
|
|
|
|
<select id="findGroupActivityListPage" resultType="Product">
|
|
@@ -1220,7 +1226,7 @@
|
|
|
left join cm_organize_product_info copi on copi.productId = a.productID
|
|
|
<include refid="ActivityJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="id !=null and id !=''">
|
|
|
AND a.productID=#{id}
|
|
|
</if>
|
|
@@ -1266,6 +1272,7 @@
|
|
|
AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
|
|
|
and a.productCategory = 1
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
<choose>
|
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
ORDER BY ${page.orderBy}
|
|
@@ -1383,6 +1390,7 @@
|
|
|
</if>
|
|
|
and a.productCategory = 1
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
<!-- limit 0, 10-->
|
|
|
</select>
|
|
|
|
|
@@ -1478,9 +1486,9 @@
|
|
|
<!-- <if test="weekSellNumber != null and weekSellNumber !=''">-->
|
|
|
<!-- weekSellNumber = #{weekSellNumber},-->
|
|
|
<!-- </if>-->
|
|
|
-<!-- <if test="beforeValidFlag != null and beforeValidFlag !=''">-->
|
|
|
-<!-- beforeValidFlag = #{beforeValidFlag},-->
|
|
|
-<!-- </if>-->
|
|
|
+ <if test="beforeValidFlag != null and beforeValidFlag !=''">
|
|
|
+ beforeValidFlag = #{beforeValidFlag},
|
|
|
+ </if>
|
|
|
<!-- <if test="validFlag != null and validFlag !=''">-->
|
|
|
<!-- validFlag = #{validFlag},-->
|
|
|
<!-- </if>-->
|
|
@@ -1767,7 +1775,7 @@
|
|
|
left join shop s on s.shopID = p.shopID
|
|
|
left join cm_organize_product_info copi on copi.productId = p.productID
|
|
|
where p.productID = #{productID}
|
|
|
- AND copi.validFlag = '2' and p.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+ AND copi.validFlag = '2'
|
|
|
</select>
|
|
|
|
|
|
<select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
|
|
@@ -1782,7 +1790,7 @@
|
|
|
left join cm_organize_product_info copi on copi.productId = p.productID
|
|
|
left join shop s on s.shopID = p.shopID
|
|
|
<where>
|
|
|
- p.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="productID != null and productID != ''">
|
|
|
p.productID = #{productID}
|
|
|
</if>
|
|
@@ -1809,6 +1817,7 @@
|
|
|
WHERE csl.delFlag = 0
|
|
|
AND csr.delFlag = 0
|
|
|
AND p.productID = #{productID}
|
|
|
+ group by p.productID
|
|
|
</select>
|
|
|
<select id="qualification" resultType="com.caimei.modules.product.entity.Product">
|
|
|
SELECT qualificationNo, productName, qualificationTime, qualificationLink
|
|
@@ -1831,7 +1840,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="id !=null and id !=''">
|
|
|
AND a.productID=#{id}
|
|
|
</if>
|
|
@@ -1862,6 +1871,7 @@
|
|
|
AND a.actStatus = 1
|
|
|
and a.productCategory = 1
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
<choose>
|
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
ORDER BY ${page.orderBy}
|
|
@@ -1878,7 +1888,7 @@
|
|
|
left join cm_organize_product_info copi on copi.productId = p.productID
|
|
|
left join shop s on p.shopID = s.shopID
|
|
|
<where>
|
|
|
- (p.actFlag=0 or p.actType is null) and copi.validFlag = 2 and p.productCategory = 1 and p.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+ (p.actFlag=0 or p.actType is null) and copi.validFlag = 2 and p.productCategory = 1
|
|
|
<if test="productIds != null and productIds != '' ">
|
|
|
and p.productID != #{productIds}
|
|
|
</if>
|
|
@@ -1901,7 +1911,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
<where>
|
|
|
- a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+
|
|
|
<if test="productID !=null">
|
|
|
AND a.productID=#{productID}
|
|
|
</if>
|
|
@@ -1927,6 +1937,7 @@
|
|
|
</foreach>
|
|
|
</if>
|
|
|
</where>
|
|
|
+ group by a.productID
|
|
|
<choose>
|
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
ORDER BY ${page.orderBy}
|
|
@@ -1982,6 +1993,7 @@
|
|
|
left join cm_promotion_sku cps on cs.skuId = cps.skuId
|
|
|
left join cm_svip_product_sku csps on cs.skuId = csps.skuId
|
|
|
where cs.productId = #{productID}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=#{productID})
|
|
|
</select>
|
|
|
<select id="findSkuListProduct" resultType="com.caimei.modules.product.entity.CmSku">
|
|
|
select cs.skuId,
|
|
@@ -2052,7 +2064,7 @@
|
|
|
FROM product a
|
|
|
<include refid="productJoins"/>
|
|
|
left join cm_sku cs on cs.productId=a.productID and copi.organizeId= cs.organizeId
|
|
|
- WHERE cs.skuId = #{skuId} and a.groundMall like CONCAT('%', copi.organizeId, '%')
|
|
|
+ WHERE cs.skuId = #{skuId} and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
|
|
|
</select>
|
|
|
<select id="findHeHeSku" resultType="com.caimei.modules.product.entity.CmSku">
|
|
|
select cs.skuId,
|
|
@@ -2067,6 +2079,7 @@
|
|
|
from cm_sku cs
|
|
|
left join cm_hehe_sku chs on cs.skuId = chs.skuId
|
|
|
where cs.productId = #{productID}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
|
|
|
</select>
|
|
|
<select id="findSkuId" resultType="java.lang.Integer">
|
|
|
select skuId
|
|
@@ -2075,8 +2088,9 @@
|
|
|
</select>
|
|
|
<select id="findSku" resultType="com.caimei.modules.product.entity.CmSku">
|
|
|
select price, ifnull(costPrice, 0) as costPrice, costCheckFlag, shopPercent, normalPrice
|
|
|
- from cm_sku
|
|
|
+ from cm_sku cs
|
|
|
where productId = #{productId}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
|
|
|
order by price asc
|
|
|
limit 1
|
|
|
</select>
|
|
@@ -2084,8 +2098,9 @@
|
|
|
SELECT price, ifnull(costPrice, 0),"1" AS costCheckFlag, shopPercent AS shopPercent
|
|
|
, normalPrice
|
|
|
, organizeId
|
|
|
- FROM cm_sku
|
|
|
+ FROM cm_sku cs
|
|
|
WHERE productId = #{productId}
|
|
|
+ and cs.organizeId=4
|
|
|
ORDER BY price ASC
|
|
|
LIMIT 1
|
|
|
</select>
|
|
@@ -2095,6 +2110,7 @@
|
|
|
, organizeId
|
|
|
from cm_sku
|
|
|
where skuId = #{skuId}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
|
|
|
</select>
|
|
|
<select id="findSkuIdByPromotionsId" resultType="java.lang.Integer">
|
|
|
select skuId
|
|
@@ -2113,11 +2129,13 @@
|
|
|
FROM cm_promotion_sku cps
|
|
|
LEFT JOIN cm_sku cs ON cps.skuId = cs.skuId
|
|
|
WHERE promotionId = #{id}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
|
|
|
</select>
|
|
|
<select id="getSkuByPromotionId" resultType="com.caimei.modules.product.entity.CmSku">
|
|
|
SELECT cs.price, cpp.productId, cs.skuId, cs.unit
|
|
|
FROM cm_promotions_product cpp
|
|
|
LEFT JOIN cm_sku cs ON cpp.productId = cs.productId
|
|
|
WHERE promotionsId = #{id}
|
|
|
+ and cs.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=cs.productId)
|
|
|
</select>
|
|
|
</mapper>
|