school.js 853 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.school.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 学校管理
  7. class SchoolController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.school;
  11. }
  12. // 去重查询学校
  13. async findSchool() {
  14. const data = await this.service.findSchool(this.ctx.query);
  15. this.ctx.ok({ ...data });
  16. }
  17. // 学生名单上报
  18. async stuimport() {
  19. const res = await this.service.stuimport(this.ctx.request.body);
  20. this.ctx.ok({ msg: 'created', data: res });
  21. }
  22. async exportSchool() {
  23. const data = await this.service.exportSchool(this.ctx.request.body);
  24. this.ctx.ok({ data });
  25. }
  26. }
  27. module.exports = CrudController(SchoolController, meta);