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
00443488
Commit
00443488
authored
Nov 06, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
协作人详情添加字段:资源组
parent
ea750159
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
21 deletions
+73
-21
TabSysCollaborator.java
...src/main/java/com/gic/auth/entity/TabSysCollaborator.java
+14
-0
CollaboratorApiServiceImpl.java
...c/auth/service/outer/impl/CollaboratorApiServiceImpl.java
+43
-16
TabSysCollaboratorMapper.xml
...ce/src/main/resources/mapper/TabSysCollaboratorMapper.xml
+14
-3
CollaboratorController.java
...a/com/gic/auth/web/controller/CollaboratorController.java
+2
-2
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysCollaborator.java
View file @
00443488
...
...
@@ -47,6 +47,11 @@ public class TabSysCollaborator {
private
String
creator
;
/**
* 资源组ids,可以多选,_隔开,类似_1_2_'
*/
private
String
resourceIds
;
/**
* 子应用ids,可以多选,用_隔开_2_3_
*/
private
String
subAppIds
;
...
...
@@ -161,4 +166,12 @@ public class TabSysCollaborator {
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
public
String
getResourceIds
()
{
return
resourceIds
;
}
public
void
setResourceIds
(
String
resourceIds
)
{
this
.
resourceIds
=
resourceIds
;
}
}
\ No newline at end of file
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/CollaboratorApiServiceImpl.java
View file @
00443488
...
...
@@ -143,12 +143,10 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
result
.
setMenuIdList
(
menuIdList
);
}
if
(
StringUtils
.
isNotBlank
(
result
.
getSubAppIds
()))
{
String
[]
subAppArr
=
result
.
getSubAppIds
().
split
(
SignConstants
.
UNDERLINE
);
List
<
String
>
subAppList
=
new
ArrayList
<>(
subAppArr
.
length
);
for
(
String
subApp
:
subAppArr
)
{
subAppList
.
add
(
subApp
);
}
result
.
setSubAppIdList
(
subAppList
);
result
.
setSubAppIdList
(
strToList
(
result
.
getSubAppIds
()));
}
if
(
StringUtils
.
isNotBlank
(
result
.
getResourceIds
()))
{
result
.
setResourceIdList
(
strToListOfInteger
(
result
.
getResourceIds
()));
}
ServiceResponse
<
EnterpriseDTO
>
enterpriseResult
=
enterpriseApiService
.
getEnterpriseById
(
record
.
getCollaborationEnterpriseId
());
...
...
@@ -160,23 +158,21 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
ServiceResponse
<
Void
>
auth
(
String
subAppIds
,
String
menuIds
,
Integer
collaboratorId
)
{
public
ServiceResponse
<
Void
>
auth
(
String
subAppIds
,
String
menuIds
,
String
resourcesIds
,
Integer
collaboratorId
)
{
TabSysCollaborator
record
=
collaboratorService
.
getById
(
collaboratorId
);
if
(
record
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"协作人ID有误,查无数据"
);
}
CollaboratorDTO
dto
=
new
CollaboratorDTO
();
//更新资源权限
if
(
StringUtils
.
isNotBlank
(
subAppIds
))
{
String
[]
subAppArr
=
subAppIds
.
split
(
SignConstants
.
COMMA
);
StringBuilder
sb
=
new
StringBuilder
(
SignConstants
.
UNDERLINE
);
for
(
String
str
:
subAppArr
)
{
sb
.
append
(
str
).
append
(
SignConstants
.
UNDERLINE
);
}
CollaboratorDTO
dto
=
new
CollaboratorDTO
();
dto
.
setCollaboratorId
(
collaboratorId
);
dto
.
setSubAppIds
(
sb
.
toString
());
collaboratorService
.
update
(
dto
);
dto
.
setSubAppIds
(
commaToUnderline
(
subAppIds
));
}
if
(
StringUtils
.
isNotBlank
(
resourcesIds
))
{
dto
.
setResourceIds
(
commaToUnderline
(
resourcesIds
));
}
dto
.
setCollaboratorId
(
collaboratorId
);
collaboratorService
.
update
(
dto
);
//更新操作权限
if
(
StringUtils
.
isNotBlank
(
menuIds
))
{
String
[]
menuIdArr
=
menuIds
.
split
(
SignConstants
.
COMMA
);
...
...
@@ -209,4 +205,35 @@ public class CollaboratorApiServiceImpl implements CollaboratorApiService {
collaboratorService
.
update
(
dto
);
return
ServiceResponse
.
success
();
}
/**
* 英文逗号隔开的字符串转为下划线隔开
* @param string
* @return
*/
private
static
String
commaToUnderline
(
String
string
)
{
String
[]
strArr
=
string
.
split
(
SignConstants
.
COMMA
);
StringBuilder
sb
=
new
StringBuilder
(
SignConstants
.
UNDERLINE
);
for
(
String
str
:
strArr
)
{
sb
.
append
(
str
).
append
(
SignConstants
.
UNDERLINE
);
}
return
sb
.
toString
();
}
private
static
List
<
String
>
strToList
(
String
string
)
{
String
[]
strArr
=
string
.
split
(
SignConstants
.
UNDERLINE
);
List
<
String
>
list
=
new
ArrayList
<>(
strArr
.
length
);
for
(
String
str
:
strArr
)
{
list
.
add
(
str
);
}
return
list
;
}
private
static
List
<
Integer
>
strToListOfInteger
(
String
string
)
{
String
[]
strArr
=
string
.
split
(
SignConstants
.
UNDERLINE
);
List
<
Integer
>
list
=
new
ArrayList
<>(
strArr
.
length
);
for
(
String
str
:
strArr
)
{
list
.
add
(
Integer
.
parseInt
(
str
));
}
return
list
;
}
}
gic-platform-auth-service/src/main/resources/mapper/TabSysCollaboratorMapper.xml
View file @
00443488
...
...
@@ -10,6 +10,7 @@
<result
column=
"app_id"
jdbcType=
"VARCHAR"
property=
"appId"
/>
<result
column=
"app_name"
jdbcType=
"VARCHAR"
property=
"appName"
/>
<result
column=
"creator"
jdbcType=
"VARCHAR"
property=
"creator"
/>
<result
column=
"resource_ids"
jdbcType=
"VARCHAR"
property=
"resourceIds"
/>
<result
column=
"sub_app_ids"
jdbcType=
"VARCHAR"
property=
"subAppIds"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
...
...
@@ -17,7 +18,7 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
collaborator_id, collaborator_name, enterprise_id, collaboration_enterprise_id, phone,
app_id, app_name, creator, sub_app_ids, status, create_time, update_time
app_id, app_name, creator,
resource_ids,
sub_app_ids, status, create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
...
...
@@ -33,12 +34,12 @@
insert into tab_sys_collaborator (collaborator_id, collaborator_name,
enterprise_id, collaboration_enterprise_id,
phone, app_id, app_name,
creator,
sub_app_ids, status,
creator,
resource_ids, sub_app_ids, status,
create_time, update_time)
values (#{collaboratorId,jdbcType=INTEGER}, #{collaboratorName,jdbcType=VARCHAR},
#{enterpriseId,jdbcType=INTEGER}, #{collaborationEnterpriseId,jdbcType=INTEGER},
#{phone,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR}, #{appName,jdbcType=VARCHAR},
#{creator,jdbcType=VARCHAR}, #{
subAppIds,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{creator,jdbcType=VARCHAR}, #{
resourceIds,jdbcType=VARCHAR}, #{subAppIds,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.auth.entity.TabSysCollaborator"
useGeneratedKeys=
"true"
keyProperty=
"collaboratorId"
>
...
...
@@ -68,6 +69,9 @@
<if
test=
"creator != null"
>
creator,
</if>
<if
test=
"resourceIds != null"
>
resource_ids,
</if>
<if
test=
"subAppIds != null"
>
sub_app_ids,
</if>
...
...
@@ -106,6 +110,9 @@
<if
test=
"creator != null"
>
#{creator,jdbcType=VARCHAR},
</if>
<if
test=
"resourceIds != null"
>
#{resourceIds,jdbcType=VARCHAR},
</if>
<if
test=
"subAppIds != null"
>
#{subAppIds,jdbcType=VARCHAR},
</if>
...
...
@@ -144,6 +151,9 @@
<if
test=
"creator != null"
>
creator = #{creator,jdbcType=VARCHAR},
</if>
<if
test=
"resourceIds != null"
>
resource_ids = #{resourceIds,jdbcType=VARCHAR},
</if>
<if
test=
"subAppIds != null"
>
sub_app_ids = #{subAppIds,jdbcType=VARCHAR},
</if>
...
...
@@ -168,6 +178,7 @@
app_id = #{appId,jdbcType=VARCHAR},
app_name = #{appName,jdbcType=VARCHAR},
creator = #{creator,jdbcType=VARCHAR},
resource_ids = #{resourceIds,jdbcType=VARCHAR},
sub_app_ids = #{subAppIds,jdbcType=VARCHAR},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/CollaboratorController.java
View file @
00443488
...
...
@@ -120,9 +120,9 @@ public class CollaboratorController extends DownloadUtils{
* @return com.gic.commons.webapi.reponse.RestResponse
*/
@RequestMapping
(
"/auth"
)
public
RestResponse
auth
(
String
subAppIds
,
String
menuIds
,
Integer
collaboratorId
)
{
public
RestResponse
auth
(
String
subAppIds
,
String
menuIds
,
String
resourceIds
,
Integer
collaboratorId
)
{
return
ResultControllerUtils
.
commonResult
(
collaboratorApiService
.
auth
(
subAppIds
,
menuIds
,
collaboratorId
));
collaboratorApiService
.
auth
(
subAppIds
,
menuIds
,
resourceIds
,
collaboratorId
));
}
@RequestMapping
(
"/app-menu-tree"
)
...
...
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