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)