Ver Fonte

促销方案选择商品根据管理端促销订单是否允许重复商品添加

hu há 2 anos atrás
pai
commit
42e1d475d5

+ 1 - 1
src/custom/restcontroller/webmanage/sale/promotion/SQL/商品查询.sql

@@ -11,7 +11,7 @@ SELECT
 FROM
 	plm_item t1
 	 LEFT JOIN plm_unit t2 ON t2.unitid = t1.unitid AND t2.siteid = t1.siteid
-	where $where$ and t1.siteid=$siteid$ and t1.status='审核' and t1.itemid not in (select itemid from sa_promotion_items where sa_promotionid=$sa_promotionid$)
+	where $where$ and t1.siteid=$siteid$ and t1.status='审核'
 	  and t1.itemid in (SELECT itemid
                     from plm_item_tradefield
                     WHERE ($where1$)

+ 5 - 1
src/custom/restcontroller/webmanage/sale/promotion/promotionItems.java

@@ -36,6 +36,10 @@ public class promotionItems extends Controller {
          */
         String where = " 1=1 ";
         String where1 = " 1=1 ";
+        Long sa_promotionid = content.getLong("sa_promotionid");
+        if (!beans.order.Order.getDefaultIsRepeatValue(siteid, "促销订单")) {
+            where=where+" and t1.itemid not in (select itemid from sa_promotion_items where sa_promotionid="+sa_promotionid+") ";
+        }
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
@@ -62,7 +66,7 @@ public class promotionItems extends Controller {
             sql = sql.replace("[", "(").replace("]", ")");
             where = where + sql;
         }
-        Long sa_promotionid = content.getLong("sa_promotionid");
+
         Rows tradefieldrows = dbConnect.runSqlQuery("select tradefield from sa_promotion where siteid='" + siteid + "' and sa_promotionid=" + sa_promotionid);
         JSONArray tradefield = new JSONArray();
         if (!tradefieldrows.isEmpty()) {