字典支持多级

This commit is contained in:
小鹏 2022-07-15 18:02:34 +08:00
parent aa92f0aa52
commit 93f250f8ef
3 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,10 @@
import { Body, Inject, Post, Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import {
CoolController,
BaseController,
CoolUrlTag,
TagTypes,
} from '@cool-midway/core';
import { DictInfoService } from '../../service/info';
/**
@ -7,6 +12,10 @@ import { DictInfoService } from '../../service/info';
*/
@Provide()
@CoolController()
@CoolUrlTag({
key: TagTypes.IGNORE_TOKEN,
value: ['data'],
})
export class AppDictInfoController extends BaseController {
@Inject()
dictInfoService: DictInfoService;

View File

@ -18,4 +18,7 @@ export class DictInfoEntity extends BaseEntity {
@Column({ comment: '备注', nullable: true })
remark: string;
@Column({ comment: '父ID', default: null })
parentId: number;
}

View File

@ -32,7 +32,8 @@ export class DictInfoService extends BaseService {
return {};
}
const data = await this.dictInfoEntity
.createQueryBuilder()
.createQueryBuilder('a')
.select(['a.id', 'a.name', 'a.typeId', 'a.parentId'])
.where('typeId in(:typeIds)', {
typeIds: typeData.map(e => {
return e.id;