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

促销活动优化

hu 2 éve
szülő
commit
83c8fbba68

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

@@ -52,7 +52,7 @@ from (SELECT t1.promnum,
                      where t1.siteid = t2.siteid
                      where t1.siteid = t2.siteid
                        and t1.sa_promotionid = t2.sa_promotionid
                        and t1.sa_promotionid = t2.sa_promotionid
                        and t2.sys_enterpriseid = $sys_enterpriseid$
                        and t2.sys_enterpriseid = $sys_enterpriseid$
-                       and t2.saledamount<t2.limitamount)
+                       and if(t2.islimit=1,t2.saledamount<t2.limitamount,1=1)))
               OR NOT EXISTS(SELECT *
               OR NOT EXISTS(SELECT *
                             FROM sa_promotion_auth
                             FROM sa_promotion_auth
                             WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid))
                             WHERE sa_promotionid = t1.sa_promotionid AND siteid = t1.siteid))
@@ -65,7 +65,7 @@ with recursive salearea as (
     union all
     union all
     select t2.sa_saleareaid
     select t2.sa_saleareaid
     from salearea t1
     from salearea t1
-             inner join sa_salearea t2 on t1.sa_saleareaid = t2.parentid and t2.siteid ='ccyosg'
+             inner join sa_salearea t2 on t1.sa_saleareaid = t2.parentid and t2.siteid =$siteid$
 )
 )
 select sa_saleareaid
 select sa_saleareaid
 from salearea))
 from salearea))
@@ -128,7 +128,7 @@ with recursive salearea as (
     union all
     union all
     select t2.sa_saleareaid
     select t2.sa_saleareaid
     from salearea t1
     from salearea t1
-             inner join sa_salearea t2 on t1.sa_saleareaid = t2.parentid and t2.siteid ='ccyosg'
+             inner join sa_salearea t2 on t1.sa_saleareaid = t2.parentid and t2.siteid =$siteid$
 )
 )
 select sa_saleareaid
 select sa_saleareaid
 from salearea))
 from salearea))