瀏覽代碼

联合丽格v.1.0.2

kaick 1 年之前
父節點
當前提交
dcc5007a48

+ 1 - 1
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -739,7 +739,7 @@ public class PageServiceImpl implements PageService {
                 product.setUnit(organizeSkus.get(0).getUnit());
                 product.setStock(organizeSkus.get(0).getStock());
                 product.setOrganizeSkus(organizeSkus);
-                product.setSkuId(organizeSkus.get(0).getId());
+                product.setSkuId(organizeSkus.get(0).getSkuId());
                 //设置展示的价格等级
                 product.setPriceGrade(priceUtilService.getPriceGrade(product.getPrice()));
                 //查询商品收藏情况,1未收藏,0未收藏,未收藏过该商品用户是null

+ 7 - 6
src/main/resources/mapper/CouponMapper.xml

@@ -86,7 +86,7 @@
         p.includedTax,
         p.invoiceType,
         p.productCategory AS productCategory,
-        p.validFlag,
+        IFNULL((SELECT validFlag FROM cm_organize_product_info  WHERE productId = p.productID AND organizeId = 0), 999) AS validFlag,
         p.featuredFlag,
         p.commodityType,
         p.bigTypeID AS bigTypeId,
@@ -96,6 +96,7 @@
         FROM
         cm_coupon_product a
         LEFT JOIN product p ON a.productId = p.productID
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         WHERE
         a.delFlag = 0
         AND a.couponId = #{couponId}
@@ -107,19 +108,19 @@
         </if>
         <choose>
             <when test="identity == 1">
-                AND p.validFlag IN (2,3,9)
+                AND copi.validFlag IN (2,3,9)
             </when>
             <when test="identity == 5">
-                AND p.validFlag = 2
+                AND copi.validFlag = 2
             </when>
             <when test="identity == 2">
-                AND p.visibility IN (1,2,3) AND p.validFlag = 2
+                AND p.visibility IN (1,2,3) AND copi.validFlag = 2
             </when>
             <when test="identity == 4">
-                AND p.visibility IN (2,3) AND p.validFlag = 2
+                AND p.visibility IN (2,3) AND copi.validFlag = 2
             </when>
             <otherwise>
-                AND p.visibility = 3 AND p.validFlag = 2
+                AND p.visibility = 3 AND copi.validFlag = 2
             </otherwise>
         </choose>
         ORDER BY

+ 44 - 31
src/main/resources/mapper/MallOrganizeMapper.xml

@@ -51,17 +51,19 @@
         cmfp.floorId,
         p.productID AS productId,
         (select price from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as price,
-        p.normalPrice,
-        p.costPrice,
-        p.ladderPriceFlag,
+        s.normalPrice,
+        s.costPrice,
+        s.ladderPriceFlag,
         (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
-        p.validFlag,
+        IFNULL((SELECT validFlag FROM cm_organize_product_info  WHERE productId = p.productID AND organizeId =4), 999) AS validFlag,
         p.name,
         p.mainImage
         FROM cm_mall_floor_product cmfp
         LEFT JOIN product p ON p.productId = cmfp.productId
+        LEFT JOIN cm_sku s ON p.productId = s.productId
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 4
         <where>
-            p.validFlag = 2
+            copi.validFlag = 2
             <if test="floorIds.size() > 0">
                 and cmfp.floorId in
                 <foreach collection="floorIds" item="floorId" open="(" separator="," close=")">
@@ -83,16 +85,18 @@
     <select id="getMallProducts" resultType="com.caimei365.commodity.model.vo.MallOrganizeProductVo">
         SELECT
         p.productID as productId,
-        p.normalPrice,
-        p.costPrice,
-        p.ladderPriceFlag,
+        s.normalPrice,
+        s.costPrice,
+        s.ladderPriceFlag,
         (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
-        p.validFlag,
+        copi.validFlag,
         p.name,
         p.mainImage
         FROM product p
+        LEFT JOIN cm_sku s ON p.productId = s.productId
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 4
         <where>
-            p.validFlag = 2
+            copi.validFlag = 2
             <if test="activeIds.size() > 0">
                 and cmap.activeId in
                 <foreach collection="activeIds" item="activeId" open="(" separator="," close=")">
@@ -109,15 +113,17 @@
     <select id="getMenuProductList" resultType="com.caimei365.commodity.model.vo.MallOrganizeProductVo">
         SELECT
             p.productID as productId,
-            p.normalPrice,
-            p.costPrice,
-            p.ladderPriceFlag,
+            s.normalPrice,
+            s.costPrice,
+            s.ladderPriceFlag,
             (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
-            p.validFlag,
+            copi.validFlag,
             p.name,
             p.mainImage
         FROM cm_mall_mainmenu cmm
                  LEFT JOIN product p ON p.productId = cmm.jumpProductId
+            LEFT JOIN cm_sku s ON p.productId = s.productId
+            left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 4
         WHERE cmm.organizeId = #{organizeId} and cmm.id = #{id}
           and cmm.enabledStatus = 1
     </select>
@@ -138,15 +144,17 @@
         SELECT
             p.productID as productId,
             cmap.imageId AS imageId,
-            p.normalPrice,
-            p.costPrice,
+            s.normalPrice,
+            s.costPrice,
+            s.ladderPriceFlag,
             (SELECT price FROM cm_sku WHERE productID=p.productID and organizeId = 4 ORDER BY price ASC LIMIT 1) AS price,
-            p.ladderPriceFlag,
             (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
-            p.validFlag,
+            copi.validFlag,
             p.name,
             p.mainImage
         FROM  product p
+            LEFT JOIN cm_sku s ON p.productId = s.productId
+            left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 4
                   LEFT JOIN cm_mall_active_product cmap ON p.productId = cmap.productId
         WHERE cmap.activeId = #{activeId}
         order by cmap.sort
@@ -160,10 +168,10 @@
         SELECT
             cmap.imageId as imageId,
             p.productID as productId,
-            p.normalPrice,
-            p.costPrice,
+            s.normalPrice,
+            s.costPrice,
+            s.ladderPriceFlag,
             (select price from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as price,
-            p.ladderPriceFlag,
             (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
             IFNULL((SELECT validFlag FROM cm_organize_product_info  WHERE productId = p.productID AND organizeId = 4), 999) AS validFlag,
             p.name,
@@ -171,6 +179,7 @@
         FROM cm_mall_active cma
          LEFT JOIN cm_mall_active_product cmap ON cmap.activeId = cma.id
          LEFT JOIN product p ON p.productId = cmap.productId
+            LEFT JOIN cm_sku s ON p.productId = s.productId
         where  cma.id = #{activeId}
           and cma.enabledStatus = 1
     </select>
@@ -186,15 +195,16 @@
             cmap.imageId AS imageId,
             (SELECT topic FROM cm_mall_active_image WHERE id = #{imageId} limit 1) AS topic,
             p.productID AS productId,
-            p.normalPrice,
-            p.costPrice,
+            s.normalPrice,
+            s.costPrice,
+            s.ladderPriceFlag,
             (SELECT price FROM cm_sku WHERE productID=p.productID and organizeId = 4 ORDER BY price ASC LIMIT 1) AS price,
-            p.ladderPriceFlag,
             (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
             IFNULL((SELECT validFlag FROM cm_organize_product_info  WHERE productId = p.productID AND organizeId = 4), 999) AS validFlag,
             p.name,
             p.mainImage
         FROM product p
+            LEFT JOIN cm_sku s ON p.productId = s.productId
                  LEFT JOIN cm_mall_active_product cmap ON p.productId = cmap.productId
             where cmap.imageId = #{imageId}
             order by cmap.sort
@@ -203,15 +213,16 @@
         SELECT
             cmfp.floorId,
             p.productID AS productId,
-            p.normalPrice,
-            p.costPrice,
+            s.normalPrice,
+            s.costPrice,
+            s.ladderPriceFlag,
             (SELECT price FROM cm_sku WHERE productID=p.productID and organizeId = 4 ORDER BY price ASC LIMIT 1) AS price,
-            p.ladderPriceFlag,
             (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
             IFNULL((SELECT validFlag FROM cm_organize_product_info  WHERE productId = p.productID AND organizeId = 4), 999) AS validFlag,
             p.name,
             p.mainImage
         FROM product p
+            LEFT JOIN cm_sku s ON p.productId = s.productId
                  LEFT JOIN cm_mall_floor_product cmfp ON cmfp.productId = p.productId
         WHERE cmfp.floorId = #{floorId}
     </select>
@@ -223,15 +234,17 @@
     <select id="getThemeProduct" resultType="com.caimei365.commodity.model.vo.MallOrganizeProductVo">
         SELECT
             p.productID as productId,
-            p.normalPrice,
-            p.costPrice,
+            s.normalPrice,
+            s.costPrice,
+            s.ladderPriceFlag,
             (select price from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as price,
-            p.ladderPriceFlag,
             (select minBuyNumber from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as minBuyNumber,
-            p.validFlag,
+            copi.validFlag,
             p.name,
             p.mainImage
         FROM  product p
+            LEFT JOIN cm_sku s ON p.productId = s.productId
+            left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 4
         WHERE p.productId = #{id}
     </select>
 </mapper>

+ 4 - 2
src/main/resources/mapper/MallProductMapper.xml

@@ -4,16 +4,18 @@
     <select id="getOrganizeProductDetails" resultType="com.caimei365.commodity.model.vo.MallOrganizeProductVo">
         SELECT p.productID                                                                                     AS productId,
                p.shopID                                                                                        AS shopId,
-               p.normalPrice AS normalPrice,
+               s.normalPrice AS normalPrice,
                (select price from cm_sku where productID=p.productID and organizeId = 4 order by price asc limit 1) as price,
                IFNULL((SELECT stock FROM cm_sku WHERE productId = #{productId} and organizeId = 4 ORDER BY price ASC LIMIT 1), 0) AS stock,
                p.minBuyNumber AS minBuyNumber,
                (SELECT unit FROM cm_sku WHERE productId = #{productId} and organizeId = 4 ORDER BY price ASC LIMIT 1)             AS unit,
-               p.validFlag,
+               copi.validFlag,
                p.name,
                s.name as shopName
         FROM  product p
+            LEFT JOIN cm_sku s ON p.productId = s.productId
                  LEFT JOIN shop s ON s.shopId = p.shopId
+            left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 4
         WHERE p.productID = #{productId}
     </select>
     <select id="getMallSkus" resultType="com.caimei365.commodity.model.dto.Sku">

+ 1 - 1
src/main/resources/mapper/PriceMapper.xml

@@ -240,7 +240,7 @@
         ORDER BY price ASC
     </select>
     <select id="findOrganizeSkus" resultType="com.caimei365.commodity.model.vo.MallProductSkuVo">
-        SELECT id,
+        SELECT skuId,
                unit,
                minBuyNumber,
                price,

+ 4 - 2
src/main/resources/mapper/PromotionsMapper.xml

@@ -81,12 +81,13 @@
                2           as productType,
                cs.price    as originalPrice,
                cs.unit      as unit,
-               p.validFlag as validFlag,
+               copi.validFlag as validFlag,
                cs.stock     as stock,
                p.productType
         from product p
                  left join cm_promotions_gift cpg on cpg.productId = p.productID
         left join cm_sku cs on cpg.skuId=cs.skuId
+                 left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         where cpg.promotionsId = #{promotionsId} and cs.organizeId = 0
         order by cpg.addTime desc
     </select>
@@ -133,12 +134,13 @@
         p.productType
         from product p
         left join cm_promotions_product cpp on cpp.productId = p.productID
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         where cpp.promotionsId = #{promotionsId}
         and p.visibility in
         <foreach collection="visibilityList" item="visibility" index="index" open="(" separator="," close=")">
             #{visibility}
         </foreach>
-        and p.validFlag = 2
+        and copi.validFlag = 2
         order by p.productID desc
     </select>
     <select id="getPromotionGiftsByProductId" resultType="com.caimei365.commodity.model.vo.PromotionsVo">

+ 12 - 9
src/main/resources/mapper/SearchMapper.xml

@@ -21,7 +21,7 @@
         t.name as p_category3_name,
         p.preferredFlag as p_preferred,
         p.productCategory as p_type,
-        p.validFlag as p_valid,
+        copi.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,
@@ -43,7 +43,8 @@
         <include refid="Search_Product_List"/>
         from product p
         <include refid="Product_Joins"/>
-        where p.validFlag in (2,3,9) and p.productCategory = 1
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
+        where copi.validFlag in (2,3,9) and p.productCategory = 1
         and p.productID = #{productId}
     </select>
     <select id="findProductCount" resultType="java.lang.Integer">
@@ -69,7 +70,8 @@
         <include refid="Search_Product_List"/>
         from product p
         <include refid="Product_Joins"/>
-        where p.validFlag in (2,3,9) and productCategory = 1
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
+        where copi.validFlag in (2,3,9) and productCategory = 1
         order by productID desc
     </select>
     <select id="findMallIdByProductId" resultType="java.lang.Integer">
@@ -274,25 +276,26 @@
         p.searchKey as keyword
         from product p
         left join cm_brand as br on p.brandID = br.id
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         where p.productCategory = 1 and p.newvalidFlag=1
         <choose>
             <when test="identity == 1">
-                and p.validFlag in (2,3,9)
+                and copi.validFlag in (2,3,9)
             </when>
             <when test="identity == 5">
-                and p.validFlag = 2
+                and copi.validFlag = 2
             </when>
             <when test="identity == 2">
-                and p.visibility in (1,2,3) and p.validFlag = 2
+                and p.visibility in (1,2,3) and copi.validFlag = 2
             </when>
             <when test="identity == 4">
-                and p.visibility in (2,3) and p.validFlag = 2
+                and p.visibility in (2,3) and copi.validFlag = 2
             </when>
             <when test="identity == 5">
-                and p.visibility in (1,2,3,4) and p.validFlag = 2
+                and p.visibility in (1,2,3,4) and copi.validFlag = 2
             </when>
             <otherwise>
-                and p.visibility = 3 and p.validFlag = 2
+                and p.visibility = 3 and copi.validFlag = 2
             </otherwise>
         </choose>
         <if test="shopId != null and shopId != ''">

+ 8 - 4
src/main/resources/mapper/SecondHandMapper.xml

@@ -74,11 +74,12 @@
         cshd.viewingNum as "viewingNum",
         cshd.provinceCityDistrict as "provinceCityDistrict"
         from product p
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         left join cm_sku cs on p.productID=cs.productId
         left join cm_second_hand_detail cshd on p.productID = cshd.productID
         left join cm_brand cb on cb.id = p.brandID
         where
-        p.productCategory = 2 and p.validFlag = 2 and cs.organizeId = 0
+        p.productCategory = 2 and copi.validFlag = 2 and cs.organizeId = 0
         <if test="secondHandType != null and secondHandType != ''">
             and cshd.secondHandType = #{secondHandType}
         </if>
@@ -168,11 +169,12 @@
         cshd.viewingNum as "viewingNum",
         cshd.provinceCityDistrict as "provinceCityDistrict"
         from product p
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         left join cm_sku cs on p.productID=cs.productId
         left join cm_second_hand_detail cshd on p.productID = cshd.productID
         left join cm_brand cb on cb.id = p.brandID
         where
-        p.productCategory = 2 and p.validFlag = 2 and cs.organizeId = 0
+        p.productCategory = 2 and copi.validFlag = 2 and cs.organizeId = 0
         <if test="secondHandType != null and secondHandType != ''">
             and cshd.secondHandType = #{secondHandType}
         </if>
@@ -200,10 +202,11 @@
         cshd.viewingNum as "viewingNum",
         cshd.provinceCityDistrict as "provinceCityDistrict"
         from product p
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         left join cm_sku cs on p.productID=cs.productId
         left join cm_second_hand_detail cshd on p.productID = cshd.productID
         left join cm_brand cb on cb.id = p.brandID
-        where p.productCategory = 2 and p.validFlag = 2 and cs.organizeId = 0
+        where p.productCategory = 2 and copi.validFlag = 2 and cs.organizeId = 0
         <if test="secondHandType != null and secondHandType != ''">
             and cshd.secondHandType = #{secondHandType}
         </if>
@@ -229,10 +232,11 @@
                p.brandID   as brandId,
                cb.name     as "brandName"
         from product p
+                 left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
                  left join cm_sku cs on p.productID = cs.productId
                  left join cm_second_hand_recommend cshr on p.productID = cshr.recommendProductID
                  left join cm_brand cb on cb.id = p.brandID
-        where p.validFlag = 2
+        where copi.validFlag = 2
           and cs.organizeId = 0
           and cshr.delFlag = 0
           and cshr.secondHandProductID = #{productId}

+ 11 - 7
src/main/resources/mapper/SellerMapper.xml

@@ -22,7 +22,7 @@
                p.includedTax,
                p.invoiceType,
                p.productCategory as productCategory,
-               p.validFlag,
+               copi.validFlag,
                p.featuredFlag,
                p.commodityType,
                p.bigTypeID       as bigTypeId,
@@ -30,15 +30,17 @@
                p.tinyTypeID      as tinyTypeId,
                p.productType
         from product p
+            left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         where
         (name LIKE CONCAT('%',#{searchWord},'%') or productCode LIKE CONCAT('%',#{searchWord},'%'))
-        and validFlag in (2,3,9)
+        and copi.validFlag in (2,3,9)
     </select>
     <select id="getCombinationList" resultType="com.caimei365.commodity.model.vo.CombinationVo">
         select c.id, c.name, c.addTime, c.updateTime,p.productType
         from cm_product_combination c
         left join product p on p.combinationID = c.id
-        where c.delFlag = 0 and p.validFlag = 2
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
+        where c.delFlag = 0 and copi.validFlag = 2
         <if test="searchWord != null and searchWord != ''">
             and (p.name like CONCAT('%',#{searchWord},'%') or p.productCode LIKE CONCAT('%',#{searchWord},'%'))
         </if>
@@ -60,7 +62,7 @@
             p.includedTax,
             p.invoiceType,
             p.productCategory as productCategory,
-            p.validFlag,
+            copi.validFlag,
             p.featuredFlag,
             p.commodityType,
             p.bigTypeID as bigTypeId,
@@ -68,7 +70,8 @@
             p.tinyTypeID as tinyTypeId,
             p.productType
         from product p
-        where p.validFlag = 2
+                 left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
+        where copi.validFlag = 2
           and p.combinationID = #{id}
         order by p.combinationSort != 0 desc, p.combinationSort asc
     </select>
@@ -101,7 +104,7 @@
         p.includedTax,
         p.invoiceType,
         p.productCategory as productCategory,
-        p.validFlag,
+        copi.validFlag,
         p.featuredFlag,
         p.commodityType,
         p.bigTypeID as bigTypeId,
@@ -109,11 +112,12 @@
         p.tinyTypeID as tinyTypeId,
         p.productType
         from product p
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         where
         p.productID in
         <foreach collection="productIds" open="(" separator="," close=")" item="productId">
             #{productId}
         </foreach>
-        and validFlag = '2'
+        and copi.validFlag = '2'
     </select>
 </mapper>

+ 4 - 2
src/main/resources/mapper/ShopMapper.xml

@@ -419,12 +419,13 @@
         IFNULL(p.visibility,3) as visibility,
         p.productType
         from product p
+        left join cm_organize_product_info copi on copi.productId = p.productID and copi.organizeId = 0
         where p.shopID = #{shopId}
         and p.visibility in
         <foreach collection="visibilityList" item="visibility" index="index" open="(" separator="," close=")">
             #{visibility}
         </foreach>
-        and p.validFlag = 2 and p.featuredFlag=1
+        and copi.validFlag = 2 and p.featuredFlag=1
         order by p.productID desc limit 4
     </select>
     <select id="getShopProductsSelect" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
@@ -696,8 +697,9 @@
     <select id="getProductNumById" resultType="java.lang.Integer">
         select COUNT(*) as normalNum
         from product p
+        left join cm_organize_product_info copi on copi.productId = p.productID
         where p.shopID = #{shopId}
-          and p.validFlag = 2
+          and copi.validFlag = 2
         group by p.shopID
     </select>
     <select id="getUserIdentityById" resultType="java.lang.Integer">