|
|
@@ -87,6 +87,18 @@ 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) ";
|
|
|
}
|
|
|
+ StringBuilder itemclassids_where=new StringBuilder();
|
|
|
+ if (!content_where.getStringValue("itemclassid").isEmpty()) {
|
|
|
+ ArrayList<Long> itemclassid = ItemClass.getSubItemClassIds(this, content_where.getLong("itemclassid"));
|
|
|
+ itemclassid.add(content_where.getLong("itemclassid"));
|
|
|
+ for(long id:itemclassid){
|
|
|
+ if(!itemclassids_where.toString().isEmpty()){
|
|
|
+ itemclassids_where.append(",");
|
|
|
+ }
|
|
|
+ itemclassids_where.append(id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//品牌过滤
|
|
|
JSONArray brandids = content.getJSONArray("brandids");
|
|
|
@@ -97,7 +109,7 @@ public class itemgroup extends Controller {
|
|
|
brandids = dbConnect.runSqlQuery("select sa_brandid from sa_brand where siteid='" + siteid + "'").toJsonArray("sa_brandid");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ Rows tradefieldrows = dbConnect.runSqlQuery("SELECT tradefield from sys_enterprise_tradefield WHERE sys_enterpriseid =" + sys_enterpriseid + " and siteid ='" + siteid + "'");
|
|
|
/*
|
|
|
* SQL查询参数设置并查询
|
|
|
*/
|
|
|
@@ -111,16 +123,23 @@ public class itemgroup extends Controller {
|
|
|
//如果企业有营销授权,则查询授权商品组
|
|
|
itemGroupQuery.addJoinTable(JOINTYPE.inner, "sys_enterprise_itemgroupauth_view", "t7", "t7.sa_itemgroupid = t1.sa_itemgroupid and t7.sys_enterpriseid=" + sys_enterpriseid);
|
|
|
}
|
|
|
+ itemGroupQuery.setWhere("tradefield",tradefieldrows.toArrayList("tradefield"));
|
|
|
|
|
|
itemGroupQuery.setSiteid(siteid);
|
|
|
itemGroupQuery.setCondition("t1.groupname", "t1.groupnum", "t2.model");
|
|
|
itemGroupQuery.setWhere("t1.isonsale=1");
|
|
|
- itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
|
|
|
+ //itemGroupQuery.setWhere("t2.ismodule", content.getLongValue("ismodule"));
|
|
|
itemGroupQuery.setWhere("t1.sa_brandid", brandids.toArray());
|
|
|
itemGroupQuery.setWhere(where);
|
|
|
if (!content_where.getStringValue("condition").isEmpty()) {
|
|
|
itemGroupQuery.setOrderBy("t1.groupname like'%" + content_where.getString("condition") + "%' desc");
|
|
|
}
|
|
|
+ if(!itemclassids_where.toString().isEmpty()){
|
|
|
+ itemGroupQuery.setWhere("exists(" +
|
|
|
+ "select * from sa_itemgroupmx t10 " +
|
|
|
+ "inner join sa_itemsaleclass t11 on t10.itemid=t11.itemid " +
|
|
|
+ "where t10.sa_itemgroupid=t1.sa_itemgroupid and t11.itemclassid in("+itemclassids_where+"))");
|
|
|
+ }
|
|
|
itemGroupQuery.setPage(pageSize, pageNumber);
|
|
|
Rows itemGroupRows = itemGroupQuery.query();
|
|
|
|
|
|
@@ -131,6 +150,12 @@ public class itemgroup extends Controller {
|
|
|
itempriceQuery.addQueryFields("minprice", "min(t2.price)");
|
|
|
itempriceQuery.setWhere("t1.sa_itemgroupid", itemGroupRows.toArrayList("sa_itemgroupid"));
|
|
|
itempriceQuery.setWhere("t2.pricegrade", pricegrade);
|
|
|
+ if(!itemclassids_where.toString().isEmpty()){
|
|
|
+ itemGroupQuery.setWhere("exists(" +
|
|
|
+ "select * from sa_itemsaleclass t11 " +
|
|
|
+ "where t1.itemid=t11.itemid and t11.itemclassid in("+itemclassids_where+"))");
|
|
|
+ }
|
|
|
+
|
|
|
itempriceQuery.addGroupBy("t1.sa_itemgroupid");
|
|
|
RowsMap itemGroupPriceRowsMap = itempriceQuery.query().toRowsMap("sa_itemgroupid");
|
|
|
|