wangzhibo
6 天以前 7dcc2997614f849258091f5d66e648317a40d323
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { ALL, Body, Inject, Post, Provide } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { BaseSysDepartmentEntity } from '../../../entity/sys/department';
import { BaseSysDepartmentService } from '../../../service/sys/department';
 
/**
 * 部门
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'list'],
  entity: BaseSysDepartmentEntity,
  service: BaseSysDepartmentService,
  insertParam: ctx => {
    return {
      userId: ctx.admin.userId,
    };
  },
})
export class BaseDepartmentController extends BaseController {
  @Inject()
  baseDepartmentService: BaseSysDepartmentService;
 
  /**
   * 部门排序
   */
  @Post('/order', { summary: '排序' })
  async order(@Body(ALL) params: any) {
    await this.baseDepartmentService.order(params);
    return this.ok();
  }
}