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 { 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';
|
import { DictInfoService } from '../../service/info';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7,6 +12,10 @@ import { DictInfoService } from '../../service/info';
|
|||||||
*/
|
*/
|
||||||
@Provide()
|
@Provide()
|
||||||
@CoolController()
|
@CoolController()
|
||||||
|
@CoolUrlTag({
|
||||||
|
key: TagTypes.IGNORE_TOKEN,
|
||||||
|
value: ['data'],
|
||||||
|
})
|
||||||
export class AppDictInfoController extends BaseController {
|
export class AppDictInfoController extends BaseController {
|
||||||
@Inject()
|
@Inject()
|
||||||
dictInfoService: DictInfoService;
|
dictInfoService: DictInfoService;
|
||||||
|
@ -18,4 +18,7 @@ export class DictInfoEntity extends BaseEntity {
|
|||||||
|
|
||||||
@Column({ comment: '备注', nullable: true })
|
@Column({ comment: '备注', nullable: true })
|
||||||
remark: string;
|
remark: string;
|
||||||
|
|
||||||
|
@Column({ comment: '父ID', default: null })
|
||||||
|
parentId: number;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,8 @@ export class DictInfoService extends BaseService {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const data = await this.dictInfoEntity
|
const data = await this.dictInfoEntity
|
||||||
.createQueryBuilder()
|
.createQueryBuilder('a')
|
||||||
|
.select(['a.id', 'a.name', 'a.typeId', 'a.parentId'])
|
||||||
.where('typeId in(:typeIds)', {
|
.where('typeId in(:typeIds)', {
|
||||||
typeIds: typeData.map(e => {
|
typeIds: typeData.map(e => {
|
||||||
return e.id;
|
return e.id;
|
||||||
|
Loading…
Reference in New Issue
Block a user