lrf402788946 4 years ago
parent
commit
ad9494b12c
3 changed files with 11 additions and 0 deletions
  1. 4 0
      app/controller/.teacher.js
  2. 1 0
      app/router.js
  3. 6 0
      app/service/teacher.js

+ 4 - 0
app/controller/.teacher.js

@@ -129,4 +129,8 @@ module.exports = {
       count: true
     }
   },
+  fetchteachers:{
+    requestBody:["!ids"],
+    service:'fetchteachers'
+  }
 };

+ 1 - 0
app/router.js

@@ -47,6 +47,7 @@ module.exports = app => {
     controller.teacher.status
   );
   router.post('/api/train/teacher/teaimport', controller.teacher.teaimport);
+  router.post('/api/train/teacher/fetchteachers', controller.teacher.fetchteachers);
 
   // 作业表配置路由
   router.resources('task', '/api/train/task', controller.task); // index、create、show、destroy

+ 6 - 0
app/service/teacher.js

@@ -27,6 +27,12 @@ class TeacherService extends CrudService {
     return await this.model.findById(id, '+file');
   }
 
+  // 批量查询教师
+  async fetchteachers({ ids }) {
+    return await this.model.find({ _id: { $in: ids } });
+  }
+
+
   async status(data) {
     const { teachersid, zlscore, msscore, status, remark } = data;
     for (const teacherid of teachersid) {