返回所有字典类型

This commit is contained in:
COOL 2025-02-05 13:11:54 +08:00
parent 5646c7ada7
commit 2a46307d9a
2 changed files with 21 additions and 2 deletions

View File

@ -1,6 +1,11 @@
import { DictInfoEntity } from './../../entity/info';
import { Body, Inject, Post, Provide } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { Body, Get, Inject, Post, Provide } from '@midwayjs/core';
import {
CoolController,
BaseController,
CoolTag,
TagTypes,
} from '@cool-midway/core';
import { DictInfoService } from '../../service/info';
/**
@ -27,4 +32,10 @@ export class AdminDictInfoController extends BaseController {
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());
}
}

View File

@ -64,6 +64,14 @@ export class DictInfoService extends BaseService {
return result;
}
/**
* key
* @returns
*/
async types() {
return await this.dictTypeEntity.find();
}
/**
*
* @param value