tPolicyDeclaration.js 769 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.tPolicyDeclaration.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 管理
  7. class TPolicyDeclarationController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.tPolicyDeclaration;
  11. }
  12. // 修改状态方法
  13. async state() {
  14. const res = await this.service.state(this.ctx.request.body);
  15. this.ctx.ok({ data: res });
  16. }
  17. // 条件查询
  18. async select() {
  19. const res = await this.service.select(this.ctx.query);
  20. this.ctx.ok({ ...res });
  21. }
  22. }
  23. module.exports = CrudController(TPolicyDeclarationController, meta);