student.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. }
  50. module.exports = CrudController(StudentController, meta);