|
@@ -97,7 +97,6 @@ public class itemgroup 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 (t1.groupname like'%" + whereObject.getString("condition")
|
|
|
+ "%' or t1.groupnum like'%" + whereObject.getString("condition")
|
|
@@ -112,10 +111,9 @@ public class itemgroup extends Controller {
|
|
|
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";
|
|
|
-
|
|
|
}
|
|
|
if (whereObject.containsKey("tradefield") && !"".equals(whereObject.getString("tradefield"))) {
|
|
|
- where = where + " and (t1.tradefield like'%" + whereObject.getString("tradefield") + "%') ";
|
|
|
+ where = where + " and (t1.tradefield ='" + whereObject.getString("tradefield") + "') ";
|
|
|
}
|
|
|
if (whereObject.containsKey("standards") && !"".equals(whereObject.getString("standards"))) {
|
|
|
where = where
|
|
@@ -132,21 +130,17 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
itemclassList.add(0l);
|
|
|
itemList.add(0l);
|
|
|
- String sql;
|
|
|
+ Rows rowsgroupids = null;
|
|
|
if (saleclassauth) {
|
|
|
- sql = "select t1.sa_itemgroupid from sa_itemgroup t1 inner join sa_itemgroupmx t2 on t1.sa_itemgroupid=t2.sa_itemgroupid and t1.siteid=t2.siteid" +
|
|
|
+ String sql = "select distinct t1.sa_itemgroupid from sa_itemgroup t1 inner join sa_itemgroupmx t2 on t1.sa_itemgroupid=t2.sa_itemgroupid and t1.siteid=t2.siteid" +
|
|
|
" LEFT JOIN sa_itemsaleclass t4 ON t2.itemid = t4.itemid AND t2.siteid = t4.siteid and t4.classtype='营销'" +
|
|
|
" where t1.siteid='" + siteid + "' and (t2.itemid in " + itemList + " or t4.itemclassid in " + itemclassList + ")";
|
|
|
sql = sql.replace("[", "(").replace("]", ")");
|
|
|
- } else {
|
|
|
- sql = "select t1.sa_itemgroupid from sa_itemgroup t1 inner join sa_itemgroupmx t2 on t1.sa_itemgroupid=t2.sa_itemgroupid and t1.siteid=t2.siteid" +
|
|
|
- " LEFT JOIN sa_itemsaleclass t4 ON t2.itemid = t4.itemid AND t2.siteid = t4.siteid and t4.classtype='营销'" +
|
|
|
- " where t1.siteid='" + siteid + "'";
|
|
|
+ rowsgroupids = dbConnect.runSqlQuery(sql);
|
|
|
}
|
|
|
- Rows rowsgroupids = dbConnect.runSqlQuery(sql);
|
|
|
+
|
|
|
|
|
|
//品牌过滤
|
|
|
JSONArray brandids = content.getJSONArray("brandids");
|
|
@@ -172,14 +166,9 @@ public class itemgroup extends Controller {
|
|
|
itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
|
|
|
itemGroupQuery.setWhere("t1.sa_brandid", brandids.toArray());
|
|
|
itemGroupQuery.setWhere(where);
|
|
|
-// if (saleclassauth) {
|
|
|
-// if (itemclassList.isEmpty()) {
|
|
|
-// itemGroupQuery.setWhere("1=2");
|
|
|
-// } else {
|
|
|
-// itemGroupQuery.setWhere("exists(select * from sa_itemgroupmx inner join sa_itemsaleclass on sa_itemgroupmx.itemid=sa_itemsaleclass.itemid where sa_itemgroupmx.sa_itemgroupid=t1.sa_itemgroupid and sa_itemsaleclass.itemclassid in $itemclassid$)");
|
|
|
-// }
|
|
|
-// }
|
|
|
- itemGroupQuery.setWhere("sa_itemgroupid", rowsgroupids.toArrayList("sa_itemgroupid"));
|
|
|
+ if (saleclassauth) {
|
|
|
+ itemGroupQuery.setWhere("sa_itemgroupid", rowsgroupids.toArrayList("sa_itemgroupid"));
|
|
|
+ }
|
|
|
itemGroupQuery.setPage(pageSize, pageNumber);
|
|
|
Rows itemGroupRows = itemGroupQuery.query();
|
|
|
|