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 });