Pārlūkot izejas kodu

促销方案商品bug修复

郭齐峰 3 gadi atpakaļ
vecāks
revīzija
275fcf9931

+ 15 - 5
src/custom/restcontroller/webmanage/sale/promotion/SQL/促销方案商品查询.sql

@@ -31,11 +31,21 @@ SELECT t1.sa_promotion_itemsid,
 FROM sa_promotion_items t1
          left join plm_item t2 on t1.itemid = t2.itemid and t1.siteid = t2.siteid
          left join plm_unit t3 on t2.unitid = t3.unitid and t2.siteid = t3.siteid
-         left join sa_promotion_itemprice t4 on t1.itemid = t4.itemid and t1.siteid = t4.siteid and t4.pricegrade = 1
-         left join sa_promotion_itemprice t5 on t1.itemid = t5.itemid and t1.siteid = t5.siteid and t5.pricegrade = 2
-         left join sa_promotion_itemprice t6 on t1.itemid = t6.itemid and t1.siteid = t6.siteid and t6.pricegrade = 3
-         left join sa_promotion_itemprice t7 on t1.itemid = t7.itemid and t1.siteid = t7.siteid and t7.pricegrade = 4
-         left join sa_promotion_itemprice t8 on t1.itemid = t8.itemid and t1.siteid = t8.siteid and t8.pricegrade = 5
+         left join sa_promotion_itemprice t4
+                   on t1.sa_promotionid = t4.sa_promotionid and t1.itemid = t4.itemid and t1.siteid = t4.siteid and
+                      t4.pricegrade = 1
+         left join sa_promotion_itemprice t5
+                   on t1.sa_promotionid = t5.sa_promotionid and t1.itemid = t5.itemid and t1.siteid = t5.siteid and
+                      t5.pricegrade = 2
+         left join sa_promotion_itemprice t6
+                   on t1.sa_promotionid = t6.sa_promotionid and t1.itemid = t6.itemid and t1.siteid = t6.siteid and
+                      t6.pricegrade = 3
+         left join sa_promotion_itemprice t7
+                   on t1.sa_promotionid = t7.sa_promotionid and t1.itemid = t7.itemid and t1.siteid = t7.siteid and
+                      t7.pricegrade = 4
+         left join sa_promotion_itemprice t8
+                   on t1.sa_promotionid = t8.sa_promotionid and t1.itemid = t8.itemid and t1.siteid = t8.siteid and
+                      t8.pricegrade = 5
 where t1.siteid = $siteid$
   and t1.sa_promotionid = $sa_promotionid$
   and t1.sa_promotion_itemgroupid = $sa_promotion_itemgroupid$