🔱: [server] sync upgrade with 21 commits [trident-sync]

Update README.md
This commit is contained in:
xiaojunnuo
2023-01-29 15:26:58 +08:00
parent 62e3945d30
commit fbde7cbd93
59 changed files with 2126 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
import { ALL, Body, Post, Query } from '@midwayjs/decorator';
import { BaseService } from './base-service';
import { BaseController } from './base-controller';
export abstract class CrudController<
T extends BaseService
> extends BaseController {
abstract getService();
@Post('/page')
async page(
@Body(ALL)
body
) {
const pageRet = await this.getService().page(
body?.query,
body?.page,
body?.sort,
null
);
return this.ok(pageRet);
}
@Post('/add')
async add(
@Body(ALL)
bean
) {
const id = await this.getService().add(bean);
return this.ok(id);
}
@Post('/update')
async update(
@Body(ALL)
bean
) {
await this.getService().update(bean);
return this.ok(null);
}
@Post('/delete')
async delete(
@Query('id')
id
) {
await this.getService().delete([id]);
return this.ok(null);
}
}