2024-09-29 01:14:21 +08:00
|
|
|
import { ALL, Body, Controller, Inject, Post, Provide, Query } from '@midwayjs/core';
|
2024-07-15 00:30:33 +08:00
|
|
|
import { CrudController } from '../../../basic/crud-controller.js';
|
|
|
|
|
import { PermissionService } from '../service/permission-service.js';
|
2023-01-29 15:26:58 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 权限资源
|
|
|
|
|
*/
|
|
|
|
|
@Provide()
|
|
|
|
|
@Controller('/api/sys/authority/permission')
|
|
|
|
|
export class PermissionController extends CrudController<PermissionService> {
|
|
|
|
|
@Inject()
|
|
|
|
|
service: PermissionService;
|
|
|
|
|
|
|
|
|
|
getService() {
|
|
|
|
|
return this.service;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 09:29:43 +08:00
|
|
|
@Post('/page', { summary: 'sys:auth:per:view' })
|
2023-01-29 15:26:58 +08:00
|
|
|
async page(
|
|
|
|
|
@Body(ALL)
|
|
|
|
|
body
|
|
|
|
|
) {
|
|
|
|
|
return await super.page(body);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 09:29:43 +08:00
|
|
|
@Post('/add', { summary: 'sys:auth:per:add' })
|
2023-01-29 15:26:58 +08:00
|
|
|
async add(
|
|
|
|
|
@Body(ALL)
|
|
|
|
|
bean
|
|
|
|
|
) {
|
|
|
|
|
return await super.add(bean);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 09:29:43 +08:00
|
|
|
@Post('/update', { summary: 'sys:auth:per:edit' })
|
2023-01-29 15:26:58 +08:00
|
|
|
async update(
|
|
|
|
|
@Body(ALL)
|
|
|
|
|
bean
|
|
|
|
|
) {
|
|
|
|
|
return await super.update(bean);
|
|
|
|
|
}
|
2023-06-27 09:29:43 +08:00
|
|
|
@Post('/delete', { summary: 'sys:auth:per:remove' })
|
2023-01-29 15:26:58 +08:00
|
|
|
async delete(
|
|
|
|
|
@Query('id')
|
2024-09-29 01:14:21 +08:00
|
|
|
id: number
|
2023-01-29 15:26:58 +08:00
|
|
|
) {
|
|
|
|
|
return await super.delete(id);
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-27 09:29:43 +08:00
|
|
|
@Post('/tree', { summary: 'sys:auth:per:view' })
|
2023-01-29 15:26:58 +08:00
|
|
|
async tree() {
|
|
|
|
|
const tree = await this.service.tree({});
|
|
|
|
|
return this.ok(tree);
|
|
|
|
|
}
|
|
|
|
|
}
|