吴志根 4 лет назад
Родитель
Сommit
9830655edf

+ 10 - 0
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/SQL/查询课件详细.sql

@@ -0,0 +1,10 @@
+SELECT t1.tarchives_scid,
+       t1.ttypedetailid,
+       t1.createdate,
+       t1.fnotes,
+       t1.ftitle,
+       t1.fvisitors,
+       t1.fisontop,
+       t1.fiscandownload
+FROM tarchives_sc t1
+WHERE t1.tarchives_scid = $tarchives_scid$

+ 32 - 0
src/dsb/com/cnd3b/restcontroller/customer/wechatapplet/wechatapplet.java

@@ -75,4 +75,36 @@ public class wechatapplet extends Controller {
         return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
     }
 
+    /**
+     * 获取课件详情
+     *
+     * @return
+     */
+    public String getCoursewareDetail() {
+        String tarchives_scid = content.getString("tarchives_scid");
+        //已学习人数加一
+        String sql = "UPDATE tarchives_sc SET fvisitors= CASE WHEN fvisitors IS NULL THEN 1 else fvisitors + 1 END where tarchives_scid='" + tarchives_scid + "'";
+        dbConnect.runSqlUpdate(sql);
+
+        SQLFactory sqlFactory = new SQLFactory(this, "查询课件详细");
+        sqlFactory.addParameter("tarchives_scid", tarchives_scid);
+        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
+        RowsMap rowsMap = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"));
+        //查询封面
+        RowsMap rowsMapCover = getAttachmentUrl("tarchives_sc", rows.toArrayList("tarchives_scid"), "cover");
+        for (Row row : rows) {
+            row.put("attinfos", rowsMap.get(row.getString("tarchives_scid")));
+            Rows coverRows = rowsMapCover.get(row.getString("tarchives_scid"));
+            if (!coverRows.isEmpty()) {
+                row.put("cover", coverRows.get(0).getString("fobsurl"));
+            }
+
+        }
+        if (rows.isEmpty()) {
+            return getErrReturnObject().setErrMsg("未找到当前课件").toString();
+        }
+
+        return getSucReturnObject().setData(rows.get(0)).toString();
+    }
+
 }

+ 1 - 0
src/dsb/com/cnd3b/restcontroller/enterprise/tarchives_sc/tarchives_sc.java

@@ -37,6 +37,7 @@ public class tarchives_sc extends Controller {
         paoRemote.setValue("fnotes", fnotes, 11L);
         paoRemote.setValue("fstatus", "н¨", 11L);
         paoRemote.setValue("ftitle", ftitle, 11L);
+        paoRemote.setValue("fvisitors", 0, 11L);
         paoRemote.setValue("fiscandownload", fiscandownload, 11L);
         paoRemote.setValue("fisontop", fisontop, 11L);
         paoSetRemote.save();