1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| import { DictInfoEntity } from './../../entity/info';
| import { Body, Get, Inject, Post, Provide } from '@midwayjs/core';
| import {
| CoolController,
| BaseController,
| CoolTag,
| TagTypes,
| } from '@cool-midway/core';
| import { DictInfoService } from '../../service/info';
|
| /**
| * 字典信息
| */
| @Provide()
| @CoolController({
| api: ['add', 'delete', 'update', 'info', 'list', 'page'],
| entity: DictInfoEntity,
| service: DictInfoService,
| listQueryOp: {
| fieldEq: ['typeId'],
| keyWordLikeFields: ['name'],
| addOrderBy: {
| createTime: 'ASC',
| },
| },
| })
| export class AdminDictInfoController extends BaseController {
| @Inject()
| dictInfoService: DictInfoService;
|
| @Post('/data', { summary: '获得字典数据' })
| async data(@Body('types') types: string[] = []) {
| return this.ok(await this.dictInfoService.data(types));
| }
|
| @CoolTag(TagTypes.IGNORE_TOKEN)
| @Get('/types', { summary: '获得所有字典类型' })
| async types() {
| return this.ok(await this.dictInfoService.types());
| }
| }
|
|