|
|
@@ -1,5 +1,6 @@
|
|
|
package restcontroller.webmanage.adspace;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
@@ -7,10 +8,8 @@ import common.annotation.API;
|
|
|
import common.annotation.CACHEING;
|
|
|
import common.annotation.CACHEING_CLEAN;
|
|
|
import common.annotation.cm;
|
|
|
-import common.data.Row;
|
|
|
-import common.data.Rows;
|
|
|
-import common.data.RowsMap;
|
|
|
-import common.data.SQLFactory;
|
|
|
+import common.data.*;
|
|
|
+import restcontroller.R;
|
|
|
|
|
|
@API(title = "广告位管理")
|
|
|
public class adspace extends Controller {
|
|
|
@@ -75,10 +74,53 @@ public class adspace extends Controller {
|
|
|
return getSucReturnObject().toString();
|
|
|
}
|
|
|
|
|
|
-// @API(title = "查询广告位")
|
|
|
-// public String list() throws YosException {
|
|
|
-//
|
|
|
-// }
|
|
|
+ @API(title = "查询广告位", apiversion = R.ID20240328142702.v1.class)
|
|
|
+ public String list() throws YosException {
|
|
|
+
|
|
|
+ StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
+ if (content.containsKey("where")) {
|
|
|
+ JSONObject whereObject = content.getJSONObject("where");
|
|
|
+ if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.notes like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.createdate >='").append(whereObject.getString("begindate")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.createdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_adspace")
|
|
|
+ .setTableAlias("t1");
|
|
|
+ querySQL.setWhere("isused", 1);
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ RowsMap countRowsMap = dbConnect.runSqlQuery("SELECT count(0) count,sys_adspaceid from sys_ad WHERE siteid='" + siteid + "' GROUP BY sys_adspaceid").toRowsMap("sys_adspaceid");
|
|
|
+
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.putIfAbsent("createdate", "");
|
|
|
+ row.putIfAbsent("changedate", "");
|
|
|
+ Rows sysAdspaceRows = countRowsMap.getOrDefault(row.getString("sys_adspaceid"), new Rows());
|
|
|
+ if (sysAdspaceRows.isEmpty()) {
|
|
|
+ row.putIfAbsent("count", 0);
|
|
|
+ } else {
|
|
|
+ row.putIfAbsent("count", sysAdspaceRows.get(0).getLong("count"));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|