hu 3 лет назад
Родитель
Сommit
98695724bb

+ 1 - 1
src/custom/restcontroller/webmanage/sale/enterprisetradefield/EnterpriseTradeField.java

@@ -29,7 +29,7 @@ public class EnterpriseTradeField extends Controller {
     }
 
     @API(title = "新增", apiversion = R.ID20221223141602.v1.class)
-    @CACHEING_CLEAN(apiClass = {EnterpriseTradeField.class}, apiversions = {R.ID20221012164402.class, R.ID20220930103501.class})
+    @CACHEING_CLEAN(apiClass = {EnterpriseTradeField.class}, apiversions = {R.ID20221012164402.class, R.ID20220930103501.class, R.ID20221223141802.v1.class})
     public String insert() throws YosException {
         Long sys_enterprise_tradefieldid = content.getLongValue("sys_enterprise_tradefieldid");
         Long sys_enterpriseid = content.getLong("sys_enterpriseid");

+ 34 - 22
src/custom/restcontroller/webmanage/sale/itemclass/SQL/查询所有分类.sql

@@ -1,22 +1,34 @@
-select t2.itemclassname          upitemclassname,
-       t1.itemclassid,
-       t1.itemclassnum,
-       t1.itemclassname,
-       t1.itemclassfullname,
-       t1.itemclassfullnum,
-       ifnull(t1.parentid, 0) as parentid,
-       t1.num,
-       t1.ishide,
-       t1.istool,
-       t1.isdeep,
-       t1.createby,
-       t1.createdate,
-       t1.changeby,
-       t1.changedate
-from plm_itemclass t1
-         left join plm_itemclass t2 on t1.parentid = t2.itemclassid and t1.siteid = t2.siteid
-where t1.classtype = '营销'
-  and t1.sa_brandid = $sa_brandid$
-  and t1.siteid = $siteid$
-  and $where2$
-order by t1.parentid, ifnull(ISNULL(t1.num) = 0 and LENGTH(trim(t1.num)) = 0, 99) asc
+with recursive saleclass as (select t1.itemclassid,
+                                    t1.itemclassnum,
+                                    t1.itemclassname,
+                                    t1.itemclassfullname,
+                                    t1.itemclassfullnum,
+                                    ifnull(t1.parentid, 0) as parentid,
+                                    t1.num,
+                                    t1.ishide,
+                                    t1.istool,
+                                    t1.isdeep
+                             from plm_itemclass t1
+                             where t1.siteid = $siteid$
+                               and t1.classtype='营销'
+                               and $where$
+                               and t1.sa_brandid = $sa_brandid$
+                             union
+                             select t2.itemclassid,
+                                    t2.itemclassnum,
+                                    t2.itemclassname,
+                                    t2.itemclassfullname,
+                                    t2.itemclassfullnum,
+                                    ifnull(t2.parentid, 0) as parentid,
+                                    t2.num,
+                                    t2.ishide,
+                                    t2.istool,
+                                    t2.isdeep
+                             from plm_itemclass t2,
+                                  saleclass t3
+                             where t2.siteid = $siteid$
+                               and t2.classtype='营销'
+                               and t2.sa_brandid = $sa_brandid$
+                               and t2.itemclassid = t3.parentid)
+select *
+from saleclass

+ 16 - 14
src/custom/restcontroller/webmanage/sale/itemclass/itemclass.java

@@ -186,28 +186,28 @@ public class itemclass extends Controller {
 		/*
 		 * 过滤条件设置
 		 */
-		String where = " 1=1 ";
-		if (content.containsKey("where")) {
-			JSONObject whereObject = content.getJSONObject("where");
-
-			if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
-				where = where + " and (brandname like'%" + whereObject.getString("condition") + "%') ";
-			}
-		}
+//		String where = " 1=1 ";
+//		if (content.containsKey("where")) {
+//			JSONObject whereObject = content.getJSONObject("where");
+//
+//			if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+//				where = where + " and (brandname like'%" + whereObject.getString("condition") + "%') ";
+//			}
+//		}
 
-		String where2 = " 1=1 ";
+		String where = " 1=1 ";
 		if (content.containsKey("where")) {
 			JSONObject whereObject = content.getJSONObject("where");
 
 			if (whereObject.containsKey("istool") && !"".equals(whereObject.getString("istool"))) {
-				where2 = where2 + " and (t1.istool ='" + whereObject.getString("istool") + "') ";
+				where = where + " and (t1.istool ='" + whereObject.getString("istool") + "') ";
 			}
 		}
 		/*
 		 * SQL通告板块查询参数设置并查询
 		 */
 		Rows rows = Enterprise.getBrands(this, sys_enterpriseid);
-		
+
 		if (!rows.isEmpty()) {
 			for (Row row : rows) {
 				/*
@@ -219,7 +219,7 @@ public class itemclass extends Controller {
 					if (!enterpriseRow.isEmpty()) {
 						boolean saleclassauth = enterpriseRow.getBoolean("saleclassauth");
 						if (saleclassauth) {
-							where2 = where2
+							where = where
 									+ " and t1.itemclassid in ( SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = "
 									+ sys_enterpriseid + " and siteid='" + siteid + "')";
 						}
@@ -227,10 +227,12 @@ public class itemclass extends Controller {
 
 				}
 
+
 				SQLFactory sqlFactory = new SQLFactory(this, "查询所有分类");
 				sqlFactory.addParameter("siteid", siteid);
 				sqlFactory.addParameter("sa_brandid", row.getString("sa_brandid"));
-				sqlFactory.addParameter_SQL("where2", where2);
+
+				sqlFactory.addParameter_SQL("where", where);
 				String sql = sqlFactory.getSQL();
 				Rows allrows = dbConnect.runSqlQuery(sql);
 				/*
@@ -258,7 +260,7 @@ public class itemclass extends Controller {
 					}
 				}
 			}
-			
+
 			if (rows2.isNotEmpty()) {
 				if (((Rows) rows2.get(0).get("ttemclass")).isNotEmpty()) {
 					Collections.sort((Rows) rows2.get(0).get("ttemclass"), new SortByNum());