liuyu 4 년 전
부모
커밋
3f5be3e056
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      app/service/bedroom.js

+ 5 - 5
app/service/bedroom.js

@@ -75,15 +75,15 @@ class BedroomService extends CrudService {
       console.log(bedroom.code);
       // 判断当前寝室号是否已有
       // 根据期id查找所有当期学生列表
-      const _stu = await this.getbedroomstudents(termid, batchid, bedroom.id);
+      const _stu = await this.getbedroomstudents(termid, batchid, bedroom.code);
       console.log(_stu.length);
       if (bedroom.number !== _stu.length) {
         let i = 0;
         let _gender = '';
         for (const stud of studentList) {
           console.log('stu---' + stud.bedroom);
-          if (stud.bedroomid) {
-            if (stud.bedroomid === bedroom.id) {
+          if (stud.bedroom) {
+            if (stud.bedroom === bedroom.code) {
               i = i + 1;
             }
             continue;
@@ -144,9 +144,9 @@ class BedroomService extends CrudService {
   }
 
   // 取得符合条件的学生列表
-  async getbedroomstudents(termid, batchid, bedroomid) {
+  async getbedroomstudents(termid, batchid, bedroom) {
     // 根据期id查找所有当期学生列表
-    const studentList = await this.smodel.find({ termid, batchid, bedroomid });
+    const studentList = await this.smodel.find({ termid, batchid, bedroom });
     return studentList;
   }
 }