Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
api-service-gateway
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱允伟
api-service-gateway
Commits
3371d19a
Commit
3371d19a
authored
Oct 13, 2021
by
李欣峰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
<dev>
1.新增删除api接口时,如果该api存在设置的权限,提示不可删除,请删除权限后再删除
parent
23a76368
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
api-service-project/api-service-application/src/main/java/com/zorkdata/apiservice/application/impl/ApiServiceApplicationImpl.java
...piservice/application/impl/ApiServiceApplicationImpl.java
+9
-1
api-service-project/api-service-domain/src/main/java/com/zorkdata/apiservice/domain/repository/ApiAuthRepository.java
...kdata/apiservice/domain/repository/ApiAuthRepository.java
+11
-1
No files found.
api-service-project/api-service-application/src/main/java/com/zorkdata/apiservice/application/impl/ApiServiceApplicationImpl.java
View file @
3371d19a
...
...
@@ -315,9 +315,17 @@ public class ApiServiceApplicationImpl implements ApiApplication {
InvokeResult
invokeResult
;
api
.
setId
(
id
);
try
{
//
删除接口分组,查询该id的分组是否存在parentId,如果没有可以删除,如果存在不能删除
//
查看API表是否存在id,非空判断 count>0,说明存在
Integer
count
=
apiRepository
.
selectCountFromId
(
id
);
if
(
count
>
0
)
{
//判断该api是否设置了权限,如果设置了权限,不能删除
Integer
count2
=
apiAuthRepository
.
findAuthApiIdById
(
id
);
if
(
count2
>
0
)
{
log
.
error
(
"该Api存在权限,请删除权限后再删除!"
);
invokeResult
=
InvokeResult
.
fail
();
invokeResult
.
setMessage
(
"该Api存在权限,请删除权限后再删除!"
);
return
invokeResult
;
}
apiRepository
.
delete
(
api
);
}
else
{
log
.
error
(
"删除Api接口失败!"
);
...
...
api-service-project/api-service-domain/src/main/java/com/zorkdata/apiservice/domain/repository/ApiAuthRepository.java
View file @
3371d19a
...
...
@@ -63,5 +63,15 @@ public interface ApiAuthRepository extends JpaRepository<ApiAuth, Integer>, JpaS
* @return
*/
@Query
(
value
=
"select start_time , end_time from api_auth where api_id= ?1 and user_id = ?2"
,
nativeQuery
=
true
)
Map
<
Date
,
Date
>
findApiAuthByApiId
(
Integer
apiId
,
Integer
userid
);
Map
<
Date
,
Date
>
findApiAuthByApiId
(
Integer
apiId
,
Integer
userid
);
/**
* 根据apiid查询ApiAuth里是否存在权限
*
* @param id
* @return
*/
@Query
(
value
=
"select count(*) from api_auth where api_id= ?1"
,
nativeQuery
=
true
)
Integer
findAuthApiIdById
(
Integer
id
);
}
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