Explorar el Código

更新查询方法

liuyu hace 4 años
padre
commit
3b02c4a786
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      app/service/student.js

+ 2 - 2
app/service/student.js

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