123456789101112131415161718192021222324252627 |
- 'use strict';
- const assert = require('assert');
- const _ = require('lodash');
- const { ObjectId } = require('mongoose').Types;
- const { CrudService } = require('naf-framework-mongoose/lib/service');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- class StudentService extends CrudService {
- constructor(ctx) {
- super(ctx, 'student');
- this.model = this.ctx.model.Student;
- }
- // 查询
- 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 result = { total, data };
- return result;
- }
- }
- module.exports = StudentService;
|