lrf402788946 4 éve
szülő
commit
ba5fcc8d6e
2 módosított fájl, 8 hozzáadás és 2 törlés
  1. 1 1
      app/controller/.experience.js
  2. 7 1
      app/service/experience.js

+ 1 - 1
app/controller/.experience.js

@@ -55,7 +55,7 @@ module.exports = {
         termid: "termid",
         batchid: "batchid",
         classid: "classid",
-        studenti: "studentid",
+        studentid: "studentid",
         id:"id",
       },
     },

+ 7 - 1
app/service/experience.js

@@ -47,7 +47,7 @@ class ExperienceService extends CrudService {
   }
 
   async exportDocx(data) {
-    const { planid, termid, batchid, classid, id } = data;
+    const { planid, termid, batchid, classid, studentid, id } = data;
     // 从小到大判断
     // res是最后的结果,可能是Object也可能是Array
     // 作者拼接:能直接获取学生姓名,班级名称,需要单独查下期数
@@ -76,6 +76,12 @@ class ExperienceService extends CrudService {
       const { term } = await trainPlanInfo(r.termid);
       if (term) { r.term = `第${term}期`; }
       res = r;
+    } else if (studentid) {
+      const r = await this.model.findOne({ studentid }).populate({ path: 'studentid', select: 'name job' }).populate({ path: 'classid', select: 'name' });
+      if (!r) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定范围的培训心得');
+      const { term } = await trainPlanInfo(r.termid);
+      if (term) { r.term = `第${term}期`; }
+      res = r;
     } else if (classid) {
       let r = await this.model.find({ classid }).populate({ path: 'studentid', select: 'name job' }).populate({ path: 'classid', select: 'name' });
       if (r.length <= 0) throw new BusinessError(ErrorCode.DATA_NOT_EXIST, '未找到指定范围的培训心得');