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
96d49375
Commit
96d49375
authored
Sep 03, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色菜单权限接口
parent
b3fe64e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
+26
-10
TabSysRole.java
...service/src/main/java/com/gic/auth/entity/TabSysRole.java
+3
-3
UserApiServiceImpl.java
...a/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
+18
-2
TabSysRoleMapper.xml
...th-service/src/main/resources/mapper/TabSysRoleMapper.xml
+5
-5
No files found.
gic-platform-auth-service/src/main/java/com/gic/auth/entity/TabSysRole.java
View file @
96d49375
...
...
@@ -14,7 +14,7 @@ public class TabSysRole {
/**
* 管理员角色名称
*/
private
Integer
roleName
;
private
String
roleName
;
/**
* 企业ID
...
...
@@ -44,11 +44,11 @@ public class TabSysRole {
this
.
roleId
=
roleId
;
}
public
Integer
getRoleName
()
{
public
String
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
Integer
roleName
)
{
public
void
setRoleName
(
String
roleName
)
{
this
.
roleName
=
roleName
;
}
...
...
gic-platform-auth-service/src/main/java/com/gic/auth/service/outer/impl/UserApiServiceImpl.java
View file @
96d49375
...
...
@@ -3,6 +3,8 @@ package com.gic.auth.service.outer.impl;
import
java.util.Date
;
import
java.util.List
;
import
com.gic.auth.entity.TabSysResource
;
import
com.gic.auth.entity.TabSysRole
;
import
com.gic.auth.utils.ValidSplitUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
@@ -41,6 +43,10 @@ public class UserApiServiceImpl implements UserApiService {
private
UserRoleService
userRoleService
;
@Autowired
private
UserResourceService
userResourceService
;
@Autowired
private
ResourceService
resourceService
;
@Autowired
private
RoleService
roleService
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
...
...
@@ -201,7 +207,12 @@ public class UserApiServiceImpl implements UserApiService {
userRoleDTO
.
setEnterpriseId
(
enterpriseId
);
userRoleDTO
.
setUserId
(
userId
);
for
(
String
userRole
:
userRoleIdArr
)
{
userRoleDTO
.
setRoleId
(
Integer
.
parseInt
(
userRole
));
int
roleId
=
Integer
.
parseInt
(
userRole
);
TabSysRole
tabSysRole
=
roleService
.
getById
(
roleId
);
if
(
tabSysRole
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"角色数据有误,无此角色数据"
);
}
userRoleDTO
.
setRoleId
(
roleId
);
ServiceResponse
result
=
userRoleApiService
.
save
(
userRoleDTO
);
if
(!
result
.
isSuccess
())
{
return
result
;
...
...
@@ -212,7 +223,12 @@ public class UserApiServiceImpl implements UserApiService {
userResourceDTO
.
setUserId
(
userId
);
userResourceDTO
.
setEnterpriseId
(
enterpriseId
);
for
(
String
userResource
:
userResourceIdArr
)
{
userResourceDTO
.
setResourceId
(
Integer
.
parseInt
(
userResource
));
int
resourceId
=
Integer
.
parseInt
(
userResource
);
TabSysResource
tabSysResource
=
resourceService
.
getResource
(
resourceId
);
if
(
tabSysResource
==
null
)
{
return
ServiceResponse
.
failure
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"资源数据有误,无此资源数据"
);
}
userResourceDTO
.
setResourceId
(
resourceId
);
ServiceResponse
result
=
userResourceApiService
.
save
(
userResourceDTO
);
if
(!
result
.
isSuccess
())
{
return
result
;
...
...
gic-platform-auth-service/src/main/resources/mapper/TabSysRoleMapper.xml
View file @
96d49375
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"com.gic.auth.dao.mapper.TabSysRoleMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.auth.entity.TabSysRole"
>
<id
column=
"role_id"
jdbcType=
"INTEGER"
property=
"roleId"
/>
<result
column=
"role_name"
jdbcType=
"
INTEGE
R"
property=
"roleName"
/>
<result
column=
"role_name"
jdbcType=
"
VARCHA
R"
property=
"roleName"
/>
<result
column=
"enterprise_id"
jdbcType=
"INTEGER"
property=
"enterpriseId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
...
...
@@ -26,7 +26,7 @@
insert into tab_sys_role (role_id, role_name, enterprise_id,
status, create_time, update_time
)
values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=
INTEGER}, #{enterpriseId,jdbcType=INTEGER},
values (#{roleId,jdbcType=INTEGER}, #{roleName,jdbcType=
VARCHAR}, #{enterpriseId,jdbcType=INTEGER},
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
...
...
@@ -57,7 +57,7 @@
#{roleId,jdbcType=INTEGER},
</if>
<if
test=
"roleName != null"
>
#{roleName,jdbcType=
INTEGE
R},
#{roleName,jdbcType=
VARCHA
R},
</if>
<if
test=
"enterpriseId != null"
>
#{enterpriseId,jdbcType=INTEGER},
...
...
@@ -77,7 +77,7 @@
update tab_sys_role
<set>
<if
test=
"roleName != null"
>
role_name = #{roleName,jdbcType=
INTEGE
R},
role_name = #{roleName,jdbcType=
VARCHA
R},
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
...
...
@@ -96,7 +96,7 @@
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.auth.entity.TabSysRole"
>
update tab_sys_role
set role_name = #{roleName,jdbcType=
INTEGE
R},
set role_name = #{roleName,jdbcType=
VARCHA
R},
enterprise_id = #{enterpriseId,jdbcType=INTEGER},
status = #{status,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
...
...
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