Просмотр исходного кода

新增货品档案筛选栏位选择接口

沈静伟 3 лет назад
Родитель
Сommit
a9d29c7dbf

+ 17 - 5
src/rest/openapi/base/Controller.java

@@ -63,12 +63,12 @@ public class Controller extends BaseClass {
             fagentnum = this.content.getString("fagentnum");
         }
         if (this.content.containsKey("hrid")) {
-            if(content.containsKey("siteid")){
-                System.err.println("siteid:"+content.getString("siteid"));
+            if (content.containsKey("siteid")) {
+                System.err.println("siteid:" + content.getString("siteid"));
             }
 
             hrid = this.content.getString("hrid").toUpperCase();
-            siteid = content.containsKey("siteid")&&!StringUtils.isBlank(content.getString("siteid"))?content.getString("siteid"):getSiteid();
+            siteid = content.containsKey("siteid") && !StringUtils.isBlank(content.getString("siteid")) ? content.getString("siteid") : getSiteid();
             usertype = getUserType();
         }
         if (this.content.containsKey("$classname")) {
@@ -78,10 +78,12 @@ public class Controller extends BaseClass {
             $method = this.content.getString("$method");
         }
     }
+
     public PaoSetRemote getpaoset(String tablename) throws P2Exception {
         PaoSetRemote paoSet = P2Server.getP2Server().getPaoSet(tablename, P2Server.getP2Server().getSystemUserInfo());
         return paoSet;
     }
+
     /**
      * 生成分页的返回数据
      *
@@ -143,6 +145,16 @@ public class Controller extends BaseClass {
         return returnObject;
     }
 
+    public JSONObject getReturnObject_suc(JSONObject data, boolean issavetodatapool) {
+        returnObject.put("msg", "成功");
+        returnObject.put("code", 1);
+        returnObject.put("data", data);
+        if (issavetodatapool) {
+            DataPool.put(content.toString(), returnObject);
+        }
+        return returnObject;
+    }
+
     public JSONObject getReturnObject_suc(Row data, boolean issavetodatapool) {
         returnObject.put("msg", "成功");
         returnObject.put("code", 1);
@@ -218,7 +230,7 @@ public class Controller extends BaseClass {
                                  * 执行请求方法
                                  */
                                 if (parameter.isdebug) {
-                                    printInfoOut("缓存测试", "正在预加载数据:" + content,false);
+                                    printInfoOut("缓存测试", "正在预加载数据:" + content, false);
                                 }
                                 Class clz = Class.forName("openapi.restcontroller." + $classname);
                                 Constructor cla = clz.getDeclaredConstructor(JSONObject.class);
@@ -230,7 +242,7 @@ public class Controller extends BaseClass {
                             }
                         } else {
                             if (parameter.isdebug) {
-                                printInfoOut("缓存测试", "预加载数据已在缓存中:" + content,false);
+                                printInfoOut("缓存测试", "预加载数据已在缓存中:" + content, false);
                             }
                         }
                     }

+ 9 - 3
src/rest/openapi/restcontroller/wechatapp/titem/Titem.java

@@ -3,6 +3,7 @@
  */
 package openapi.restcontroller.wechatapp.titem;
 
+import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import openapi.base.Controller;
 import openapi.base.SQLFactory;
@@ -1334,9 +1335,14 @@ public class Titem extends Controller {
     }
 
     public String query_itemvalueclass() {
-        String type = content.getString("type");
+        String[] fieldlist = new String[]{"fvalue1", "fvalue2", "fvalue3", "fvalue4", "fvalue5", "fvalue6", "fvalue7"};
+
+        JSONObject object = new JSONObject();
         DBConnect dbConnect = new DBConnect();
-        Rows rows = dbConnect.runSqlQuery("select value from ps_databind_list where databindid='ITEM_" + type + "' and siteid='" + siteid + "'");
-        return getReturnObject_suc(rows, true).toString();
+        for (String field : fieldlist) {
+            Rows rows = dbConnect.runSqlQuery("select value from ps_databind_list where databindid='ITEM_" + field + "' and siteid='" + siteid + "'");
+            object.put(field, rows.toJsonArray("value"));
+        }
+        return getReturnObject_suc(object, true).toString();
     }
 }