chore: src/modules/recycle/controller/admin/data.ts
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { BaseSysUserEntity } from './../../../base/entity/sys/user';
|
||||
import { RecycleDataEntity } from './../../entity/data';
|
||||
import { Body, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { CoolController, BaseController } from '@cool-midway/core';
|
||||
import { RecycleDataService } from '../../service/data';
|
||||
|
||||
/**
|
||||
* 数据回收
|
||||
*/
|
||||
@Provide()
|
||||
@CoolController({
|
||||
api: ['info', 'page'],
|
||||
entity: RecycleDataEntity,
|
||||
pageQueryOp: {
|
||||
keyWordLikeFields: ['b.name', 'a.url'],
|
||||
select: ['a.*', 'b.name as userName'],
|
||||
join: [
|
||||
{
|
||||
entity: BaseSysUserEntity,
|
||||
alias: 'b',
|
||||
condition: 'a.userId = b.id',
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
export class AdminRecycleDataController extends BaseController {
|
||||
@Inject()
|
||||
recycleDataService: RecycleDataService;
|
||||
|
||||
@Post('/restore', { summary: '恢复数据' })
|
||||
async restore(@Body('ids') ids: number[]) {
|
||||
await this.recycleDataService.restore(ids);
|
||||
return this.ok();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user