|
@@ -164,28 +164,28 @@
|
|
|
p.mainImage as image,
|
|
|
p.productCode as code,
|
|
|
p.priceFlag,
|
|
|
- (select unit from cm_sku where productID = #{productId} order by price asc LIMIT 1) as unit,
|
|
|
- (select price from cm_sku where productID = #{productId} order by price asc LIMIT 1) as price,
|
|
|
+ (select unit from cm_sku where productID = #{productId} and organizeId = 0 order by price asc LIMIT 1) as unit,
|
|
|
+ (select price from cm_sku where productID = #{productId} and organizeId = 0 order by price asc LIMIT 1) as price,
|
|
|
(select price
|
|
|
from cm_sku
|
|
|
- where productID = #{productId}
|
|
|
+ where productID = #{productId} and organizeId = 0
|
|
|
order by price asc
|
|
|
LIMIT 1) as originalPrice,
|
|
|
p.shopID as shopId,
|
|
|
p.searchKey as keyword,
|
|
|
(select minBuyNumber
|
|
|
from cm_sku
|
|
|
- where productID = #{productId}
|
|
|
+ where productID = #{productId} and organizeId = 0
|
|
|
order by price asc
|
|
|
LIMIT 1) as minBuyNumber,
|
|
|
(select ladderPriceFlag
|
|
|
from cm_sku
|
|
|
- where productID = #{productId}
|
|
|
+ where productID = #{productId} and organizeId = 0
|
|
|
order by price asc
|
|
|
LIMIT 1) as ladderPriceFlag,
|
|
|
(select normalPrice
|
|
|
from cm_sku
|
|
|
- where productID = #{productId}
|
|
|
+ where productID = #{productId} and organizeId = 0
|
|
|
order by price asc
|
|
|
LIMIT 1) as normalPrice,
|
|
|
p.step,
|
|
@@ -194,7 +194,7 @@
|
|
|
p.includedTax,
|
|
|
p.invoiceType,
|
|
|
p.productCategory as productCategory,
|
|
|
- p.validFlag,
|
|
|
+ copi.validFlag,
|
|
|
p.featuredFlag,
|
|
|
p.commodityType,
|
|
|
p.bigTypeID as bigTypeId,
|
|
@@ -205,8 +205,10 @@
|
|
|
p.productType
|
|
|
from product p
|
|
|
left join cm_second_hand_detail cshd on p.productID = cshd.productID
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
where p.productID = #{productId}
|
|
|
- and p.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
+ and copi.validFlag = 2
|
|
|
</select>
|
|
|
<select id="getSupplierFloorImage" resultType="com.caimei365.commodity.model.vo.ShopFloorVo">
|
|
|
select id, crmImage, wwwImage, wwwLink
|
|
@@ -237,16 +239,16 @@
|
|
|
p.shopID as shopId,
|
|
|
(select normalPrice
|
|
|
from cm_sku
|
|
|
- where productId = #{productId}
|
|
|
+ where productId = #{productId} and organizeId = 0
|
|
|
order by price asc
|
|
|
limit 1) as normalPrice,
|
|
|
- ifnull((select stock from cm_sku where productId = #{productId} order by price asc limit 1), 0) as stock,
|
|
|
+ ifnull((select stock from cm_sku where productId = #{productId} and organizeId = 0 order by price asc limit 1), 0) as stock,
|
|
|
(select minBuyNumber
|
|
|
from cm_sku
|
|
|
- where productId = #{productId}
|
|
|
+ where productId = #{productId} and organizeId = 0
|
|
|
order by price asc
|
|
|
limit 1) as minBuyNumber,
|
|
|
- (select unit from cm_sku where productId = #{productId} order by price asc limit 1) as unit,
|
|
|
+ (select unit from cm_sku where productId = #{productId} and organizeId = 0 order by price asc limit 1) as unit,
|
|
|
p.name,
|
|
|
p.aliasName,
|
|
|
p.commodityType,
|
|
@@ -277,7 +279,7 @@
|
|
|
p.machineType,
|
|
|
p.productCode,
|
|
|
p.updateTime,
|
|
|
- p.validFlag,
|
|
|
+ IFNULL((SELECT validFlag FROM cm_organize_product_info WHERE productId = p.productID AND organizeId = 0), 999) AS validFlag,
|
|
|
p.searchKey,
|
|
|
p.allAreaFlag,
|
|
|
p.step,
|
|
@@ -302,20 +304,13 @@
|
|
|
<select id="getProductOrganizeDetails" resultType="com.caimei365.commodity.model.vo.ProductDetailVo">
|
|
|
select p.productID as productId,
|
|
|
p.shopID as shopId,
|
|
|
- (select normalPrice
|
|
|
- from cm_sku
|
|
|
- where productId = #{productId}
|
|
|
- order by price asc
|
|
|
- limit 1) as normalPrice,
|
|
|
- ifnull((select stock from cm_sku where productId = #{productId} order by price asc limit 1), 0) as stock,
|
|
|
(select minBuyNumber
|
|
|
- from cm_mall_product_sku
|
|
|
- where productId = #{productId} or mallProductId = #{productId}
|
|
|
+ from cm_sku
|
|
|
+ where productId = #{productId} and organizeId = 4
|
|
|
order by price asc
|
|
|
limit 1) as minBuyNumber,
|
|
|
- (select cs.unit from cm_sku cs
|
|
|
- left join cm_mall_product_sku cmps on cs.skuId = cmps.skuId
|
|
|
- where cmps.productId = #{productId} or cmps.mallProductId = #{productId} order by cs.price asc limit 1) as unit,
|
|
|
+ (select unit from cm_sku
|
|
|
+ where productId = #{productId} and organizeId = 4 order by price asc limit 1) as unit,
|
|
|
p.name,
|
|
|
p.aliasName,
|
|
|
p.commodityType,
|
|
@@ -346,7 +341,7 @@
|
|
|
p.machineType,
|
|
|
p.productCode,
|
|
|
p.updateTime,
|
|
|
- cmop.validFlag,
|
|
|
+ IFNULL((SELECT validFlag FROM cm_organize_product_info WHERE productId = p.productID AND organizeId = 4), 999) AS validFlag,
|
|
|
p.searchKey,
|
|
|
p.allAreaFlag,
|
|
|
p.step,
|
|
@@ -365,9 +360,8 @@
|
|
|
p.returnGoodsStutas,
|
|
|
P.relatedLabels
|
|
|
from product p
|
|
|
- left join cm_mall_organize_products cmop on p.productId = cmop.productId
|
|
|
left join shop s on s.shopId = p.shopId
|
|
|
- where (p.productID = #{productId} OR cmop.id = #{productId}) AND cmop.delFlag = 0
|
|
|
+ where p.productID = #{productId}
|
|
|
</select>
|
|
|
<select id="getBuyAgainProducts" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
|
|
|
select p.productID as productId,
|
|
@@ -392,7 +386,7 @@
|
|
|
p.includedTax,
|
|
|
p.invoiceType,
|
|
|
p.productCategory as productCategory,
|
|
|
- p.validFlag,
|
|
|
+ copi.validFlag,
|
|
|
p.featuredFlag,
|
|
|
p.commodityType,
|
|
|
p.bigTypeID as bigTypeId,
|
|
@@ -403,9 +397,12 @@
|
|
|
from repeat_purchase_price rpp
|
|
|
left join product p on rpp.productId = p.productID
|
|
|
left join cm_sku cs on rpp.skuId = cs.skuId
|
|
|
+ left join cm_organize_product_info copi on copi.productId = rpp.productId
|
|
|
where rpp.delFlag = '0'
|
|
|
- and p.validFlag = '2'
|
|
|
+ and copi.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
and rpp.userId = #{userId}
|
|
|
+ and cs.organizeId = 0
|
|
|
order by rpp.createTime desc
|
|
|
</select>
|
|
|
<select id="getPageDetails" resultType="com.caimei365.commodity.model.vo.PageDetailVo">
|
|
@@ -454,8 +451,10 @@
|
|
|
p.productType
|
|
|
from product as p
|
|
|
left join cm_product_recommend as pr on pr.recommendProductID = p.productID
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
where pr.productID = #{productId}
|
|
|
- and p.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
+ and copi.validFlag = 2
|
|
|
order by pr.sort desc
|
|
|
</select>
|
|
|
<select id="getAutoProductRecommends" resultType="com.caimei365.commodity.model.search.ProductListVo">
|
|
@@ -466,7 +465,9 @@
|
|
|
IFNULL(p.visibility, 3) as visibility,
|
|
|
p.productType
|
|
|
from product as p
|
|
|
- where p.validFlag = 2
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
+ where copi.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
and p.commodityType = (select commodityType from product as p1 where p1.productID = #{productId})
|
|
|
and p.smallTypeID = (select smallTypeID from product as p2 where p2.productID = #{productId})
|
|
|
order by p.sellNumber desc
|
|
@@ -753,25 +754,25 @@
|
|
|
p.name,
|
|
|
p.aliasName,
|
|
|
p.mainImage as image,
|
|
|
- (select unit from cm_sku where productId = csp.productId order by price asc limit 1) as unit,
|
|
|
+ (select unit from cm_sku where productId = csp.productId and organizeId = 0 order by price asc limit 1) as unit,
|
|
|
p.productCode as code,
|
|
|
p.priceFlag,
|
|
|
- (select price from cm_sku where productId = csp.productId order by price asc limit 1) as price,
|
|
|
+ (select price from cm_sku where productId = csp.productId and organizeId = 0 order by price asc limit 1) as price,
|
|
|
p.shopID as shopId,
|
|
|
p.searchKey as keyword,
|
|
|
(select minBuyNumber
|
|
|
from cm_sku
|
|
|
- where productId = csp.productId
|
|
|
+ where productId = csp.productId and organizeId = 0
|
|
|
order by price asc
|
|
|
limit 1) as minBuyNumber,
|
|
|
(select ladderPriceFlag
|
|
|
from cm_sku
|
|
|
- where productId = csp.productId
|
|
|
+ where productId = csp.productId and organizeId = 0
|
|
|
order by price asc
|
|
|
limit 1) as ladderPriceFlag,
|
|
|
(select normalPrice
|
|
|
from cm_sku
|
|
|
- where productId = csp.productId
|
|
|
+ where productId = csp.productId and organizeId = 0
|
|
|
order by price asc
|
|
|
limit 1) as normalPrice,
|
|
|
p.step,
|
|
@@ -780,7 +781,7 @@
|
|
|
p.includedTax,
|
|
|
p.invoiceType,
|
|
|
p.productCategory as productCategory,
|
|
|
- p.validFlag,
|
|
|
+ copi.validFlag,
|
|
|
p.featuredFlag,
|
|
|
p.commodityType,
|
|
|
p.bigTypeID as bigTypeId,
|
|
@@ -789,7 +790,9 @@
|
|
|
p.visibility as visibility
|
|
|
from cm_svip_product csp
|
|
|
left join product p on p.productID = csp.productId
|
|
|
- where p.validFlag = 2
|
|
|
+ left join cm_organize_product_info copi on copi.productId = csp.productId
|
|
|
+ where copi.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
order by -csp.sort desc, csp.addTime desc
|
|
|
</select>
|
|
|
|
|
@@ -1053,20 +1056,20 @@
|
|
|
p.aliasName,
|
|
|
p.visibility,
|
|
|
p.mainImage,
|
|
|
- (select unit from cm_sku where productId=p.productID order by price asc limit 1)as unit,
|
|
|
+ (select unit from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as unit,
|
|
|
p.productCode as code,
|
|
|
p.priceFlag,
|
|
|
p.shopID as shopId,
|
|
|
p.searchKey as keyword,
|
|
|
- (select minBuyNumber from cm_sku where productId=p.productID order by price asc limit 1)as minBuyNumber,
|
|
|
- (select ladderPriceFlag from cm_sku where productId=p.productID order by price asc limit 1)as ladderPriceFlag,
|
|
|
- (select normalPrice from cm_sku where productId=p.productID order by price asc limit 1)as normalPrice,
|
|
|
+ (select minBuyNumber from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as minBuyNumber,
|
|
|
+ (select ladderPriceFlag from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as ladderPriceFlag,
|
|
|
+ (select normalPrice from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as normalPrice,
|
|
|
p.step,
|
|
|
p.taxPoint as taxRate,
|
|
|
p.includedTax,
|
|
|
p.invoiceType,
|
|
|
p.productCategory as productCategory,
|
|
|
- p.validFlag,
|
|
|
+ copi.validFlag,
|
|
|
p.featuredFlag,
|
|
|
p.commodityType,
|
|
|
p.bigTypeID as bigTypeId,
|
|
@@ -1074,13 +1077,15 @@
|
|
|
p.tinyTypeID as tinyTypeId,
|
|
|
p.productType,
|
|
|
p.brandID,
|
|
|
- (select price from cm_sku where productId=p.productID order by price asc limit 1)as price
|
|
|
+ (select price from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as price
|
|
|
from product p
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
<where>
|
|
|
and p.showFlag!=5
|
|
|
and p.newvalidFlag = 1
|
|
|
and p.newProductType=1
|
|
|
- and p.validFlag = 2
|
|
|
+ and copi.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
and p.showFlag!=2
|
|
|
and p.recommend=1
|
|
|
</where>
|
|
@@ -1090,11 +1095,11 @@
|
|
|
|
|
|
<select id="getNewFloorList" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
|
|
|
SELECT DISTINCT
|
|
|
- (select price from cm_sku where productID=p.productID order by price asc limit 1)as price,
|
|
|
- (select unit from cm_sku where productID=p.productID order by price asc limit 1)as unit,
|
|
|
- (select normalPrice from cm_sku where productID=p.productID order by price asc limit 1)as normalPrice,
|
|
|
- (select minBuyNumber from cm_sku where productID=p.productID order by price asc limit 1)as minBuyNumber,
|
|
|
- (select ladderPriceFlag from cm_sku where productID=p.productID order by price asc limit 1)as ladderPriceFlag,
|
|
|
+ (select price from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1)as price,
|
|
|
+ (select unit from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1)as unit,
|
|
|
+ (select normalPrice from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1)as normalPrice,
|
|
|
+ (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1)as minBuyNumber,
|
|
|
+ (select ladderPriceFlag from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1)as ladderPriceFlag,
|
|
|
p.productID,
|
|
|
p.actStatus,
|
|
|
p.name,
|
|
@@ -1110,7 +1115,7 @@
|
|
|
p.includedTax,
|
|
|
p.invoiceType,
|
|
|
p.productCategory as productCategory,
|
|
|
- p.validFlag,
|
|
|
+ copi.validFlag,
|
|
|
p.featuredFlag,
|
|
|
p.commodityType,
|
|
|
p.bigTypeID as bigTypeId,
|
|
@@ -1119,11 +1124,13 @@
|
|
|
p.productType,
|
|
|
p.brandID
|
|
|
from product p
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
<where>
|
|
|
and p.showFlag!=5
|
|
|
and p.newvalidFlag = 1
|
|
|
and p.newProductType=1
|
|
|
- and p.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
+ and copi.validFlag = 2
|
|
|
and p.showFlag!=2
|
|
|
<if test="brandID != null and brandID.size > 0">
|
|
|
and
|
|
@@ -1146,21 +1153,21 @@
|
|
|
p.aliasName,
|
|
|
p.visibility,
|
|
|
p.mainImage as image,
|
|
|
- (select unit from cm_sku where productId=p.productID order by price asc limit 1)as unit,
|
|
|
+ (select unit from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as unit,
|
|
|
p.productCode as code,
|
|
|
p.priceFlag,
|
|
|
- (select price from cm_sku where productId=p.productID order by price asc limit 1)as price,
|
|
|
+ (select price from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as price,
|
|
|
p.shopID as shopId,
|
|
|
p.searchKey as keyword,
|
|
|
- (select minBuyNumber from cm_sku where productId=p.productID order by price asc limit 1)as minBuyNumber,
|
|
|
- (select ladderPriceFlag from cm_sku where productId=p.productID order by price asc limit 1)as ladderPriceFlag,
|
|
|
- (select normalPrice from cm_sku where productId=p.productID order by price asc limit 1)as normalPrice,
|
|
|
+ (select minBuyNumber from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as minBuyNumber,
|
|
|
+ (select ladderPriceFlag from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as ladderPriceFlag,
|
|
|
+ (select normalPrice from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as normalPrice,
|
|
|
p.step,
|
|
|
p.taxPoint as taxRate,
|
|
|
p.includedTax,
|
|
|
p.invoiceType,
|
|
|
p.productCategory as productCategory,
|
|
|
- p.validFlag,
|
|
|
+ copi.validFlag,
|
|
|
p.featuredFlag,
|
|
|
p.commodityType,
|
|
|
p.bigTypeID as bigTypeId,
|
|
@@ -1168,8 +1175,9 @@
|
|
|
p.tinyTypeID as tinyTypeId,
|
|
|
p.productType,
|
|
|
p.brandID,
|
|
|
- (select price from cm_sku where productId=p.productID order by price asc limit 1)as price
|
|
|
+ (select price from cm_sku where productId=p.productID and organizeId = 0 order by price asc limit 1)as price
|
|
|
from product p
|
|
|
+ left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
<where>
|
|
|
|
|
|
<if test="productID != null and productID!=''">
|
|
@@ -1177,7 +1185,8 @@
|
|
|
</if>
|
|
|
and p.newvalidFlag = 1
|
|
|
and p.newProductType=1
|
|
|
- and p.validFlag = 2
|
|
|
+ and copi.organizeId = 0
|
|
|
+ and copi.validFlag = 2
|
|
|
</where>
|
|
|
|
|
|
# order by p.combinationSort != 0 desc, p.combinationSort asc
|
|
@@ -1195,9 +1204,11 @@
|
|
|
SELECT DISTINCT s.`id`, s.`name`
|
|
|
FROM product a
|
|
|
LEFT JOIN `cm_brand` s ON s.id = a.brandID
|
|
|
+ left join cm_organize_product_info copi on copi.productId = a.productId
|
|
|
WHERE a.newvalidFlag = 1
|
|
|
AND a.newProductType = 1
|
|
|
- AND a.validFlag = 2
|
|
|
+ AND copi.organizeId = 0
|
|
|
+ AND copi.validFlag = 2
|
|
|
AND a.showFlag != 2
|
|
|
AND s.id IS NOT NULL
|
|
|
AND s.name IS NOT NULL
|