mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2025-12-10 16:12:50 +00:00
33 lines
1018 B
TypeScript
33 lines
1018 B
TypeScript
import { DemoGoodsService } from '../../service/goods';
|
|
import { DemoGoodsEntity } from '../../entity/goods';
|
|
import { Body, Config, Inject, Post, Provide } from '@midwayjs/core';
|
|
import { CoolController, BaseController } from '@cool-midway/core';
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
|
|
/**
|
|
* 测试
|
|
*/
|
|
@CoolController({
|
|
api: ['add', 'delete', 'update', 'info', 'list', 'page'],
|
|
entity: DemoGoodsEntity,
|
|
service: DemoGoodsService,
|
|
})
|
|
export class OpenDemoGoodsController extends BaseController {
|
|
@InjectEntityModel(DemoGoodsEntity)
|
|
demoGoodsEntity: Repository<DemoGoodsEntity>;
|
|
|
|
@Inject()
|
|
demoGoodsService: DemoGoodsService;
|
|
|
|
@Post('/sqlPage', { summary: 'sql分页查询' })
|
|
async sqlPage(@Body() query) {
|
|
return this.ok(await this.demoGoodsService.sqlPage(query));
|
|
}
|
|
|
|
@Post('/entityPage', { summary: 'entity分页查询' })
|
|
async entityPage(@Body() query) {
|
|
return this.ok(await this.demoGoodsService.entityPage(query));
|
|
}
|
|
}
|