|
@@ -4,16 +4,15 @@ import { DeptService } from '../../service/system/dept.service';
|
|
import { CDTO_dept, CVO_dept, FVO_dept, QDTO_dept, QVO_dept, UDTO_dept, UVAO_dept } from '../../interface/system/dept.interface';
|
|
import { CDTO_dept, CVO_dept, FVO_dept, QDTO_dept, QVO_dept, UDTO_dept, UVAO_dept } from '../../interface/system/dept.interface';
|
|
import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
|
|
import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
|
|
import { Validate } from '@midwayjs/validate';
|
|
import { Validate } from '@midwayjs/validate';
|
|
-import { checkPermissionCode } from '../../decorator/checkPermissionCode';
|
|
|
|
@ApiTags(['部门表'])
|
|
@ApiTags(['部门表'])
|
|
@Controller('/dept')
|
|
@Controller('/dept')
|
|
export class DeptController extends BaseController {
|
|
export class DeptController extends BaseController {
|
|
|
|
+ controllerCode = 'system_dept';
|
|
@Inject()
|
|
@Inject()
|
|
service: DeptService;
|
|
service: DeptService;
|
|
|
|
|
|
@Post('/')
|
|
@Post('/')
|
|
@Validate()
|
|
@Validate()
|
|
- @checkPermissionCode({ roleCode: 'system_dept.create' })
|
|
|
|
@ApiResponse({ type: CVO_dept })
|
|
@ApiResponse({ type: CVO_dept })
|
|
async create(@Body() data: CDTO_dept) {
|
|
async create(@Body() data: CDTO_dept) {
|
|
const dbData = await this.service.create(data);
|
|
const dbData = await this.service.create(data);
|
|
@@ -22,7 +21,6 @@ export class DeptController extends BaseController {
|
|
}
|
|
}
|
|
@Get('/')
|
|
@Get('/')
|
|
@ApiQuery({ name: 'query' })
|
|
@ApiQuery({ name: 'query' })
|
|
- @checkPermissionCode({ roleCode: 'system_dept' })
|
|
|
|
@ApiResponse({ type: QVO_dept })
|
|
@ApiResponse({ type: QVO_dept })
|
|
async query() {
|
|
async query() {
|
|
const data = await this.service.queryAll();
|
|
const data = await this.service.queryAll();
|
|
@@ -30,7 +28,6 @@ export class DeptController extends BaseController {
|
|
}
|
|
}
|
|
@Get('/nextLevel/:id')
|
|
@Get('/nextLevel/:id')
|
|
@ApiQuery({ name: 'nextLevel' })
|
|
@ApiQuery({ name: 'nextLevel' })
|
|
- @checkPermissionCode({ roleCode: 'system_dept.nextLevel' })
|
|
|
|
@ApiResponse({ type: QVO_dept })
|
|
@ApiResponse({ type: QVO_dept })
|
|
async nextLevel(@Param('id') id: string, @Query('skip') skip: number, @Query('limit') limit: number) {
|
|
async nextLevel(@Param('id') id: string, @Query('skip') skip: number, @Query('limit') limit: number) {
|
|
const { data, total } = await this.service.getNextLevel(id, { skip, limit });
|
|
const { data, total } = await this.service.getNextLevel(id, { skip, limit });
|
|
@@ -38,7 +35,6 @@ export class DeptController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
@Get('/:id')
|
|
@Get('/:id')
|
|
- @checkPermissionCode({ roleCode: 'system_dept' })
|
|
|
|
@ApiResponse({ type: FVO_dept })
|
|
@ApiResponse({ type: FVO_dept })
|
|
async fetch(@Param('id') id: string) {
|
|
async fetch(@Param('id') id: string) {
|
|
const data = await this.service.fetch(id);
|
|
const data = await this.service.fetch(id);
|
|
@@ -48,7 +44,6 @@ export class DeptController extends BaseController {
|
|
|
|
|
|
@Post('/:id')
|
|
@Post('/:id')
|
|
@Validate()
|
|
@Validate()
|
|
- @checkPermissionCode({ roleCode: 'system_dept.update' })
|
|
|
|
@ApiResponse({ type: UVAO_dept })
|
|
@ApiResponse({ type: UVAO_dept })
|
|
async update(@Param('id') id: string, @Body() body: UDTO_dept) {
|
|
async update(@Param('id') id: string, @Body() body: UDTO_dept) {
|
|
const result = await this.service.updateOne(id, body);
|
|
const result = await this.service.updateOne(id, body);
|
|
@@ -56,7 +51,6 @@ export class DeptController extends BaseController {
|
|
}
|
|
}
|
|
|
|
|
|
@Del('/:id')
|
|
@Del('/:id')
|
|
- @checkPermissionCode({ roleCode: 'system_dept.delete' })
|
|
|
|
@Validate()
|
|
@Validate()
|
|
async delete(@Param('id') id: string) {
|
|
async delete(@Param('id') id: string) {
|
|
await this.service.delete(id);
|
|
await this.service.delete(id);
|