lrf402788946 4 vuotta sitten
vanhempi
commit
8cfdc312cb
1 muutettua tiedostoa jossa 7 lisäystä ja 1 poistoa
  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)