|
@@ -21,15 +21,15 @@
|
|
|
t.name as p_category3_name,
|
|
|
p.preferredFlag as p_preferred,
|
|
|
p.productCategory as p_type,
|
|
|
- IFNULL((SELECT validFlag FROM cm_organize_product_info WHERE productId = p.productID AND organizeId = 0), 999) as p_valid,
|
|
|
+ p.validFlag as p_valid,
|
|
|
br.weights as p_sort,
|
|
|
DATE_FORMAT(p.ADDTIME,'%Y%m%d') as p_time,
|
|
|
IFNULL(p.visibility,3) as p_visibility,
|
|
|
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} and organizeId = 0 order by price asc LIMIT 1) as p_unit,
|
|
|
- (select price from cm_sku where productID=#{productId} and organizeId = 0 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
|
|
@@ -43,66 +43,34 @@
|
|
|
<include refid="Search_Product_List"/>
|
|
|
from product p
|
|
|
<include refid="Product_Joins"/>
|
|
|
- left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
- where copi.validFlag in (2,3,9) and p.productCategory = 1 and copi.organizeId = 0
|
|
|
+ where p.validFlag in (2,3,9) and p.productCategory = 1
|
|
|
and p.productID = #{productId}
|
|
|
</select>
|
|
|
<select id="findProductCount" resultType="java.lang.Integer">
|
|
|
select count(*)
|
|
|
- from product p
|
|
|
- left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
- where copi.validFlag in (2, 3, 9) and copi.organizeId = 0
|
|
|
- and p.productCategory = 1
|
|
|
+ from product
|
|
|
+ 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 copi.productId = p.productId
|
|
|
- where copi.validFlag not in (2, 3, 9) and copi.organizeId = 0
|
|
|
- or p.productCategory != 1
|
|
|
+ from product
|
|
|
+ where validFlag not 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 copi.productId = p.productId
|
|
|
- where copi.validFlag not in (2, 3, 9) and copi.organizeId = 0
|
|
|
- or p.productCategory != 1
|
|
|
+ select productID
|
|
|
+ from product
|
|
|
+ where validFlag not in (2, 3, 9)
|
|
|
+ or productCategory != 1
|
|
|
</select>
|
|
|
<select id="searchProductList" resultType="com.caimei365.commodity.model.search.ProductDO">
|
|
|
select
|
|
|
<include refid="Search_Product_List"/>
|
|
|
from product p
|
|
|
<include refid="Product_Joins"/>
|
|
|
- left join cm_organize_product_info copi on copi.productId = p.productId
|
|
|
- where copi.validFlag in (2,3,9) and p.productCategory = 1 and copi.organizeId = 0
|
|
|
- order by p.productID desc
|
|
|
- </select>
|
|
|
- <select id="searchMallProductByProductId" resultType="com.caimei365.commodity.model.search.MallProductDO">
|
|
|
- select m.id as m_id,
|
|
|
- m.organizeID as m_organize_id,
|
|
|
- m.productID as m_product_id,
|
|
|
- m.retailPrice as m_price,
|
|
|
- m.classifyID as m_classify_id,
|
|
|
- m.delFlag as m_valid,
|
|
|
- c.classifyName as m_classify_name
|
|
|
- from cm_mall_organize_products as m
|
|
|
- left join cm_mall_products_classify as c on m.classifyId = c.id
|
|
|
- where m.productID = #{productId}
|
|
|
- and m.organizeID = 1
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="getMallLadderPriceFlag" resultType="java.lang.Integer">
|
|
|
- select ladderPriceFlag
|
|
|
- from cm_mall_organize_products
|
|
|
- where productID = #{productId}
|
|
|
- and organizeID = 1
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
- <select id="getMallLowerLadderPrice" resultType="java.lang.Double">
|
|
|
- select MIN(buyPrice)
|
|
|
- from cm_mall_product_ladder_price
|
|
|
- where delFlag = '0'
|
|
|
- and productId = #{productId}
|
|
|
+ where p.validFlag in (2,3,9) and productCategory = 1
|
|
|
+ order by productID desc
|
|
|
</select>
|
|
|
<select id="findMallIdByProductId" resultType="java.lang.Integer">
|
|
|
select id
|
|
@@ -297,10 +265,10 @@
|
|
|
p.`name` as name,
|
|
|
p.mainImage as image,
|
|
|
br.name as brandName,
|
|
|
- (select unit from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1) as unit,
|
|
|
+ (select unit from cm_sku where productID=p.productID order by price asc limit 1) as unit,
|
|
|
p.productCode as code,
|
|
|
p.priceFlag,
|
|
|
- (select price from cm_sku where productID=p.productID and organizeId = 0 order by price asc limit 1)as price,
|
|
|
+ (select price from cm_sku where productID=p.productID order by price asc limit 1)as price,
|
|
|
p.shopID as shopId,
|
|
|
p.productType,
|
|
|
p.searchKey as keyword
|