liuyu 4 年之前
父節點
當前提交
93848a4be3
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      app/service/bedroom.js

+ 4 - 1
app/service/bedroom.js

@@ -15,6 +15,7 @@ class BedroomService extends CrudService {
     this.tmodel = this.ctx.model.Trainplan;
     this.cmodel = this.ctx.model.Class;
     this.umodel = this.ctx.model.User;
+    this.ctmodel = this.ctx.model.Classtype;
 
   }
 
@@ -139,7 +140,9 @@ class BedroomService extends CrudService {
   // 取得符合条件的学生列表
   async getstudents(termid, batchid) {
     // 根据期id查找所有当期学生列表
-    const studentList = await this.smodel.find({ termid, batchid }).sort({ gender: -1 });
+    const cltype = await this.ctmodel.find({ bedroom: '0' });
+    const types = _.map(cltype, 'code');
+    const studentList = await this.smodel.find({ termid, batchid, type: { $in: types } }).sort({ gender: -1 });
     return studentList;
   }