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
7224614c
Commit
7224614c
authored
Sep 27, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加判断code不能重复
parent
b8389d07
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
6 deletions
+22
-6
TabSysMenuMapper.java
...c/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
+2
-1
MenuService.java
...rvice/src/main/java/com/gic/auth/service/MenuService.java
+1
-1
MenuServiceImpl.java
.../main/java/com/gic/auth/service/impl/MenuServiceImpl.java
+2
-2
MenuApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
+13
-2
TabSysMenuMapper.xml
...th-service/src/main/resources/mapper/TabSysMenuMapper.xml
+4
-0
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/dao/mapper/TabSysMenuMapper.java
View file @
7224614c
...
...
@@ -155,5 +155,5 @@ public interface TabSysMenuMapper {
* @param menuCode
* @return int
*/
int
countByMenuCode
(
@Param
(
"menuCode"
)
String
menuCode
);
int
countByMenuCode
(
@Param
(
"menuCode"
)
String
menuCode
,
@Param
(
"menuId"
)
Integer
menuId
);
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/MenuService.java
View file @
7224614c
...
...
@@ -133,5 +133,5 @@ public interface MenuService {
* @param code
* @return boolean
*/
boolean
isRepeatMenuCode
(
String
code
);
boolean
isRepeatMenuCode
(
String
code
,
Integer
menuId
);
}
gic-platform-auth-service/src/main/java/com/gic/auth/service/impl/MenuServiceImpl.java
View file @
7224614c
...
...
@@ -131,8 +131,8 @@ public class MenuServiceImpl implements MenuService {
}
@Override
public
boolean
isRepeatMenuCode
(
String
code
)
{
int
count
=
tabSysMenuMapper
.
countByMenuCode
(
code
);
public
boolean
isRepeatMenuCode
(
String
code
,
Integer
menuId
)
{
int
count
=
tabSysMenuMapper
.
countByMenuCode
(
code
,
menuId
);
if
(
count
>
0
)
{
return
true
;
}
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/MenuApiServiceImpl.java
View file @
7224614c
...
...
@@ -220,6 +220,11 @@ public class MenuApiServiceImpl implements MenuApiService {
if
(!
paramsValid
.
isSuccess
())
{
return
paramsValid
;
}
//验证code是否重复
if
(
menuService
.
isRepeatMenuCode
(
menuDTO
.
getMenuCode
(),
menuDTO
.
getMenuId
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"code:"
+
menuDTO
.
getMenuCode
()
+
"重复"
);
}
menuService
.
updatePage
(
menuDTO
);
return
ServiceResponse
.
success
();
}
...
...
@@ -408,7 +413,7 @@ public class MenuApiServiceImpl implements MenuApiService {
return
paramsValid
;
}
//验证code是否重复
if
(
menuService
.
isRepeatMenuCode
(
menuDTO
.
getMenuCode
()))
{
if
(
menuService
.
isRepeatMenuCode
(
menuDTO
.
getMenuCode
()
,
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"code:"
+
menuDTO
.
getMenuCode
()
+
"重复"
);
}
...
...
@@ -428,7 +433,7 @@ public class MenuApiServiceImpl implements MenuApiService {
return
paramsValid
;
}
//验证code是否重复
if
(
menuService
.
isRepeatMenuCode
(
menuDTO
.
getMenuCode
()))
{
if
(
menuService
.
isRepeatMenuCode
(
menuDTO
.
getMenuCode
()
,
null
))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"code:"
+
menuDTO
.
getMenuCode
()
+
"重复"
);
}
...
...
@@ -475,6 +480,12 @@ public class MenuApiServiceImpl implements MenuApiService {
if
(!
paramsValid
.
isSuccess
())
{
return
paramsValid
;
}
//验证code是否重复
if
(
menuService
.
isRepeatMenuCode
(
menuDTO
.
getMenuCode
(),
menuDTO
.
getMenuId
()))
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"code:"
+
menuDTO
.
getMenuCode
()
+
"重复"
);
}
menuDTO
.
setProject
(
record
.
getProject
());
if
(!
MenuProjectConstants
.
DEFAULT_PROJECT
.
equals
(
menuDTO
.
getProject
()))
{
//如果是应用子页面、操作项
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysMenuMapper.xml
View file @
7224614c
...
...
@@ -396,5 +396,8 @@
SELECT count(1) from tab_sys_menu
where status = 1
menu_code = #{menuCode}
<if
test=
"menuId != null"
>
menu_id
<>
#{menuId}
</if>
</select>
</mapper>
\ No newline at end of file
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