Browse Source

采美sku

zhijiezhao 2 years ago
parent
commit
5a65fd7eb1

+ 18 - 24
src/main/resources/mapper/PageMapper.xml

@@ -165,9 +165,8 @@
                p.shopID            as shopId,
                p.searchKey         as keyword,
                (select minBuyNumber from cm_sku where p.productID=#{productId} order by price asc LIMIT 1) as minBuyNumber,
-               p.maxBuyNumber      as maxBuyNumber,
                (select ladderPriceFlag from cm_sku where p.productID=#{productId} order by price asc LIMIT 1) as ladderPriceFlag,
-               p.normalPrice,
+               (select normalPrice from cm_sku where p.productID=#{productId} order by price asc LIMIT 1) as normalPrice,
                p.step,
                p.shopID            as shopId,
                p.taxPoint          as taxRate,
@@ -275,10 +274,9 @@
                p.priceFlag,
                cs.price,
                cs.costPrice,
-               ifnull(p.costCheckFlag, 1) as costCheckFlag,
+               ifnull(cs.costCheckFlag, 1) as costCheckFlag,
                p.searchKey                as keyword,
                cs.minBuyNumber             as minBuyNumber,
-               p.maxBuyNumber             as maxBuyNumber,
                cs.ladderPriceFlag,
                cs.normalPrice,
                p.step,
@@ -628,16 +626,15 @@
                p.name,
                p.aliasName,
                p.mainImage       as image,
-               p.unit,
+               (select unit from cm_sku where productId=csp.productId order by price asc limit 1)as unit,
                p.productCode     as code,
                p.priceFlag,
-               p.price,
+               (select unit from cm_sku where productId=csp.productId order by price asc limit 1)as price,
                p.shopID          as shopId,
                p.searchKey       as keyword,
-               p.minBuyNumber    as minBuyNumber,
-               p.maxBuyNumber    as maxBuyNumber,
-               p.ladderPriceFlag,
-               p.normalPrice,
+               (select minBuyNumber from cm_sku where productId=csp.productId order by price asc limit 1)as minBuyNumber,
+               (select ladderPriceFlag from cm_sku where productId=csp.productId order by price asc limit 1)as ladderPriceFlag,
+               (select normalPrice from cm_sku where productId=csp.productId order by price asc limit 1)as normalPrice,
                p.step,
                p.shopID          as shopId,
                p.taxPoint        as taxRate,
@@ -901,15 +898,14 @@
         p.aliasName,
         p.visibility,
         p.mainImage,
-        p.unit,
+        (select unit from cm_sku where productId=p.productID order by price asc limit 1)as unit,
         p.productCode as code,
         p.priceFlag,
         p.shopID as shopId,
         p.searchKey as keyword,
-        p.minBuyNumber as minBuyNumber,
-        p.maxBuyNumber as maxBuyNumber,
-        p.ladderPriceFlag,
-        p.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 normalPrice from cm_sku where productId=p.productID order by price asc limit 1)as normalPrice,
         p.step,
         p.taxPoint as taxRate,
         p.includedTax,
@@ -923,7 +919,7 @@
         p.tinyTypeID as tinyTypeId,
         p.productType,
         p.brandID,
-        p.price
+        (select price from cm_sku where productId=p.productID order by price asc limit 1)as price
         from product p
         <where>
             and p.showFlag!=5
@@ -948,7 +944,6 @@
         p.priceFlag,
         p.shopID as shopId,
         p.searchKey as keyword,
-        p.maxBuyNumber      as maxBuyNumber,
         p.step,
         p.taxPoint as taxRate,
         p.includedTax,
@@ -990,16 +985,15 @@
         p.aliasName,
         p.visibility,
         p.mainImage as image,
-        p.unit,
+        (select unit from cm_sku where productId=p.productID order by price asc limit 1)as unit,
         p.productCode as code,
         p.priceFlag,
-        p.price,
+        (select price from cm_sku where productId=p.productID order by price asc limit 1)as price,
         p.shopID as shopId,
         p.searchKey as keyword,
-        p.minBuyNumber as minBuyNumber,
-        p.maxBuyNumber as maxBuyNumber,
-        p.ladderPriceFlag,
-        p.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 normalPrice from cm_sku where productId=p.productID order by price asc limit 1)as normalPrice,
         p.step,
         p.taxPoint as taxRate,
         p.includedTax,
@@ -1013,7 +1007,7 @@
         p.tinyTypeID as tinyTypeId,
         p.productType,
         p.brandID,
-        p.price
+        (select price from cm_sku where productId=p.productID order by price asc limit 1)as price
         from product p
         <where>
 

+ 0 - 2
src/main/resources/mapper/PriceMapper.xml

@@ -10,7 +10,6 @@
         select p.productID                  as productId,
                p.actStatus,
                (select normalPrice from cm_sku where productId=#{productId} order by price asc limit 1) as normalPrice,
-               p.maxBuyNumber,
                p.priceFlag,
                p.step,
                p.shopID                     as shopId,
@@ -30,7 +29,6 @@
         select
         p.productID as productId,
         p.actStatus,
-        p.maxBuyNumber,
         p.priceFlag,
         p.step,
         p.shopID as shopId,

+ 6 - 5
src/main/resources/mapper/PromotionsMapper.xml

@@ -79,13 +79,14 @@
                cpg.number  as number,
                0           as price,
                2           as productType,
-               p.price    as originalPrice,
-               p.unit      as unit,
+               cs.price    as originalPrice,
+               cs.unit      as unit,
                p.validFlag as validFlag,
-               p.stock     as stock,
+               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
         where cpg.promotionsId = #{promotionsId}
         order by cpg.addTime desc
     </select>
@@ -125,8 +126,8 @@
         p.productID as productId,
         p.`name` as `name`,
         p.mainImage as image,
-        p.price,
-        p.unit as unit,
+        (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,
         p.priceFlag,
         IFNULL(p.visibility,3) as visibility,
         p.productType

+ 3 - 3
src/main/resources/mapper/SearchMapper.xml

@@ -296,10 +296,10 @@
         p.`name` as name,
         p.mainImage as image,
         br.name as brandName,
-        p.unit 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,
-        p.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
@@ -345,7 +345,7 @@
             <when test="sortField != null and sortField != ''">
                 <choose>
                     <when test="sortField == 'price'">
-                        order by p.price
+                        order by price
                     </when>
                     <when test="sortField == 'sales'">
                         order by p.sellNumber

+ 15 - 13
src/main/resources/mapper/SecondHandMapper.xml

@@ -65,7 +65,7 @@
         p.actStatus,
         p.`name` as name,
         p.mainImage as image,
-        p.price,
+        cs.price,
         p.brandID as brandId,
         IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
         cshd.sold as "sold",
@@ -73,8 +73,8 @@
         cshd.onLineDate as "onLineDate",
         cshd.viewingNum as "viewingNum",
         cshd.provinceCityDistrict as "provinceCityDistrict"
-        from
-        product p
+        from product p
+        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
@@ -104,10 +104,10 @@
                p.actStatus,
                p.`name`                                      as name,
                p.mainImage                                   as image,
-               p.price,
-               p.normalPrice,
+               cs.price,
+               cs.normalPrice,
                p.productType,
-               p.stock,
+               cs.stock,
                p.brandID                                     as brandId,
                p.visibility                                  as visibility,
                IF(p.brandID != 161, cb.name, cshd.brandName) as "brandName",
@@ -130,6 +130,7 @@
                cshd.publishIdentity,
                cshd.companyName
         from product p
+                 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
@@ -157,7 +158,7 @@
         p.actStatus,
         p.`name` as name,
         p.mainImage as image,
-        p.price,
+        cs.price,
         p.brandID as brandId,
         IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
         cshd.sold as "sold",
@@ -165,8 +166,8 @@
         cshd.onLineDate as "onLineDate",
         cshd.viewingNum as "viewingNum",
         cshd.provinceCityDistrict as "provinceCityDistrict"
-        from
-        product p
+        from product p
+        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
@@ -189,7 +190,7 @@
         p.actStatus,
         p.`name` as name,
         p.mainImage as image,
-        p.price,
+        cs.price,
         p.brandID as brandId,
         IF(p.brandID != 161,cb.name ,cshd.brandName) as "brandName",
         cshd.sold as "sold",
@@ -197,8 +198,8 @@
         cshd.onLineDate as "onLineDate",
         cshd.viewingNum as "viewingNum",
         cshd.provinceCityDistrict as "provinceCityDistrict"
-        from
-        product p
+        from product p
+        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
@@ -223,10 +224,11 @@
                p.actStatus,
                p.`name`    as name,
                p.mainImage as image,
-               p.price,
+               cs.price,
                p.brandID   as brandId,
                cb.name     as "brandName"
         from product p
+                 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

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

@@ -7,16 +7,15 @@
                p.name,
                p.aliasName,
                p.mainImage       as image,
-               p.unit,
+               (select unit from cm_sku where p.productID=p.productID order by price asc limit 1)as unit,
                p.productCode     as code,
                p.priceFlag,
-               p.price,
+               (select price from cm_sku where p.productID=p.productID order by price asc limit 1)as price,
                p.shopID          as shopId,
                p.searchKey       as keyword,
-               p.minBuyNumber    as minBuyNumber,
-               p.maxBuyNumber    as maxBuyNumber,
-               p.ladderPriceFlag,
-               p.normalPrice,
+               (select minBuyNumber from cm_sku where p.productID=p.productID order by price asc limit 1) as minBuyNumber,
+               (select ladderPriceFlag from cm_sku where p.productID=p.productID order by price asc limit 1) as ladderPriceFlag,
+               (select normalPrice from cm_sku where p.productID=p.productID order by price asc limit 1)as normalPrice,
                p.step,
                p.shopID          as shopId,
                p.taxPoint        as taxRate,
@@ -96,7 +95,6 @@
         p.priceFlag,
         p.shopID as shopId,
         p.searchKey as keyword,
-        p.maxBuyNumber as maxBuyNumber,
         p.step,
         p.shopID as shopId,
         p.taxPoint as taxRate,

+ 10 - 11
src/main/resources/mapper/ShopMapper.xml

@@ -384,8 +384,8 @@
         p.shopID as shopId,
         p.`name` as `name`,
         p.mainImage as image,
-        p.price as price,
-        p.unit as unit,
+        (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,
         p.priceFlag as priceFlag,
         IFNULL(p.visibility,3) as visibility,
         p.productType
@@ -412,7 +412,6 @@
         (select normalPrice from cm_sku where productId=p.productId order by price asc LIMIT 1) as normalPrice,
         p.searchKey as keyword,
         (select minBuyNumber from cm_sku where productId=p.productId order by price asc LIMIT 1) as minBuyNumber,
-        p.maxBuyNumber as maxBuyNumber,
         (select ladderPriceFlag from cm_sku where productId=p.productId order by price asc LIMIT 1) as ladderPriceFlag,
         p.step,
         p.shopID as shopId,
@@ -515,7 +514,7 @@
                aliasName,
                commodityType,
                mainImage,
-               stock,
+               (select stock from cm_sku where productId=p.productId order by price asc LIMIT 1) as stock,
                invoiceType,
                bigTypeID                 as bigTypeId,
                smallTypeID               as smallTypeId,
@@ -525,23 +524,23 @@
                brandID                   as brandId,
                productType,
                tags,
-               unit,
-               normalPrice,
-               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 price from cm_sku where productId=p.productId order by price asc LIMIT 1)as price,
                includedTax,
-               minBuyNumber,
+               (select minBuyNumber from cm_sku where productId=p.productId order by price asc LIMIT 1)as minBuyNumber,
                productCategory,
                serviceNumber,
                supplierTaxPoint,
                priceFlag,
                actFlag,
-               ladderPriceFlag,
+               (select ladderPriceFlag from cm_sku where productId=p.productId order by price asc LIMIT 1) as ladderPriceFlag,
                addTime,
                hasSkuFlag,
                sellNumber,
                sortIndex,
                featuredFlag,
-               costCheckFlag,
+               (select costCheckFlag from cm_sku where productId=p.productId order by price asc LIMIT 1)as costCheckFlag,
                recommendType,
                machineType,
                productCode,
@@ -550,7 +549,7 @@
                searchKey,
                allAreaFlag,
                step,
-               costPrice,
+               (select costPrice from cm_sku where productId=p.productId order by price asc LIMIT 1)as costPrice,
                provinceIds,
                qualificationImg,
                trainingMethod,

+ 0 - 1
src/main/resources/mapper/UserLikeMapper.xml

@@ -41,7 +41,6 @@
                p.productCode     AS CODE,
                p.priceFlag,
                p.searchKey       AS keyword,
-               p.maxBuyNumber    AS maxBuyNumber,
                p.step,
                p.shopID          AS shopId,
                p.taxPoint        AS taxRate,