admin 4 hari lalu
induk
melakukan
061d4824dd
1 mengubah file dengan 6 tambahan dan 1 penghapusan
  1. 6 1
      src/custom/restcontroller/sale/itemgroup/itemgroup.java

+ 6 - 1
src/custom/restcontroller/sale/itemgroup/itemgroup.java

@@ -86,6 +86,11 @@ public class itemgroup extends Controller {
             where = where + " and exists(select 1 from sa_itemgroupmx s1 left join plm_item s2 on s1.itemid=s2.itemid and  s1.siteid=s2.siteid where s2.standards='"
                     + content_where.getString("standards") + "' and s1.sa_itemgroupid=t1.sa_itemgroupid) ";
         }
+        if (!content_where.getStringValue("condition").isEmpty()) {
+            String condition=content_where.getStringValue("condition");
+            where = where + " and (t1.groupname like'%"+condition+"%' or t1.groupnum like'%"+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'%"+ condition + "%' or s2.itemno like'%"+ condition + "%' or s2.model like'%"+condition+"%') and s1.sa_itemgroupid=t1.sa_itemgroupid)) ";
+        }
         StringBuilder itemclassids_where=new StringBuilder();
         if (!content_where.getStringValue("itemclassid").isEmpty()) {
             ArrayList<Long> itemclassid = ItemClass.getSubItemClassIds(this, content_where.getLong("itemclassid"));
@@ -127,7 +132,7 @@ public class itemgroup extends Controller {
             itemGroupQuery.setWhere("tradefield",tradefieldrows.toArrayList("tradefield"));
         }
         itemGroupQuery.setSiteid(siteid);
-        itemGroupQuery.setCondition("t1.groupname", "t1.groupnum", "t2.model","t2.itemname","t2.itemno");
+        //itemGroupQuery.setCondition("t1.groupname", "t1.groupnum", "t2.model","t2.itemname","t2.itemno");
         itemGroupQuery.setWhere("t1.isonsale=1");
         //itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
         itemGroupQuery.setWhere("t1.sa_brandid", brandids.toArray());