浏览代码

Merge branch 'master' of http://git.cc-lotus.info/new_train/service-center

reloaded 5 年之前
父节点
当前提交
33d24bd514
共有 4 个文件被更改,包括 8 次插入3 次删除
  1. 3 0
      app/controller/.attendance.js
  2. 1 0
      app/model/attendance.js
  3. 2 0
      app/service/attendance.js
  4. 2 3
      app/service/student.js

+ 3 - 0
app/controller/.attendance.js

@@ -5,6 +5,7 @@ module.exports = {
       'batchid',
       'classid',
       'studentid',
+      'schid',
       'attend'
     ]
   },
@@ -19,6 +20,7 @@ module.exports = {
       'batchid',
       'classid',
       'studentid',
+      'schid',
       'attend'
     ]
   },
@@ -35,6 +37,7 @@ module.exports = {
         batchid:'batchid',
         classid :'classid',
         studentid :'studentid',
+        schid: 'schid',
         attend :'attend'
       }
     },

+ 1 - 0
app/model/attendance.js

@@ -15,6 +15,7 @@ const AttendanceSchema = {
   termid: { type: String, required: false, maxLength: 200 }, // 期id
   batchid: { type: String, required: false, maxLength: 200 }, // 批次id
   classid: { type: String, required: false, maxLength: 200 }, // 班级id
+  schid: { type: String, required: false, maxLength: 200 }, // 学校id
   studentid: { type: String, required: false, maxLength: 200 }, // 学生id
   attend: { type: [ attendInfo ], select: true }, // 考勤信息
 };

+ 2 - 0
app/service/attendance.js

@@ -81,6 +81,7 @@ class AttendanceService extends CrudService {
           batchid: student.batchid,
           classid: student.classid,
           studentid: student.id,
+          schid: student.schid,
           attend: [ newData ],
         };
         await this.model.create(newdata);
@@ -123,6 +124,7 @@ class AttendanceService extends CrudService {
           batchid: student.batchid,
           classid: student.classid,
           studentid: student.id,
+          schid: student.schid,
           attend: [ newData ],
         };
         await this.model.create(newdata);

+ 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, $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;
   }