Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-platform-auth
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
base_platform_enterprise
gic-platform-auth
Commits
58369355
Commit
58369355
authored
Sep 18, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑子页面接口修改:判断父级层级和当前层级,一验证父级ID参数
parent
2e8ad2d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+14
-1
MenuController.java
...main/java/com/gic/auth/web/controller/MenuController.java
+19
-1
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
58369355
...
...
@@ -142,6 +142,7 @@ public class MenuApiServiceImpl implements MenuApiService {
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"父级页面不存在"
);
}
menuDTO
.
setMenuVersion
(
"_"
+
menuDTO
.
getMenuVersion
().
replaceAll
(
","
,
"_"
)
+
"_"
);
//sort
int
maxSort
=
menuService
.
getMaxSortByParentId
(
menuDTO
.
getParentId
(),
menuDTO
.
getProject
());
menuDTO
.
setSort
(
maxSort
+
1
);
...
...
@@ -174,8 +175,20 @@ public class MenuApiServiceImpl implements MenuApiService {
if
(
parent
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"父级页面不存在"
);
}
TabSysMenu
record
=
menuService
.
getMenuById
(
menuDTO
.
getMenuId
());
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"主键参数有误,查无数据"
);
}
if
(
parent
.
getLevel
().
intValue
()
>=
record
.
getLevel
().
intValue
())
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"父级ID有误,层级在当前页面之下"
);
}
ServiceResponse
paramsValid
=
ValidParamsUtils
.
allCheckValidate
(
menuDTO
,
clazz
);
if
(!
paramsValid
.
isSuccess
())
{
return
paramsValid
;
}
menuDTO
.
setMenuVersion
(
"_"
+
menuDTO
.
getMenuVersion
().
replaceAll
(
","
,
"_"
)
+
"_"
);
menuService
.
updatePage
(
menuDTO
);
return
updatePage
(
menuDTO
,
clazz
);
return
ServiceResponse
.
success
(
);
}
private
List
<
MenuDTO
>
treeMenu
(
List
<
TabSysMenu
>
menuList
,
int
level
,
int
parentId
)
{
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/MenuController.java
View file @
58369355
...
...
@@ -5,7 +5,9 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.auth.constant.GicVersionEnum
;
import
com.gic.auth.constant.MenuLevelConstants
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.dubbo.rpc.RpcContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -132,7 +134,7 @@ public class MenuController {
data
.
put
(
"sort"
,
menuDTO
.
getSort
());
data
.
put
(
"menuCode"
,
menuDTO
.
getMenuCode
());
data
.
put
(
"parentCode"
,
menuDTO
.
getParentCode
());
data
.
put
(
"menuVersion"
,
menuDTO
.
getMenuVersion
(
));
data
.
put
(
"menuVersion"
,
getMenuVersionStr
(
menuDTO
.
getMenuVersion
()
));
List
<
Map
<
String
,
Object
>>
children
=
changeListToTree
(
menuDTO
.
getMenuId
(),
list
);
if
(
children
==
null
||
children
.
size
()
<
1
)
{
data
.
put
(
"children"
,
null
);
...
...
@@ -145,4 +147,20 @@ public class MenuController {
}
return
result
;
}
private
static
String
getMenuVersionStr
(
String
menuVersion
)
{
if
(
StringUtils
.
isBlank
(
menuVersion
))
{
return
null
;
}
String
[]
menuVersionArr
=
menuVersion
.
split
(
"_"
);
StringBuilder
result
=
new
StringBuilder
();
for
(
String
str
:
menuVersionArr
)
{
if
(
StringUtils
.
isBlank
(
str
))
{
continue
;
}
result
.
append
(
GicVersionEnum
.
getMessageByCode
(
Integer
.
parseInt
(
str
))).
append
(
"/"
);
}
String
menuVersionStr
=
result
.
toString
();
return
menuVersionStr
.
substring
(
0
,
menuVersionStr
.
length
()
-
1
);
}
}
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