student.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.student.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 学生管理
  7. class StudentController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.student;
  11. }
  12. async index() {
  13. const data = await this.service.query(this.ctx.query);
  14. this.ctx.ok({ ...data });
  15. }
  16. // GET
  17. // 查询
  18. async seek() {
  19. const res = await this.service.seek(this.ctx.query);
  20. this.ctx.ok({ ...res });
  21. }
  22. // GET
  23. // 查询
  24. async findbedroom() {
  25. const data = await this.service.findbedroom(this.ctx.query);
  26. this.ctx.ok({ data });
  27. }
  28. async upjob() {
  29. const data = await this.service.upjob(this.ctx.request.body);
  30. this.ctx.ok({ data });
  31. }
  32. // 删除学生班级
  33. async deleteclass() {
  34. const data = await this.service.deleteclass(this.ctx.request.body);
  35. this.ctx.ok({ data });
  36. }
  37. async findscore() {
  38. const data = await this.service.findscore(this.ctx.query);
  39. this.ctx.ok({ ...data });
  40. }
  41. async findbystuids() {
  42. const data = await this.service.findbystuids(this.ctx.request.body);
  43. this.ctx.ok({ data });
  44. }
  45. async deletestus() {
  46. const data = await this.service.deletestus(this.ctx.request.body);
  47. this.ctx.ok({ data });
  48. }
  49. async updatabedroom() {
  50. const data = await this.service.updatabedroom(this.ctx.request.body);
  51. this.ctx.ok({ data });
  52. }
  53. }
  54. module.exports = CrudController(StudentController, meta);