Przeglądaj źródła

长图文管理

eganwu 1 rok temu
rodzic
commit
632f53b6d2

+ 5 - 0
src/custom/restcontroller/R.java

@@ -5884,6 +5884,11 @@ public class R {
         }
     }
 
+    public static class ID20240408131902 {
+        public static class v1 {
+        }
+    }
+
 
 }
 

+ 8 - 1
src/custom/restcontroller/webmanage/saletool/sharematerial/EquipmentResourceLibrary.java

@@ -319,7 +319,14 @@ public class EquipmentResourceLibrary extends Controller {
         RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
 
         for (Row row : rows) {
-            row.put("attinfos", attRowsMap.getOrDefault(row.getString("attachmentid"), new Rows()));
+            Rows attRows = new Rows();
+            Rows tempAttRows = attRowsMap.getOrDefault(row.getString("attachmentid"), new Rows());
+            for (Row tempAttRow : tempAttRows) {
+                if (tempAttRow.getString("ownertable").equals(ownertable)) {
+                    attRows.add(tempAttRow);
+                }
+            }
+            row.put("attinfos", attRows);
         }
 
 

+ 42 - 0
src/custom/restcontroller/webmanage/saletool/sharematerial/LongPicText.java

@@ -198,6 +198,48 @@ public class LongPicText extends Controller {
         return getSucReturnObject().setData(rows).toString();
     }
 
+    @API(title = "小程序长图文详情", apiversion = R.ID20240408131902.v1.class)
+    public String miniAppDetail() throws YosException {
+        String ownertable = "sat_sharematerial";
+        Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
+
+        QuerySQL querySQ = SQLFactory.createQuerySQL(this, "sat_sharematerial"
+                        ,"sat_sharematerialid","sharepagecontrol","type","title")
+                .setTableAlias("t1");
+        querySQ.setSiteid(siteid);
+        querySQ.setWhere("sat_sharematerialid", sat_sharematerialid);
+        Rows rows = querySQ.query();
+        Row detailRow = rows.isNotEmpty() ? rows.get(0) : new Row();
+        Rows attRows = getAttachmentUrl("sat_sharematerial", sat_sharematerialid);
+        detailRow.put("attinfos", attRows);
+
+        QuerySQL attachmentQuery = SQLFactory.createQuerySQL(this, "sys_attachment_links").setTableAlias("t1");
+        attachmentQuery.setSiteid(siteid);
+        attachmentQuery.setWhere("ownertable", ownertable);
+        attachmentQuery.setWhere("ownerid", sat_sharematerialid);
+        attachmentQuery.setWhere("usetype", ownertable);
+        Rows attachmentRows = attachmentQuery.query();
+
+        ArrayList<Long> ids = attachmentRows.toArrayList("attachmentid", new ArrayList<>());
+
+        RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
+
+        for (Row row : attachmentRows) {
+            Rows attPicRows = new Rows();
+            Rows tempAttRows = attRowsMap.getOrDefault(row.getString("attachmentid"), new Rows());
+            for (Row tempAttRow : tempAttRows) {
+                if (tempAttRow.getString("ownertable").equals(ownertable)) {
+                    attPicRows.add(tempAttRow);
+                }
+            }
+            row.put("attinfos", attPicRows);
+        }
+
+        detailRow.put("attinfos_pic", attachmentRows);
+
+        return getSucReturnObject().setData(detailRow).toString();
+    }
+
 //    @API(title = "长图文图片列表", apiversion = R.ID20240329145502.v1.class)
 //    public String piclist() throws YosException {
 //