mirror of
https://github.com/cool-team-official/cool-admin-midway.git
synced 2024-11-01 14:10:29 +08:00
字典支持多级
This commit is contained in:
parent
aa92f0aa52
commit
93f250f8ef
@ -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;
|
||||
|
@ -18,4 +18,7 @@ export class DictInfoEntity extends BaseEntity {
|
||||
|
||||
@Column({ comment: '备注', nullable: true })
|
||||
remark: string;
|
||||
|
||||
@Column({ comment: '父ID', default: null })
|
||||
parentId: number;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user