Forráskód Böngészése

Merge remote-tracking branch 'origin/develop' into develop

沈静伟 1 éve
szülő
commit
5e1f5f445d

+ 27 - 32
src/custom/restcontroller/sale/promotion/SQL/促销方案列表查询.sql

@@ -46,46 +46,41 @@ from (SELECT t1.promnum,
                                         AND DATE_FORMAT(now(), '%Y-%m-%d') >= DATE_FORMAT(t1.begdate, '%Y-%m-%d')
                                         AND DATE_FORMAT(now(), '%Y-%m-%d') <= DATE_FORMAT(t1.enddate, '%Y-%m-%d'))
         AND if(t1.authmethod=0,(
+        NOT EXISTS(SELECT *
+                            FROM sa_promotion_auth
+                            WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid)
+              or
               exists(select 1
                      from sa_promotion_auth t2
                      where t1.siteid = t2.siteid
                        and t1.sa_promotionid = t2.sa_promotionid
                        and t2.sys_enterpriseid = $sys_enterpriseid$
-                       and if(t2.islimit=1,t2.saledamount<t2.limitamount,1=1))
-              OR NOT EXISTS(SELECT *
-                            FROM sa_promotion_auth
-                            WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid))
-        AND (exists(select 1 from sys_enterprise_tradefield where sys_enterpriseid=$sys_enterpriseid$ and sa_saleareaid in(
-with recursive salearea as (
-    select sa_saleareaid
-    from sa_salearea
-    where siteid = $siteid$
-      and sa_saleareaid in(select sa_saleareaid from sa_promotion_salearea where sa_promotionid=t1.sa_promotionid)
-    union all
-    select t2.sa_saleareaid
-    from salearea t1
-             inner join sa_salearea t2 on t1.sa_saleareaid = t2.parentid and t2.siteid =$siteid$
-)
-select sa_saleareaid
-from salearea))
-OR NOT EXISTS ( SELECT * FROM sa_promotion_salearea WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid ) ),
- (exists(select 1 from sys_enterprise_tradefield where sys_enterpriseid=$sys_enterpriseid$ and sa_saleareaid in(
-with recursive salearea as (
-    select sa_saleareaid
-    from sa_salearea
-    where siteid = $siteid$
-      and sa_saleareaid in(select sa_saleareaid from sa_promotion_salearea where sa_promotionid=t1.sa_promotionid)
-    union all
-    select t2.sa_saleareaid
-    from salearea t1
-             inner join sa_salearea t2 on t1.sa_saleareaid = t2.parentid and t2.siteid =$siteid$
-)
-select sa_saleareaid
-from salearea)) OR NOT EXISTS ( SELECT * FROM sa_promotion_salearea WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid ))
-        AND not exists(select 1
+                       and if(t2.islimit=1,t2.saledamount<t2.limitamount,1=1)) ),
+              not exists(select 1
                        from sa_promotion_auth t2
                        where t1.siteid = t2.siteid
                          and t1.sa_promotionid = t2.sa_promotionid
                          and t2.sys_enterpriseid = $sys_enterpriseid$))
+      AND if(NOT EXISTS ( SELECT * FROM sa_promotion_salearea WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid),
+				NOT EXISTS ( SELECT * FROM sa_promotion_salearea WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid ),
+				t1.sa_promotionid in(select sa_promotionid from sa_promotion_salearea where sa_saleareaid in(WITH recursive salearea AS (
+						SELECT
+							sa_saleareaid,parentid
+						FROM
+							sa_salearea
+						WHERE
+							siteid = $siteid$
+							AND sa_saleareaid IN ( SELECT sa_saleareaid FROM sys_enterprise_tradefield WHERE sys_enterpriseid = $sys_enterpriseid$ ) UNION ALL
+						SELECT
+							t2.sa_saleareaid,t2.parentid
+						FROM
+							salearea t1
+							INNER JOIN sa_salearea t2 ON t1.parentid = t2.sa_saleareaid
+							AND t2.siteid = $siteid$
+						) SELECT
+						sa_saleareaid
+					FROM
+						salearea))
+			)
  ) t
 where $where$

+ 2 - 2
src/custom/restcontroller/webmanage/lsak3/item/item.java

@@ -161,8 +161,8 @@ public class item extends Controller {
                         sqlFactory.addParameter("status",customitemRows.get(0).getString("status"));
                         sqlFactory.addParameter("isonsale",customitemRows.get(0).getString("isonsale"));
                     }else {
-                        sqlFactory.addParameter("status","审核");
-                        sqlFactory.addParameter("isonsale",0);
+                        sqlFactory.addParameter("status",customitemRows.get(0).getString("status"));
+                        sqlFactory.addParameter("isonsale",customitemRows.get(0).getString("isonsale"));
                         Rows rowscount = dbConnect.runSqlQuery("select count(1) count from sa_itemgroupmx where sa_itemgroupid in(select t1.sa_itemgroupid from sa_itemgroupmx t1 inner join sa_itemgroup t2 on t1.sa_itemgroupid=t2.sa_itemgroupid and t1.siteid=t2.siteid  where itemid="+itemid+")");
                         if(rowscount.isNotEmpty()){
                             if(rowscount.get(0).getInteger("count")>1){

+ 1 - 1
src/custom/restcontroller/webmanage/sale/order/Order.java

@@ -1378,7 +1378,7 @@ public class Order extends Controller {
         if (type.equals("标准订单")) {
             Rows iteminfos = dbConnect.runSqlQuery("select t2.itemno from sa_orderitems t1 inner join plm_item t2 on t1.siteid=t2.siteid and t1.itemid=t2.itemid where t1.sa_orderid=" + sa_orderid + " and t1.siteid='" + siteid + "' and t2.isonsale!=1");
             if (iteminfos.isNotEmpty()) {
-                return getErrReturnObject().setErrMsg("检测到品号" + iteminfos.get(0).getLong("itemno") + "未上架,请删除后重试").toString();
+                return getErrReturnObject().setErrMsg("检测到品号" + iteminfos.get(0).getString("itemno") + "未上架,请删除后重试").toString();
             }
         }   //辅助类
         OrderItemsHelper orderItemsHelper = new OrderItemsHelper(this);