Просмотр исходного кода

通告查询列表新增封面图及附件数量信息

沈静伟 4 лет назад
Родитель
Сommit
7420e39e46

+ 1 - 2
src/dsb/com/cnd3b/restcontroller/customer/notice/notice.java

@@ -76,9 +76,8 @@ public class notice extends Controller {
 
         for (Row row : rows) {
             String tnoticeid = row.getString("tnoticeid");
-
-            row.put("fattachmentcount", attinfocountmap.containsKey(tnoticeid) ? attinfocountmap.get(tnoticeid).getRow(0).getInteger("fattachmentcount") : 0);
             row.put("fisread", tnoticeids.contains(tnoticeid) ? 1 : 0);
+            row.put("fattachmentcount", attinfocountmap.containsKey(tnoticeid) ? attinfocountmap.get(tnoticeid).getRow(0).getInteger("fattachmentcount") : 0);
             row.put("attinfos", noticecovermap.get(tnoticeid));
         }
         return getSucReturnObject().setDataByPaging(rows, sortfield).setFinalDo(DataPool.defaultdatalife, 1);

+ 11 - 0
src/dsb/com/cnd3b/restcontroller/customer/noticemag/noticemag.java

@@ -55,6 +55,17 @@ public class noticemag extends Controller {
         noticehead.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(noticehead.getSQL());
 
+        ArrayList<String> tnoticeidlist = rows.toArrayList("tnoticeid");
+        //公告附件数量查询
+        RowsMap attinfocountmap = getAttachmentQty("tnotice", tnoticeidlist);
+        //公告封面图查询
+        RowsMap noticecovermap = getAttachmentUrl("tnotice", tnoticeidlist, "cover");
+
+        for (Row row : rows) {
+            String tnoticeid = row.getString("tnoticeid");
+            row.put("fattachmentcount", attinfocountmap.containsKey(tnoticeid) ? attinfocountmap.get(tnoticeid).getRow(0).getInteger("fattachmentcount") : 0);
+            row.put("attinfos", noticecovermap.get(tnoticeid));
+        }
         return getSucReturnObject().setDataByPaging(rows, sortfield).setFinalDo(DataPool.defaultdatalife, 1);
     }
 

+ 15 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/notice_agent/notice_agent.java

@@ -2,10 +2,14 @@ package com.cnd3b.restcontroller.enterprise.notice_agent;
 
 import com.alibaba.fastjson.JSONObject;
 import com.cnd3b.common.Controller;
+import com.cnd3b.common.data.Row;
 import com.cnd3b.common.data.Rows;
+import com.cnd3b.common.data.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.data.db.DataPool;
 
+import java.util.ArrayList;
+
 public class notice_agent extends Controller {
     public notice_agent(JSONObject content) {
         super(content);
@@ -46,6 +50,17 @@ public class notice_agent extends Controller {
         noticehead.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(noticehead.getSQL());
 
+        ArrayList<String> tnoticeidlist = rows.toArrayList("tnoticeid");
+        //公告附件数量查询
+        RowsMap attinfocountmap = getAttachmentQty("tnotice", tnoticeidlist);
+        //公告封面图查询
+        RowsMap noticecovermap = getAttachmentUrl("tnotice", tnoticeidlist, "cover");
+
+        for (Row row : rows) {
+            String tnoticeid = row.getString("tnoticeid");
+            row.put("fattachmentcount", attinfocountmap.containsKey(tnoticeid) ? attinfocountmap.get(tnoticeid).getRow(0).getInteger("fattachmentcount") : 0);
+            row.put("attinfos", noticecovermap.get(tnoticeid));
+        }
         return getSucReturnObject().setDataByPaging(rows, sortfield).setFinalDo(DataPool.defaultdatalife, 1);
     }
 

+ 17 - 3
src/dsb/com/cnd3b/restcontroller/enterprise/noticemag/noticemag.java

@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.cnd3b.common.Controller;
 import com.cnd3b.common.D3bException;
+import com.cnd3b.common.data.Row;
 import com.cnd3b.common.data.Rows;
+import com.cnd3b.common.data.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.data.db.DataPool;
 import p2.pao.PaoRemote;
@@ -53,6 +55,18 @@ public class noticemag extends Controller {
         noticehead.addParameter_SQL("where", where);
         Rows rows = dbConnect.runSqlQuery(noticehead.getSQL());
 
+        ArrayList<String> tnoticeidlist = rows.toArrayList("tnoticeid");
+        //公告附件数量查询
+        RowsMap attinfocountmap = getAttachmentQty("tnotice", tnoticeidlist);
+        //公告封面图查询
+        RowsMap noticecovermap = getAttachmentUrl("tnotice", tnoticeidlist, "cover");
+
+        for (Row row : rows) {
+            String tnoticeid = row.getString("tnoticeid");
+            row.put("fattachmentcount", attinfocountmap.containsKey(tnoticeid) ? attinfocountmap.get(tnoticeid).getRow(0).getInteger("fattachmentcount") : 0);
+            row.put("attinfos", noticecovermap.get(tnoticeid));
+        }
+
         return getSucReturnObject().setDataByPaging(rows, sortfield).setFinalDo(DataPool.defaultdatalife, 1);
     }
 
@@ -101,10 +115,10 @@ public class noticemag extends Controller {
         String ftitle = content.getString("ftitle", "tnotice.ftitle", "标题");//标题
         String fsummary = content.getString("fsummary", "tnotice.fsummary", "通告导语");//概述、导读
         String fcontent = content.getString("fcontent", "tnotice.fcontent", "正文");//公告内容
-        boolean fishomepage=content.getBooleanValue("fishomepage");//门户可见
+        boolean fishomepage = content.getBooleanValue("fishomepage");//门户可见
         boolean fischeckagent = content.getBooleanValue("fcheckagent");//认证商户可见
-        boolean fisagentsubuser=content.getBooleanValue("fisagentsubuser");//认证商户子账号可见
-        boolean fisspecifiedrange=content.getBooleanValue("fisspecifiedrange");//指定认证商户范围
+        boolean fisagentsubuser = content.getBooleanValue("fisagentsubuser");//认证商户子账号可见
+        boolean fisspecifiedrange = content.getBooleanValue("fisspecifiedrange");//指定认证商户范围
         boolean fissingleagent = content.getBooleanValue("fissingleagent");//个人商户可见
         boolean fisontop = content.getBooleanValue("fisontop");//是否置顶
         Date fbegdate = content.getDate("fbegdate");//开始时间