Quellcode durchsuchen

修改学生查询接口

liuyu vor 4 Jahren
Ursprung
Commit
429aa01a88
1 geänderte Dateien mit 2 neuen und 3 gelöschten Zeilen
  1. 2 3
      app/service/student.js

+ 2 - 3
app/service/student.js

@@ -16,9 +16,8 @@ class StudentService extends CrudService {
 
   // 查询
   async seek({ termid, skip, limit }) {
-    const students = await this.model.find({ termid, classid: null });
-    const data = await this.model.find({ termid, classid: null }).skip(Number(skip)).limit(Number(limit));
-    const total = await students.length;
+    const total = await this.model.count({ termid, classid: '' });
+    const data = await this.model.find({ termid, classid: '' }).skip(Number(skip)).limit(Number(limit));
     const result = { total, data };
     return result;
   }