|
|
@@ -78,14 +78,29 @@ public class itemgroup extends Controller {
|
|
|
|
|
|
|
|
|
ArrayList<Long> itemclassList = new ArrayList<Long>();//授权的商品类别,包含下级商品类别,如果不需要授权则为空
|
|
|
+ ArrayList<Long> itemList = new ArrayList<Long>();//授权的商品
|
|
|
if (saleclassauth) {
|
|
|
Rows itemclassRows = dbConnect.runSqlQuery("SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "'");
|
|
|
ArrayList<Long> auth_itemclassList = itemclassRows.toArrayList("itemclassid", new ArrayList<>());
|
|
|
|
|
|
itemclassList.addAll(auth_itemclassList);
|
|
|
itemclassList.addAll(ItemClass.getSubItemClassIds(this, auth_itemclassList));
|
|
|
+
|
|
|
+
|
|
|
+ Rows itemRows = dbConnect.runSqlQuery("SELECT itemid from sys_enterprise_saleclass WHERE sys_enterpriseid = " + sys_enterpriseid + " and siteid='" + siteid + "'");
|
|
|
+ ArrayList<Long> auth_itemList = itemRows.toArrayList("itemid", new ArrayList<>());
|
|
|
+
|
|
|
+ itemList.addAll(auth_itemList);
|
|
|
+
|
|
|
+
|
|
|
+ }else{
|
|
|
+ Rows itemclassRows = dbConnect.runSqlQuery("select itemclassid from plm_itemclass where siteid='" + siteid + "'");
|
|
|
+ ArrayList<Long> auth_itemclassList = itemclassRows.toArrayList("itemclassid", new ArrayList<>());
|
|
|
+ itemclassList.addAll(auth_itemclassList);
|
|
|
+ itemclassList.addAll(ItemClass.getSubItemClassIds(this, auth_itemclassList));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
String where = " 1=1 ";
|
|
|
if (content.containsKey("where")) {
|
|
|
JSONObject whereObject = content.getJSONObject("where");
|
|
|
@@ -127,6 +142,14 @@ public class itemgroup extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ itemclassList.add(0l);
|
|
|
+ itemList.add(0l);
|
|
|
+ String sql ="select sa_itemgroupid from sa_itemgroup t1 inner join on 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("]", ")");
|
|
|
+ Rows rowsgroupids= dbConnect.runSqlQuery(sql);
|
|
|
+
|
|
|
//品牌过滤
|
|
|
JSONArray brandids = content.getJSONArray("brandids");
|
|
|
if (brandids.isEmpty()) {
|
|
|
@@ -151,14 +174,14 @@ 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.addParameter("itemclassid", itemclassList);
|
|
|
+// 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"));
|
|
|
itemGroupQuery.setPage(pageSize, pageNumber);
|
|
|
Rows itemGroupRows = itemGroupQuery.query();
|
|
|
|