lrf пре 2 година
родитељ
комит
a42874a787
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      app/service/view/student.js

+ 4 - 1
app/service/view/student.js

@@ -13,7 +13,10 @@ class StudentService extends CrudService {
   }
   async lessonList({ student_id, school_id, skip = 0, limit = 0, ...otherQuery }) {
     // 查出该学生的课表
-    const lsList = await this.lessonStudentModel.find({ student_id, school_id }, { lesson_id: 1 });
+    const query = {};
+    if (student_id)query.student_id = student_id;
+    if (school_id) query.school_id = school_id;
+    const lsList = await this.lessonStudentModel.find(query, { lesson_id: 1 });
     const lessonIds = lsList.map(i => i.lesson_id);
     const data = await this.lessonModel.find({ _id: lessonIds, ...otherQuery }).skip(parseInt(skip)).limit(parseInt(limit));
     const total = await this.lessonModel.count({ _id: lessonIds, ...otherQuery });