|
|
@@ -174,6 +174,8 @@ public class itemgroup extends Controller {
|
|
|
RowsMap coverRowsMap = getAttachmentUrl("plm_item", ids, "cover");
|
|
|
//附件
|
|
|
RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
+ // 附件
|
|
|
+ RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", rows.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
|
|
|
Rows rowsitemclass = dbConnect.runSqlQuery(
|
|
|
" select t7.itemclassname,t6.itemid,t8.brandname from sa_itemsaleclass t6 inner JOIN plm_itemclass t7 ON t7.itemclassid = t6.itemclassid AND t7.siteid = t6.siteid LEFT JOIN sa_brand t8 ON t8.sa_brandid = t7.sa_brandid AND t8.siteid = t7.siteid where t6.siteid='"
|
|
|
@@ -192,6 +194,7 @@ public class itemgroup extends Controller {
|
|
|
row.put("cover", coverRows.get(0).getString("url"));
|
|
|
}
|
|
|
|
|
|
+ row.put("itemgroupinfos", itemgroupRowsMap.getOrDefault(row.getString("sa_itemgroupid"), new Rows()));
|
|
|
row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
row.put("itemclass", itemclassRowsMap.get(row.getString("itemid")));
|
|
|
}
|
|
|
@@ -210,11 +213,37 @@ public class itemgroup extends Controller {
|
|
|
Rows rowsitemclass = dbConnect.runSqlQuery(
|
|
|
" select t7.itemclassname,t6.itemid,t8.brandname from sa_itemsaleclass t6 inner JOIN plm_itemclass t7 ON t7.itemclassid = t6.itemclassid AND t7.siteid = t6.siteid LEFT JOIN sa_brand t8 ON t8.sa_brandid = t7.sa_brandid AND t8.siteid = t7.siteid where t6.siteid='"
|
|
|
+ siteid + "'");
|
|
|
+
|
|
|
+ ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
|
|
|
+
|
|
|
+ //默认商品图片
|
|
|
+ Rows defaultImageRows = getAttachmentUrl("system", (long) 1, "defaultImage");
|
|
|
+ //封面cover
|
|
|
+ RowsMap coverRowsMap = getAttachmentUrl("plm_item", ids, "cover");
|
|
|
+ //附件
|
|
|
+ RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
|
|
|
+ // 附件
|
|
|
+ RowsMap itemgroupRowsMap = getAttachmentUrl("sa_itemgroup", rows.toArrayList("sa_itemgroupid", new ArrayList<Long>()));
|
|
|
+
|
|
|
RowsMap itemclassRowsMap = rowsitemclass.toRowsMap("itemid");
|
|
|
- if (!rows.isEmpty()) {
|
|
|
- ArrayList<String> list = DataTag.queryTag(this, "sa_itemgroup", rows.get(0).getLong("sa_itemgroupid"), false);
|
|
|
- rows.get(0).put("tag1", JSONArray.parseArray(JSON.toJSONString(list)));
|
|
|
- rows.get(0).put("itemclass", itemclassRowsMap.get(rows.get(0).getString("itemid")));
|
|
|
+ for (Row row :rows) {
|
|
|
+ ArrayList<String> list = DataTag.queryTag(this, "sa_itemgroup",row.getLong("sa_itemgroupid"), false);
|
|
|
+ row.put("tag1", JSONArray.parseArray(JSON.toJSONString(list)));
|
|
|
+ row.put("itemclass", itemclassRowsMap.get(row.getString("itemid")));
|
|
|
+
|
|
|
+ Rows coverRows = coverRowsMap.get(row.getString("itemid"));
|
|
|
+ if (coverRows.isEmpty()) {
|
|
|
+ if (!defaultImageRows.isEmpty()) {
|
|
|
+ row.put("cover", defaultImageRows.get(0).getString("url"));
|
|
|
+ } else {
|
|
|
+ row.put("cover", "");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ row.put("cover", coverRows.get(0).getString("url"));
|
|
|
+ }
|
|
|
+
|
|
|
+ row.put("itemgroupinfos", itemgroupRowsMap.getOrDefault(row.getString("sa_itemgroupid"), new Rows()));
|
|
|
+ row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
|
|
|
}
|
|
|
return getSucReturnObject().setData(rows.size() > 0 ? rows.get(0) : new Row()).toString();
|
|
|
}
|
|
|
@@ -225,7 +254,7 @@ public class itemgroup extends Controller {
|
|
|
* @return
|
|
|
*/
|
|
|
@API(title = "商品组上架", apiversion = R.ID20220923143603.v1.class)
|
|
|
- @CACHEING_CLEAN(cms = {@cm(clazz = itemgroup.class, method = {"queryItemgroup", "queryItemgroupMain"})})
|
|
|
+ @CACHEING_CLEAN(apiClass = {itemgroup.class, restcontroller.sale.itemgroup.itemgroup.class})
|
|
|
public String release() throws YosException {
|
|
|
JSONArray sa_itemgroupids = content.getJSONArray("sa_itemgroupids");
|
|
|
String[] s = {"sa_itemgroupids"};
|
|
|
@@ -271,6 +300,52 @@ public class itemgroup extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 商品组设置置顶
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @API(title = "商品组设置置顶", apiversion = R.ID20230918155003.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {itemgroup.class, restcontroller.sale.itemgroup.itemgroup.class})
|
|
|
+ public String isTopping() throws YosException {
|
|
|
+ JSONArray sa_itemgroupids = content.getJSONArray("sa_itemgroupids");
|
|
|
+ boolean isTopping =content.getBooleanValue("isTopping");
|
|
|
+ List<Long> list = sa_itemgroupids.toJavaList(Long.class);
|
|
|
+ Long[] stringArray = list.toArray(new Long[0]);
|
|
|
+ SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组取消置顶");
|
|
|
+ if(isTopping){
|
|
|
+ sqlFactoryupdate = new SQLFactory(this, "商品组置顶");
|
|
|
+ }
|
|
|
+ sqlFactoryupdate.addParameter("siteid", siteid);
|
|
|
+ sqlFactoryupdate.addParameter_in("sa_itemgroupids", stringArray);
|
|
|
+ dbConnect.runSqlUpdate(sqlFactoryupdate);
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 商品组设置优先展示
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @API(title = "商品组设置优先展示", apiversion = R.ID20230918155103.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {itemgroup.class, restcontroller.sale.itemgroup.itemgroup.class})
|
|
|
+ public String isPriorityshow() throws YosException {
|
|
|
+ JSONArray sa_itemgroupids = content.getJSONArray("sa_itemgroupids");
|
|
|
+ List<Long> list = sa_itemgroupids.toJavaList(Long.class);
|
|
|
+ boolean isPriorityshow =content.getBooleanValue("isPriorityshow");
|
|
|
+ Long[] stringArray = list.toArray(new Long[0]);
|
|
|
+ SQLFactory sqlFactoryupdate = new SQLFactory(this, "商品组取消优先展示");
|
|
|
+ if(isPriorityshow){
|
|
|
+ sqlFactoryupdate = new SQLFactory(this, "商品组优先展示");
|
|
|
+ }
|
|
|
+ sqlFactoryupdate.addParameter("siteid", siteid);
|
|
|
+ sqlFactoryupdate.addParameter_in("sa_itemgroupids", stringArray);
|
|
|
+ dbConnect.runSqlUpdate(sqlFactoryupdate);
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 商品组下架
|
|
|
@@ -278,7 +353,7 @@ public class itemgroup extends Controller {
|
|
|
* @return
|
|
|
*/
|
|
|
@API(title = "下架", apiversion = R.ID20220923143703.v1.class)
|
|
|
- @CACHEING_CLEAN(cms = {@cm(clazz = itemgroup.class, method = {"queryItemgroup", "queryItemgroupMain"})})
|
|
|
+ @CACHEING_CLEAN(apiClass = {itemgroup.class, restcontroller.sale.itemgroup.itemgroup.class})
|
|
|
public String undercarriage() throws YosException {
|
|
|
JSONArray sa_itemgroupids = content.getJSONArray("sa_itemgroupids");
|
|
|
String[] s = {"sa_itemgroupids"};
|