Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
elearn
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hqzhdj
elearn
Commits
a359c670
Commit
a359c670
authored
Jan 03, 2025
by
阳浪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通过父类code查询当前数据字典下的子节点
parent
4892d01e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
0 deletions
+31
-0
cloud-system/src/main/java/com/yizhi/system/application/controller/remote/DictionaryController.java
+31
-0
No files found.
cloud-system/src/main/java/com/yizhi/system/application/controller/remote/DictionaryController.java
View file @
a359c670
...
@@ -3,6 +3,7 @@ package com.yizhi.system.application.controller.remote;
...
@@ -3,6 +3,7 @@ package com.yizhi.system.application.controller.remote;
import
java.util.List
;
import
java.util.List
;
import
com.google.common.collect.Lists
;
import
com.yizhi.application.orm.util.DomainConverter
;
import
com.yizhi.application.orm.util.DomainConverter
;
import
com.yizhi.system.application.vo.domain.Dictionary
;
import
com.yizhi.system.application.vo.domain.Dictionary
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -335,6 +336,36 @@ public class DictionaryController {
...
@@ -335,6 +336,36 @@ public class DictionaryController {
}
}
/**
* 查询当前数据字典下的子节点
*
* @param code 要查找的对象的父节点
* @param includeParent 是否包含父节点(id对应的自身节点),true:包含,false:不包含,默认false
* @param layer 以id对应对象为第0层,查询多少层子节点,默认1层
* @return
*/
@ApiOperation
(
value
=
"数据字典"
,
notes
=
"通过父类code查询当前数据字典下的子节点"
,
response
=
Response
.
class
)
@GetMapping
(
value
=
"/child/listByCode"
)
public
Response
<
List
<
Dictionary
>>
listChildDictionary
(
@ApiParam
(
"要查找的对象的父节点"
)
@RequestParam
(
name
=
"code"
,
defaultValue
=
"0"
)
String
code
,
@ApiParam
(
"是否包含父节点(id对应的自身节点),</br>true:包含,</br>false:不包含,默认false"
)
@RequestParam
(
name
=
"includeParent"
,
defaultValue
=
"false"
)
Boolean
includeParent
,
@ApiParam
(
"以id对应对象为第0层,查询多少层子节点,默认1层"
)
@RequestParam
(
name
=
"layer"
,
defaultValue
=
"1"
)
Integer
layer
)
{
try
{
com
.
yizhi
.
system
.
application
.
domain
.
Dictionary
dictionary
=
dictionaryService
.
findByCode
(
code
);
if
(
dictionary
==
null
){
return
Response
.
ok
(
Lists
.
newArrayList
());
}
List
<
com
.
yizhi
.
system
.
application
.
domain
.
Dictionary
>
result
=
dictionaryService
.
listChildren
(
dictionary
.
getId
(),
includeParent
,
layer
);
List
<
Dictionary
>
list
=
domainConverter
.
toDOList
(
result
,
Dictionary
.
class
);
return
Response
.
ok
(
list
);
}
catch
(
Exception
e
)
{
LOG
.
error
(
""
,
e
);
return
Response
.
fail
(
ReturnCode
.
SERVICE_UNAVAILABLE
.
getCode
(),
ReturnCode
.
SERVICE_UNAVAILABLE
.
getMsg
());
}
}
/**
/**
* 检查该字典下是否有子数据
* 检查该字典下是否有子数据
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment