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

商品组查询优化

shenjingwei 1 hete
szülő
commit
3121bb82c3
1 módosított fájl, 2 hozzáadás és 13 törlés
  1. 2 13
      src/custom/restcontroller/sale/itemgroup/itemgroup.java

+ 2 - 13
src/custom/restcontroller/sale/itemgroup/itemgroup.java

@@ -98,19 +98,7 @@ public class itemgroup extends Controller {
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
-                where = where + " and (t1.groupname like'%" + whereObject.getString("condition")
-                        + "%' or t1.groupnum like'%" + whereObject.getString("condition")
-                        + "%' or exists(select 1 from sa_itemgroupmx s1 left join plm_item s2 on s1.itemid=s2.itemid and  s1.siteid=s2.siteid where (s2.itemname like '%"
-                        + whereObject.getString("condition") + "%' or s2.itemno like '%" + whereObject.getString("condition")
-                        + "%' or s2.standards like '%" + whereObject.getString("condition")
-                        + "%' or s2.spec like '%" + whereObject.getString("condition")
-                        + "%' or s2.byname like '%" + whereObject.getString("condition")
-                        + "%' or s2.model like '%" + whereObject.getString("condition")
-                        + "%') and s1.sa_itemgroupid=t1.sa_itemgroupid) ) ";
-
-                pageSorting = "t1.groupname like'%" + whereObject.getString("condition") + "%' desc,exists(select 1 from sa_itemgroupmx s1 " +
-                        " LEFT JOIN plm_item s2 ON s1.itemid = s2.itemid AND s1.siteid = s2.siteid  where s2.itemname like'%" + whereObject.getString("condition") + "%') desc,exists(select 1 from sa_itemgroupmx s1 " +
-                        " LEFT JOIN plm_item s2 ON s1.itemid = s2.itemid AND s1.siteid = s2.siteid  where s2.itemno like'%" + whereObject.getString("condition") + "%') desc,t1.groupnum like'%" + whereObject.getString("condition") + "%' desc";
+                pageSorting = "t1.groupname like'%" + whereObject.getString("condition") + "%' desc";
             }
             if (whereObject.containsKey("tradefield") && !"".equals(whereObject.getString("tradefield"))) {
                 where = where + " and (t1.tradefield ='" + whereObject.getString("tradefield") + "') ";
@@ -162,6 +150,7 @@ public class itemgroup extends Controller {
         itemGroupQuery.addJoinTable(JOINTYPE.left, "sa_brand", "t3", "t3.sa_brandid = t1.sa_brandid AND t3.siteid = t1.siteid", "brandname");
         itemGroupQuery.addJoinTable(JOINTYPE.left, "plm_unit", "t6", "t6.unitid = t2.unitid AND t6.siteid = t2.siteid", "unitname");
         itemGroupQuery.setSiteid(siteid);
+        itemGroupQuery.setCondition("t2.groupname", "t1.groupnum", "t2.model");
         itemGroupQuery.setWhere("t1.isonsale=1");
         itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
         itemGroupQuery.setWhere("t1.sa_brandid", brandids.toArray());