Parcourir la source

加入男生高楼层处理

liuyu il y a 5 ans
Parent
commit
303626d572
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      app/service/bedroom.js

+ 2 - 2
app/service/bedroom.js

@@ -28,7 +28,7 @@ class BedroomService extends CrudService {
     // 根据批次id查询批次信息
     const _batch = term.batchnum.find(p => p.id === batchid);
     // 查询所有寝室列表
-    const bedroomList = await this.model.find({ batch: _batch.batch });
+    const bedroomList = await this.model.find({ batch: _batch.batch }).sort({ floor: -1 });
     // 循环所有当前批次下的寝室列表进行分寝处理
     const studentList = await this.getstudents(termid, batchid);
     console.log('stulen-->' + studentList.length);
@@ -86,7 +86,7 @@ class BedroomService extends CrudService {
   // 取得符合条件的学生列表
   async getstudents(termid, batchid) {
     // 根据期id查找所有当期学生列表
-    const studentList = await this.umodel.find({ termid, batchid });
+    const studentList = await this.umodel.find({ termid, batchid }).sort({ gender: 1 });
     return studentList;
   }