mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2025-12-14 11:12:51 +00:00
返回所有字典类型
This commit is contained in:
parent
5646c7ada7
commit
2a46307d9a
@ -1,6 +1,11 @@
|
|||||||
import { DictInfoEntity } from './../../entity/info';
|
import { DictInfoEntity } from './../../entity/info';
|
||||||
import { Body, Inject, Post, Provide } from '@midwayjs/core';
|
import { Body, Get, Inject, Post, Provide } from '@midwayjs/core';
|
||||||
import { CoolController, BaseController } from '@cool-midway/core';
|
import {
|
||||||
|
CoolController,
|
||||||
|
BaseController,
|
||||||
|
CoolTag,
|
||||||
|
TagTypes,
|
||||||
|
} from '@cool-midway/core';
|
||||||
import { DictInfoService } from '../../service/info';
|
import { DictInfoService } from '../../service/info';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -27,4 +32,10 @@ export class AdminDictInfoController extends BaseController {
|
|||||||
async data(@Body('types') types: string[] = []) {
|
async data(@Body('types') types: string[] = []) {
|
||||||
return this.ok(await this.dictInfoService.data(types));
|
return this.ok(await this.dictInfoService.data(types));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CoolTag(TagTypes.IGNORE_TOKEN)
|
||||||
|
@Get('/types', { summary: '获得所有字典类型' })
|
||||||
|
async types() {
|
||||||
|
return this.ok(await this.dictInfoService.types());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,6 +64,14 @@ export class DictInfoService extends BaseService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得字典key
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
async types() {
|
||||||
|
return await this.dictTypeEntity.find();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得单个或多个字典值
|
* 获得单个或多个字典值
|
||||||
* @param value 字典值或字典值数组
|
* @param value 字典值或字典值数组
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user