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
7b5813bb
Commit
7b5813bb
authored
Sep 03, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色菜单权限接口
parent
12fae90c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
9 deletions
+116
-9
TabSysUserMapper.xml
...th-service/src/main/resources/mapper/TabSysUserMapper.xml
+2
-2
RoleController.java
...main/java/com/gic/auth/web/controller/RoleController.java
+44
-0
UserController.java
...main/java/com/gic/auth/web/controller/UserController.java
+1
-2
UserPasswordUtils.java
...c/main/java/com/gic/auth/web/utils/UserPasswordUtils.java
+3
-5
RoleDetailVO.java
...h-web/src/main/java/com/gic/auth/web/vo/RoleDetailVO.java
+53
-0
UserDetailVO.java
...h-web/src/main/java/com/gic/auth/web/vo/UserDetailVO.java
+13
-0
No files found.
gic-platform-auth-service/src/main/resources/mapper/TabSysUserMapper.xml
View file @
7b5813bb
...
...
@@ -219,8 +219,8 @@
a.user_name userName,
a.phone_number phoneNumber,
a.phone_area_code phoneAreaCode,
GROUP_CONCAT(b.role_id) userRoleId
s,
GROUP_CONCAT(c.resource_id) userResourceId
s
(select GROUP_CONCAT(role_name separator '/') from tab_sys_role where role_id in (GROUP_CONCAT(b.role_id))) userRoleName
s,
(select GROUP_CONCAT(resource_name separator '/') from tab_sys_resource where resource_id in (GROUP_CONCAT(c.resource_id))) userResourceName
s
from tab_sys_user a
left join tab_sys_user_role b on a.user_id = b.user_id
left join tab_sys_user_resource c on a.user_id = c.user_id
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/RoleController.java
0 → 100644
View file @
7b5813bb
package
com
.
gic
.
auth
.
web
.
controller
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.gic.auth.dto.RoleDTO
;
import
com.gic.auth.qo.RoleListQO
;
import
com.gic.auth.service.RoleApiService
;
import
com.gic.auth.web.vo.RoleDetailVO
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.enterprise.utils.ResultControllerUtils
;
@RestController
@RequestMapping
(
"/role"
)
public
class
RoleController
{
@Autowired
private
RoleApiService
roleApiService
;
@RequestMapping
(
"/get-detail"
)
public
RestResponse
getDetail
(
Integer
id
)
{
return
ResultControllerUtils
.
commonResultOne
(
roleApiService
.
getById
(
id
),
RoleDetailVO
.
class
);
}
@RequestMapping
(
"/save"
)
public
RestResponse
save
(
RoleDTO
dto
)
{
dto
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonResult
(
roleApiService
.
save
(
dto
));
}
@RequestMapping
(
"/update"
)
public
RestResponse
update
(
RoleDTO
dto
)
{
dto
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonResult
(
roleApiService
.
update
(
dto
));
}
@RequestMapping
(
"/list-role"
)
public
RestResponse
listRole
(
RoleListQO
params
)
{
params
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
ResultControllerUtils
.
commonResult
(
roleApiService
.
pageRole
(
params
));
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/controller/UserController.java
View file @
7b5813bb
...
...
@@ -30,8 +30,7 @@ public class UserController {
@RequestMapping
(
"/save-or-update-user"
)
public
RestResponse
editUser
(
@Validated
({
UserDTO
.
UserQoValid
.
class
})
UserDTO
userDTO
)
{
userDTO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
String
password
=
UserPasswordUtils
.
validPassword
(
userDTO
.
getPasswordType
(),
userDTO
.
getPassword
(),
userDTO
.
getConfirmPassword
());
String
password
=
UserPasswordUtils
.
validPassword
(
userDTO
.
getPasswordType
(),
userDTO
.
getPassword
());
userDTO
.
setPassword
(
UserPasswordUtils
.
getEncryptPassword
(
password
));
ServiceResponse
userResult
;
//普通用户
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/utils/UserPasswordUtils.java
View file @
7b5813bb
...
...
@@ -43,20 +43,18 @@ public class UserPasswordUtils {
* 获取密码
* @param passwordType
* @param password
* @param confirmPassword
* @return
*/
public
static
String
validPassword
(
int
passwordType
,
String
password
,
String
confirmPassword
)
{
public
static
String
validPassword
(
int
passwordType
,
String
password
)
{
//加密
if
(
UserConstants
.
CREATE_AUTO
==
passwordType
)
{
//自动随机生成
return
createPasswordAuto
(
8
);
}
else
{
if
(
StringUtils
.
isNotBlank
(
password
)
&&
password
.
equals
(
confirmPassword
))
{
//如果一致
if
(
StringUtils
.
isNotBlank
(
password
))
{
return
password
;
}
else
{
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"密码不
一致
"
);
throw
new
CommonException
(
ErrorCode
.
PARAMETER_ERROR
.
getCode
(),
"密码不
能为空
"
);
}
}
}
...
...
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/RoleDetailVO.java
0 → 100644
View file @
7b5813bb
package
com
.
gic
.
auth
.
web
.
vo
;
import
java.io.Serializable
;
/**
* 角色详情
* @ClassName: RoleDetailVO
* @Description:
* @author guojuxing
* @date 2019/9/3 2:54 PM
*/
public
class
RoleDetailVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
18646904997204432L
;
/**
* id
*/
private
Integer
roleId
;
/**
* 管理员角色名称
*/
private
Integer
roleName
;
/**
* 菜单ID,多个时,用英文逗号隔开
*/
private
String
menuIds
;
public
Integer
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
Integer
roleId
)
{
this
.
roleId
=
roleId
;
}
public
Integer
getRoleName
()
{
return
roleName
;
}
public
void
setRoleName
(
Integer
roleName
)
{
this
.
roleName
=
roleName
;
}
public
String
getMenuIds
()
{
return
menuIds
;
}
public
void
setMenuIds
(
String
menuIds
)
{
this
.
menuIds
=
menuIds
;
}
}
gic-platform-auth-web/src/main/java/com/gic/auth/web/vo/UserDetailVO.java
View file @
7b5813bb
...
...
@@ -50,6 +50,11 @@ public class UserDetailVO implements Serializable{
*/
private
String
userResourceIds
;
/**
* 1:自动生成 2:自定义密码
*/
private
Integer
passwordType
;
public
Integer
getUserId
()
{
return
userId
;
}
...
...
@@ -113,4 +118,12 @@ public class UserDetailVO implements Serializable{
public
void
setUserResourceIds
(
String
userResourceIds
)
{
this
.
userResourceIds
=
userResourceIds
;
}
public
Integer
getPasswordType
()
{
return
passwordType
;
}
public
void
setPasswordType
(
Integer
passwordType
)
{
this
.
passwordType
=
passwordType
;
}
}
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