lrf402788946 4 년 전
부모
커밋
8cfdc312cb
1개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      app/service/student.js

+ 7 - 1
app/service/student.js

@@ -33,7 +33,13 @@ class StudentService extends CrudService {
 
   // 查询
   async query({ skip, limit, ...info }) {
-    await this.arrangeNumber();
+    const { termid, classid } = info;
+    if (!classid) {
+      const classes = await this.clamodel.find({ termid });
+      for (const cla of classes) {
+        await this.arrangeNumber(cla._id);
+      }
+    } else { await this.arrangeNumber(classid); }
     const total = await this.model.count(info);
     const res = await this.model
       .find(info)