|
@@ -169,10 +169,10 @@ public class Fad extends Controller {
|
|
|
detailRow.put("attinfos_pic", attachmentRows);
|
|
|
detailRow.putIfAbsent("offsaledate", "");
|
|
|
detailRow.putIfAbsent("onsaledate", "");
|
|
|
- detailRow.put("classnames",getClassnames(detailRow.getJSONArray("sa_fadclassids")));
|
|
|
+ detailRow.put("classnames", getClassnames(detailRow.getJSONArray("sa_fadclassids"), false));
|
|
|
|
|
|
|
|
|
- detailRow.put("mainclassnames",getMainClassnames(detailRow.getJSONArray("sa_fadclassids")));
|
|
|
+ detailRow.put("mainclassnames", getClassnames(detailRow.getJSONArray("sa_fadclassids"), true));
|
|
|
|
|
|
|
|
|
return getSucReturnObject().setData(detailRow).toString();
|
|
@@ -310,10 +310,10 @@ public class Fad extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Long sa_fadid=content.getLongValue("sa_fadid");
|
|
|
+ Long sa_fadid = content.getLongValue("sa_fadid");
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item"
|
|
|
- ,"itemid","itemname","itemno","model","spec","color","marketprice","standards");
|
|
|
+ , "itemid", "itemname", "itemno", "model", "spec", "color", "marketprice", "standards");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "plm_itemclass", "t2", "t2.itemclassid = t1.marketingcategory AND t2.siteid = t1.siteid",
|
|
|
"itemclassname");
|
|
@@ -369,10 +369,10 @@ public class Fad extends Controller {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Long sa_fadid=content.getLongValue("sa_fadid");
|
|
|
+ Long sa_fadid = content.getLongValue("sa_fadid");
|
|
|
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item"
|
|
|
- ,"itemid","itemname","itemno","model","spec","color","marketprice","standards");
|
|
|
+ , "itemid", "itemname", "itemno", "model", "spec", "color", "marketprice", "standards");
|
|
|
querySQL.setTableAlias("t1");
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "plm_itemclass", "t2", "t2.itemclassid = t1.marketingcategory AND t2.siteid = t1.siteid",
|
|
|
"itemclassname");
|
|
@@ -444,26 +444,7 @@ public class Fad extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
- public String getClassnames( JSONArray sa_fadclassids) throws YosException {
|
|
|
- //[[1,2,3,6],[1,2]]
|
|
|
- RowsMap rowsMap = dbConnect.runSqlQuery("SELECT sa_fadclassid,classname from sa_fadclass WHERE siteid='" + siteid + "'").toRowsMap("sa_fadclassid");
|
|
|
- ArrayList<String> classnames = new ArrayList<>();
|
|
|
- for (Object object : sa_fadclassids) {
|
|
|
- ArrayList<String> temp = new ArrayList<>();
|
|
|
- if (object instanceof JSONArray) {
|
|
|
- JSONArray array = (JSONArray) object;
|
|
|
- for (Object obj : array) {
|
|
|
- temp.add(rowsMap.get(obj.toString()).get(0).getString("classname"));
|
|
|
- }
|
|
|
- }
|
|
|
- classnames.add(String.join("-", temp));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return String.join(";", classnames);
|
|
|
- }
|
|
|
-
|
|
|
- public String getMainClassnames( JSONArray sa_fadclassids) throws YosException {
|
|
|
+ public String getClassnames(JSONArray sa_fadclassids, boolean isMain) throws YosException {
|
|
|
//[[1,2,3,6],[1,2]]
|
|
|
RowsMap rowsMap = dbConnect.runSqlQuery("SELECT sa_fadclassid,classname from sa_fadclass WHERE siteid='" + siteid + "'").toRowsMap("sa_fadclassid");
|
|
|
LinkedHashSet<String> classnames = new LinkedHashSet<>();
|
|
@@ -475,11 +456,16 @@ public class Fad extends Controller {
|
|
|
temp.add(rowsMap.get(obj.toString()).get(0).getString("classname"));
|
|
|
}
|
|
|
}
|
|
|
- classnames.add(temp.get(0));
|
|
|
+ if (isMain) {
|
|
|
+ classnames.add(temp.get(0));
|
|
|
+ } else {
|
|
|
+ classnames.add(String.join("-", temp));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
return String.join(";", classnames);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|