|
|
@@ -122,10 +122,81 @@ public class LongPicText extends Controller {
|
|
|
}
|
|
|
|
|
|
@API(title = "长图文列表", apiversion = R.ID20240329131802.v1.class)
|
|
|
- public String list() {
|
|
|
+ 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.title like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
|
|
|
+ if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.status ='").append(whereObject.getString("status")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("type") && !"".equals(whereObject.getString("type"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.type ='").append(whereObject.getString("type")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
|
|
|
- return getSucReturnObject().toString();
|
|
|
+ if (whereObject.containsKey("begindate_create") && !"".equals(whereObject.getString("begindate_create"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.createdate >='").append(whereObject.getString("begindate_create")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate_create") && !"".equals(whereObject.getString("enddate_create"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.createdate <='").append(whereObject.getString("enddate_create")).append(" 23:59:59' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.checkdate >='").append(whereObject.getString("begindate")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.checkdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_sharematerial"
|
|
|
+ , "sat_sharematerialid", "title", "sharepagecontrol", "content", "notes", "type", "status", "createdate", "checkdate")
|
|
|
+ .setTableAlias("t1");
|
|
|
+ querySQL.setWhere("classid", 2);
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ for (Row row : rows) {
|
|
|
+ row.putIfAbsent("checkdate", "");
|
|
|
+ if (row.getInteger("type") == 1) {
|
|
|
+ row.put("typestr", "图片");
|
|
|
+ }
|
|
|
+ if (row.getInteger("type") == 2) {
|
|
|
+ row.put("typestr", "视频");
|
|
|
+ }
|
|
|
+ if (row.getInteger("type") == 3) {
|
|
|
+ row.put("typestr", "图文");
|
|
|
+ }
|
|
|
+ Rows attRows = getAttachmentUrl("sat_sharematerial", row.getLong("sat_sharematerialid"));
|
|
|
+ row.put("attinfos", attRows);
|
|
|
+
|
|
|
+ row.put("shareurl", "/pages/product/ctw/share?id=" + row.getLong("sat_sharematerialid"));
|
|
|
+ row.put("noshareurl", "/pages/product/ctw/noshare?id=" + row.getLong("sat_sharematerialid"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
@API(title = "长图文图片列表", apiversion = R.ID20240329145502.v1.class)
|
|
|
@@ -147,9 +218,9 @@ public class LongPicText extends Controller {
|
|
|
}
|
|
|
|
|
|
RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
|
|
|
- for (Object object:jsonArray) {
|
|
|
- JSONObject jsonObject1= (JSONObject) object;
|
|
|
- jsonObject1.put("attinfos",attRowsMap.getOrDefault(jsonObject1.getString("attchementid"),new Rows()));
|
|
|
+ for (Object object : jsonArray) {
|
|
|
+ JSONObject jsonObject1 = (JSONObject) object;
|
|
|
+ jsonObject1.put("attinfos", attRowsMap.getOrDefault(jsonObject1.getString("attchementid"), new Rows()));
|
|
|
}
|
|
|
|
|
|
|