|
|
@@ -273,6 +273,98 @@ public class itemclass extends Controller {
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询单据可添加营销类别
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @API(title = "查询单据可添加营销类别", apiversion = R.ID20230818135003.v1.class)
|
|
|
+ @CACHEING
|
|
|
+ public String queryItemclassAccordingtoId() throws YosException {
|
|
|
+ long sa_brandid = content.getLongValue("sa_brandid");
|
|
|
+ // long istool = content.getLongValue("istool");
|
|
|
+
|
|
|
+
|
|
|
+ String where = " 1=1 ";
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+
|
|
|
+ if (whereObject.containsKey("istool") && !"".equals(whereObject.getString("istool"))) {
|
|
|
+ where = where + " and (ifnull(t1.istool,0) ='" + whereObject.getString("istool") + "') ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (content.containsKey("sys_enterpriseid")) {
|
|
|
+ if(content.getLong("sys_enterpriseid")>0){
|
|
|
+ where = where + " and t1.itemclassid not in (SELECT itemclassid from sys_enterprise_saleclass WHERE sys_enterpriseid = " +
|
|
|
+ content.getLong("sys_enterpriseid") + " and siteid='" + siteid + "' )";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (content.containsKey("sa_rebateschemeid")) {
|
|
|
+ if(content.getLong("sa_rebateschemeid")>0){
|
|
|
+ where = where + " and not exists (SELECT 1 from sa_rebatecategory WHERE sa_rebateschemeid = " +
|
|
|
+ content.getLong("sa_rebateschemeid") + " and itemclassid=t1.itemclassid and siteid='" + siteid + "' )";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * SQL通告板块查询参数设置并查询
|
|
|
+ */
|
|
|
+ Rows rows = Enterprise.getBrands(this, sys_enterpriseid);
|
|
|
+
|
|
|
+ if (!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ /*
|
|
|
+ * 查询所有分类
|
|
|
+ */
|
|
|
+
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "查询所有分类");
|
|
|
+ sqlFactory.addParameter("siteid", siteid);
|
|
|
+ sqlFactory.addParameter("sa_brandid", row.getString("sa_brandid"));
|
|
|
+
|
|
|
+ sqlFactory.addParameter_SQL("where", where);
|
|
|
+ String sql = sqlFactory.getSQL();
|
|
|
+ Rows allrows = dbConnect.runSqlQuery(sql);
|
|
|
+ /*
|
|
|
+ * 获取所有一级分类
|
|
|
+ */
|
|
|
+ Rows toprows = allrows.toRowsMap("parentid").get("0");
|
|
|
+ /*
|
|
|
+ * 递归查询
|
|
|
+ */
|
|
|
+ for (Row row1 : toprows) {
|
|
|
+ Rows rows1 = getSubItemclass(row1, allrows);
|
|
|
+ Collections.sort(rows1, new SortByNum());
|
|
|
+ row1.put("subdep", rows1);
|
|
|
+ }
|
|
|
+ row.put("ttemclass", toprows);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (sa_brandid > 0) {
|
|
|
+ Rows rows2 = new Rows();
|
|
|
+ if(!rows.isEmpty()) {
|
|
|
+ for (Row row : rows) {
|
|
|
+ if (row.getLong("sa_brandid") == sa_brandid) {
|
|
|
+ rows2.add(row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (rows2.isNotEmpty()) {
|
|
|
+ if (((Rows) rows2.get(0).get("ttemclass")).isNotEmpty()) {
|
|
|
+ Collections.sort((Rows) rows2.get(0).get("ttemclass"), new SortByNum());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows2).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询末级营销类别
|
|
|
*
|