|
@@ -83,6 +83,21 @@ class GroupService extends CrudService {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ async query({ skip, limit, ...info }) {
|
|
|
+ const total = await this.model.count(info);
|
|
|
+ const res = await this.model.find(info).skip(Number(skip)).limit(Number(limit));
|
|
|
+ const data = [];
|
|
|
+ for (const _group of res) {
|
|
|
+ const group = _.cloneDeep(JSON.parse(JSON.stringify(_group)));
|
|
|
+ for (const stu of group.students) {
|
|
|
+ const student = await this.smodel.findOne({ id: stu.stuid });
|
|
|
+ if (student) stu.job = student.job;
|
|
|
+ }
|
|
|
+ data.push(group);
|
|
|
+ }
|
|
|
+ return { total, data };
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|