Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
tcm-system
Project
Project
Details
Activity
Releases
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
TCM
tcm-system
Commits
65d90702
Commit
65d90702
authored
May 15, 2019
by
zjy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user/role/tright 5.15
个体用户还需要增加Token 准备企业用户注册 user/role/tright修改完
parent
fd52bb0e
Changes
46
Hide whitespace changes
Inline
Side-by-side
Showing
46 changed files
with
780 additions
and
656 deletions
+780
-656
readme.md
readme.md
+1
-1
AuthorityController.java
...angding/web/authority/controller/AuthorityController.java
+22
-34
ComputerRegisterController.java
.../web/authority/controller/ComputerRegisterController.java
+0
-1
MobileRegisterController.java
...ng/web/authority/controller/MobileRegisterController.java
+0
-1
RoleController.java
...com/pangding/web/authority/controller/RoleController.java
+22
-61
UserController.java
...com/pangding/web/authority/controller/UserController.java
+18
-77
AuthorityDao.java
...ain/java/com/pangding/web/authority/dao/AuthorityDao.java
+8
-3
RoleAuthorityDao.java
...java/com/pangding/web/authority/dao/RoleAuthorityDao.java
+4
-12
RoleDao.java
src/main/java/com/pangding/web/authority/dao/RoleDao.java
+9
-8
UserDao.java
src/main/java/com/pangding/web/authority/dao/UserDao.java
+8
-11
UserRoleDao.java
...main/java/com/pangding/web/authority/dao/UserRoleDao.java
+4
-12
AuthorityDaoImpl.java
...com/pangding/web/authority/dao/impl/AuthorityDaoImpl.java
+18
-4
RoleAuthorityDaoImpl.java
...pangding/web/authority/dao/impl/RoleAuthorityDaoImpl.java
+5
-12
RoleDaoImpl.java
...java/com/pangding/web/authority/dao/impl/RoleDaoImpl.java
+11
-9
UserDaoImpl.java
...java/com/pangding/web/authority/dao/impl/UserDaoImpl.java
+9
-10
UserRoleDaoImpl.java
.../com/pangding/web/authority/dao/impl/UserRoleDaoImpl.java
+5
-10
GetRoleAuthorityListByRoleIdReqVo.java
...eb/authority/reqvo/GetRoleAuthorityListByRoleIdReqVo.java
+0
-21
GetUserByCompanyIdReqVo.java
...pangding/web/authority/reqvo/GetUserByCompanyIdReqVo.java
+0
-17
GetUserByIdReqVo.java
...va/com/pangding/web/authority/reqvo/GetUserByIdReqVo.java
+0
-17
GetUserByPhoneReqVo.java
...com/pangding/web/authority/reqvo/GetUserByPhoneReqVo.java
+0
-17
GetUserRoleListByUserIdReqVo.java
...ing/web/authority/reqvo/GetUserRoleListByUserIdReqVo.java
+0
-17
AuthorityService.java
.../com/pangding/web/authority/service/AuthorityService.java
+10
-16
RoleService.java
.../java/com/pangding/web/authority/service/RoleService.java
+20
-12
UserService.java
.../java/com/pangding/web/authority/service/UserService.java
+16
-19
AuthorityServiceImpl.java
...ding/web/authority/service/impl/AuthorityServiceImpl.java
+61
-23
MobileRegisterServiceImpl.java
...web/authority/service/impl/MobileRegisterServiceImpl.java
+0
-2
RoleServiceImpl.java
.../pangding/web/authority/service/impl/RoleServiceImpl.java
+125
-68
UserServiceImpl.java
.../pangding/web/authority/service/impl/UserServiceImpl.java
+156
-68
Md5AndSalt.java
...ain/java/com/pangding/web/authority/utils/Md5AndSalt.java
+0
-61
RoleAuthorityVo.java
...n/java/com/pangding/web/authority/vo/RoleAuthorityVo.java
+1
-1
UserRoleVo.java
src/main/java/com/pangding/web/authority/vo/UserRoleVo.java
+1
-1
AuthorityGetReqVo.java
...om/pangding/web/authority/vo/reqvo/AuthorityGetReqVo.java
+27
-0
ListAuthorityReqVo.java
...m/pangding/web/authority/vo/reqvo/ListAuthorityReqVo.java
+19
-0
ListRoleReqVo.java
...va/com/pangding/web/authority/vo/reqvo/ListRoleReqVo.java
+10
-0
ListUserReqVo.java
...va/com/pangding/web/authority/vo/reqvo/ListUserReqVo.java
+10
-0
RoleAuthorityGetReqVo.java
...angding/web/authority/vo/reqvo/RoleAuthorityGetReqVo.java
+12
-2
RoleGetReqVo.java
...ava/com/pangding/web/authority/vo/reqvo/RoleGetReqVo.java
+27
-0
UserGetReqVo.java
...ava/com/pangding/web/authority/vo/reqvo/UserGetReqVo.java
+50
-0
UserRoleGetReqVo.java
...com/pangding/web/authority/vo/reqvo/UserRoleGetReqVo.java
+27
-0
UserRoleRemoveReqVo.java
.../pangding/web/authority/vo/reqvo/UserRoleRemoveReqVo.java
+2
-2
WebAuthorityReqVo.java
...om/pangding/web/authority/vo/reqvo/WebAuthorityReqVo.java
+3
-3
WebAuthorityResVo.java
...om/pangding/web/authority/vo/reqvo/WebAuthorityResVo.java
+11
-0
WebRoleReqVo.java
...ava/com/pangding/web/authority/vo/reqvo/WebRoleReqVo.java
+2
-12
WebRoleResVo.java
...ava/com/pangding/web/authority/vo/reqvo/WebRoleResVo.java
+22
-0
WebUserReqVo.java
...ava/com/pangding/web/authority/vo/reqvo/WebUserReqVo.java
+2
-11
WebUserResVo.java
...ava/com/pangding/web/authority/vo/reqvo/WebUserResVo.java
+22
-0
No files found.
readme.md
View file @
65d90702
...
@@ -147,7 +147,7 @@ StringHelper.md5(from)
...
@@ -147,7 +147,7 @@ StringHelper.md5(from)
# 如下代码需要调换顺序
# 如下代码需要调换顺序
```
java
```
java
List
<
RoleVo
>
roleVoList
=
roleServiceImpl
.
getRoleVoList
();
List
<
RoleVo
>
roleVoList
=
roleServiceImpl
.
getRoleVoList
();
List
<
RoleDto
>
roleDt
oList
=
new
ArrayList
(
roleVoList
.
size
());
// roleVoList有可能为null
List
<
RoleDto
>
webRoleReqV
oList
=
new
ArrayList
(
roleVoList
.
size
());
// roleVoList有可能为null
if
(
roleVoList
==
null
||
roleVoList
.
size
()
==
0
){
if
(
roleVoList
==
null
||
roleVoList
.
size
()
==
0
){
return
new
Result
(
0
,
"暂无角色信息"
,
null
);
return
new
Result
(
0
,
"暂无角色信息"
,
null
);
}
}
...
...
src/main/java/com/pangding/web/authority/controller/AuthorityController.java
View file @
65d90702
...
@@ -4,6 +4,11 @@ package com.pangding.web.authority.controller;
...
@@ -4,6 +4,11 @@ package com.pangding.web.authority.controller;
import
com.pangding.web.authority.currency.Result
;
import
com.pangding.web.authority.currency.Result
;
import
com.pangding.web.authority.service.AuthorityService
;
import
com.pangding.web.authority.service.AuthorityService
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.ListAuthorityReqVo
;
import
com.pangding.web.authority.vo.reqvo.WebAuthorityReqVo
;
import
com.pangding.web.authority.vo.reqvo.WebAuthorityResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -26,11 +31,9 @@ public class AuthorityController {
...
@@ -26,11 +31,9 @@ public class AuthorityController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveAuthority
(
@RequestBody
AuthorityVo
authorityVo
){
public
ResponseResult
saveAuthority
(
@RequestBody
AuthorityVo
authorityVo
){
authorityServiceImpl
.
checkValid
(
authorityVo
);
authorityServiceImpl
.
save
(
authorityVo
);
authorityServiceImpl
.
save
(
authorityVo
);
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
null
);
return
new
ResponseResult
();
return
result
;
}
}
/**
/**
...
@@ -39,11 +42,9 @@ public class AuthorityController {
...
@@ -39,11 +42,9 @@ public class AuthorityController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
updateAuthority
(
@RequestBody
AuthorityVo
authorityVo
){
public
ResponseResult
updateAuthority
(
@RequestBody
AuthorityVo
authorityVo
){
authorityServiceImpl
.
checkValid
(
authorityVo
);
authorityServiceImpl
.
update
(
authorityVo
);
authorityServiceImpl
.
update
(
authorityVo
);
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
null
);
return
new
ResponseResult
();
return
result
;
}
}
/**
/**
...
@@ -51,12 +52,8 @@ public class AuthorityController {
...
@@ -51,12 +52,8 @@ public class AuthorityController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
listAuthoritys
(){
public
ResponseResult
<
PageSizeData
<
WebAuthorityResVo
>>
listAuthoritys
(
ListAuthorityReqVo
reqVo
){
List
<
AuthorityVo
>
list
=
authorityServiceImpl
.
listAllAuthority
();
return
ResponseResult
.
result
(
authorityServiceImpl
.
getWebAuthorityResVoList
(
reqVo
));
if
(
list
==
null
){
return
new
Result
(
4001
,
"暂无权限,请先添加"
,
null
);
}
return
new
Result
(
0
,
"SUCCESS"
,
list
);
}
}
/**
/**
...
@@ -64,38 +61,29 @@ public class AuthorityController {
...
@@ -64,38 +61,29 @@ public class AuthorityController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/firstLevel"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/firstLevel"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
parentAuthoritys
(){
public
ResponseResult
<
PageSizeData
<
WebAuthorityResVo
>>
parentAuthoritys
(
ListAuthorityReqVo
reqVo
){
List
<
AuthorityVo
>
list
=
authorityServiceImpl
.
listLevel1
();
return
ResponseResult
.
result
(
authorityServiceImpl
.
getWebAuthorityResVoList
(
reqVo
));
if
(
list
==
null
){
return
new
Result
(
4001
,
"暂无一级权限,请先添加"
,
null
);
}
return
new
Result
(
0
,
"SUCCESS"
,
list
);
}
}
/**
/**
* 根据ID查询权限
* 根据ID查询权限
* @param
id
* @param
reqVo
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/role/{id}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/role"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
authority
(
@PathVariable
String
id
){
public
ResponseResult
<
AuthorityVo
>
authority
(
@RequestBody
WebAuthorityReqVo
reqVo
){
AuthorityVo
authorityVo
=
authorityServiceImpl
.
getAuthorityById
(
id
);
return
ResponseResult
.
result
(
authorityServiceImpl
.
getAuthorityById
(
reqVo
));
if
(
authorityVo
==
null
){
return
new
Result
(
4001
,
"未查询到该权限"
,
null
);
}
return
new
Result
(
0
,
"SUCCESS"
,
authorityVo
);
}
}
/**
/**
* 删除权限
* 删除权限
* @param
id
* @param
reqVo
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
delete
(
@PathVariable
String
id
){
public
ResponseResult
delete
(
@RequestBody
WebAuthorityReqVo
reqVo
){
authorityServiceImpl
.
deleteAuthorityById
(
reqVo
);
authorityServiceImpl
.
deleteAuthorityById
(
id
);
return
new
ResponseResult
();
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
}
}
}
...
...
src/main/java/com/pangding/web/authority/controller/ComputerRegisterController.java
View file @
65d90702
...
@@ -7,7 +7,6 @@ import com.pangding.web.authority.dto.RegisterIndividualDto;
...
@@ -7,7 +7,6 @@ import com.pangding.web.authority.dto.RegisterIndividualDto;
import
com.pangding.web.authority.dto.RegisterUserDto
;
import
com.pangding.web.authority.dto.RegisterUserDto
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.utils.Md5AndSalt
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.MobileLoginInfo
;
import
com.pangding.web.authority.vo.MobileLoginInfo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.UserVo
;
...
...
src/main/java/com/pangding/web/authority/controller/MobileRegisterController.java
View file @
65d90702
...
@@ -6,7 +6,6 @@ import com.pangding.web.authority.dto.RegisterUserDto;
...
@@ -6,7 +6,6 @@ import com.pangding.web.authority.dto.RegisterUserDto;
import
com.pangding.web.authority.cloudvo.MobileRegisterUserReturnVo
;
import
com.pangding.web.authority.cloudvo.MobileRegisterUserReturnVo
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.utils.Md5AndSalt
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.MobileLoginInfo
;
import
com.pangding.web.authority.vo.MobileLoginInfo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.UserVo
;
...
...
src/main/java/com/pangding/web/authority/controller/RoleController.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
controller
;
package
com
.
pangding
.
web
.
authority
.
controller
;
import
com.pangding.web.authority.
currency.Result
;
import
com.pangding.web.authority.
vo.reqvo.ListRoleReqVo
;
import
com.pangding.web.authority.
dto.RoleDt
o
;
import
com.pangding.web.authority.
vo.reqvo.WebRoleReqV
o
;
import
com.pangding.web.authority.service.RoleService
;
import
com.pangding.web.authority.service.RoleService
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.reqvo.WebRoleResVo
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* @author zhangjinyao
* @author zhangjinyao
...
@@ -25,30 +24,24 @@ public class RoleController {
...
@@ -25,30 +24,24 @@ public class RoleController {
/**
/**
* 新增角色
* 新增角色
* @param
roleDt
o
* @param
webRoleReqV
o
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveRole
(
@RequestBody
RoleDto
roleDto
){
public
ResponseResult
saveRole
(
@RequestBody
WebRoleReqVo
webRoleReqVo
){
RoleVo
roleVo
=
roleDto
;
roleServiceImpl
.
saveRole
(
webRoleReqVo
);
roleServiceImpl
.
checkNameExist
(
roleVo
);
return
new
ResponseResult
();
roleDto
.
setId
(
StringHelper
.
getNewID
());
roleServiceImpl
.
saveRole
(
roleDto
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
}
/**
/**
* 修改角色信息
* 修改角色信息
* @param
roleDt
o
* @param
webRoleReqV
o
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
updateRole
(
@RequestBody
RoleDto
roleDto
){
public
ResponseResult
updateRole
(
@RequestBody
WebRoleReqVo
webRoleReqVo
){
RoleVo
roleVo
=
roleDto
;
roleServiceImpl
.
updateRole
(
webRoleReqVo
);
roleServiceImpl
.
checkNameExist
(
roleVo
);
return
new
ResponseResult
();
roleServiceImpl
.
updateRole
(
roleDto
);
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
null
);
return
result
;
}
}
/**
/**
...
@@ -56,48 +49,18 @@ public class RoleController {
...
@@ -56,48 +49,18 @@ public class RoleController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
listRoles
(){
public
ResponseResult
<
PageSizeData
<
WebRoleResVo
>>
listRoles
(
@RequestBody
ListRoleReqVo
req
){
List
<
RoleVo
>
roleVoList
=
roleServiceImpl
.
getRoleVoList
();
return
ResponseResult
.
result
(
roleServiceImpl
.
getWebRoleResVoList
(
req
));
List
<
RoleDto
>
roleDtoList
=
new
ArrayList
(
roleVoList
.
size
());
if
(
roleVoList
==
null
||
roleVoList
.
size
()
==
0
){
return
new
Result
(
0
,
"暂无角色信息"
,
null
);
}
for
(
RoleVo
roleVo:
roleVoList
)
{
List
<
String
>
authorityIdList
=
roleServiceImpl
.
getAuthorityIdListByRoleId
(
roleVo
.
getId
());
List
<
String
>
authorityNameList
=
new
ArrayList
(
authorityIdList
.
size
());
for
(
String
authorityId:
authorityIdList
)
{
String
authorityName
=
roleServiceImpl
.
getAuthorityNameByAuthorityId
(
authorityId
);
authorityNameList
.
add
(
authorityName
);
}
RoleDto
roleDto
=
roleServiceImpl
.
makeRoleDto
(
roleVo
,
authorityIdList
,
authorityNameList
);
roleDtoList
.
add
(
roleDto
);
}
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
roleDtoList
);
return
result
;
}
}
/**
/**
* 根据ID查询角色
* 根据ID查询角色
* @param
* @param
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/role/{roleId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/role"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
getRoleById
(
@PathVariable
String
roleId
){
public
ResponseResult
<
WebRoleResVo
>
getRoleById
(
@RequestBody
WebRoleReqVo
webRoleReqVo
){
RoleVo
roleVo
=
roleServiceImpl
.
getRoleById
(
roleId
);
return
ResponseResult
.
result
(
roleServiceImpl
.
getRoleById
(
webRoleReqVo
));
if
(
roleVo
==
null
){
return
new
Result
(
4001
,
"未查询到该角色"
,
null
);
}
List
<
String
>
authorityIdList
=
roleServiceImpl
.
getAuthorityIdListByRoleId
(
roleId
);
List
<
String
>
authorityNameList
=
new
ArrayList
(
authorityIdList
.
size
());
for
(
String
authorityId:
authorityIdList
)
{
String
authorityName
=
roleServiceImpl
.
getAuthorityNameByAuthorityId
(
authorityId
);
authorityNameList
.
add
(
authorityName
);
}
RoleDto
roleDto
=
roleServiceImpl
.
makeRoleDto
(
roleVo
,
authorityIdList
,
authorityNameList
);
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
roleDto
);
return
result
;
}
}
/**
/**
...
@@ -105,11 +68,9 @@ public class RoleController {
...
@@ -105,11 +68,9 @@ public class RoleController {
* @param
* @param
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/delete/{roleId}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
delete
(
@PathVariable
String
roleId
){
public
ResponseResult
delete
(
@RequestBody
WebRoleReqVo
webRoleReqVo
){
RoleVo
roleVo
=
roleServiceImpl
.
getRoleById
(
roleId
);
roleServiceImpl
.
delete
(
webRoleReqVo
);
roleServiceImpl
.
deleteRole
(
roleVo
);
return
new
ResponseResult
();
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
null
);
return
result
;
}
}
}
}
src/main/java/com/pangding/web/authority/controller/UserController.java
View file @
65d90702
...
@@ -2,12 +2,12 @@ package com.pangding.web.authority.controller;
...
@@ -2,12 +2,12 @@ package com.pangding.web.authority.controller;
import
com.pangding.web.authority.currency.Result
;
import
com.pangding.web.authority.currency.Result
;
import
com.pangding.web.authority.dto.UserDto
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.reqvo.GetRoleByRoleIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByUserIdReqVo
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.vo.*
;
import
com.pangding.web.authority.vo.*
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
com.yanzuoguang.util.vo.ResponseResult
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -27,24 +27,13 @@ public class UserController {
...
@@ -27,24 +27,13 @@ public class UserController {
/**
/**
* 新增用户
* 新增用户
* @param
userDt
o
* @param
webUserReqV
o
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveUser
(
@RequestBody
UserDto
userDto
){
public
ResponseResult
saveUser
(
@RequestBody
WebUserReqVo
webUserReqVo
){
userServiceImpl
.
saveUser
(
webUserReqVo
);
if
(!
userServiceImpl
.
isValid
(
userDto
.
getAccount
())){
return
new
ResponseResult
();
return
new
Result
(
4001
,
"用户名由字母与数字组成,且不能为纯数字"
,
userDto
);
}
userServiceImpl
.
checkAccount
(
userDto
);
userServiceImpl
.
checkPhone
(
userDto
);
userDto
.
setRemark
(
userDto
.
getPassword
());
String
saltPassword
=
userServiceImpl
.
passwordEncoder
(
userDto
.
getPassword
());
userDto
.
setPassword
(
saltPassword
);
userDto
.
setId
(
StringHelper
.
getNewID
());
userServiceImpl
.
saveUser
(
userDto
);
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
null
);
return
result
;
}
}
/**
/**
...
@@ -53,48 +42,20 @@ public class UserController {
...
@@ -53,48 +42,20 @@ public class UserController {
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
updateUser
(
@RequestBody
UserDto
userDto
){
public
ResponseResult
updateUser
(
@RequestBody
WebUserReqVo
webUserReqVo
){
userServiceImpl
.
checkAccount
(
userDto
);
userServiceImpl
.
checkPhone
(
userDto
);
userDto
.
setRemark
(
userDto
.
getPassword
());
userServiceImpl
.
updateUser
(
webUserReqVo
);
userDto
.
setPassword
(
userServiceImpl
.
passwordEncoder
(
userDto
.
getPassword
()));
return
new
ResponseResult
();
userServiceImpl
.
updateUser
(
userDto
);
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
null
);
return
result
;
}
}
/**
/**
* 查询用户列表
* 查询用户列表
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
listUsers
(){
public
ResponseResult
<
PageSizeData
<
WebUserResVo
>>
listUsers
(
ListUserReqVo
reqVo
){
return
ResponseResult
.
result
(
userServiceImpl
.
getWebUserResVoList
(
reqVo
));
List
<
UserVo
>
userVoList
=
userServiceImpl
.
listUserVo
();
List
<
UserDto
>
userDtoList
=
new
ArrayList
(
userVoList
.
size
());
for
(
int
index1
=
0
;
index1
<
userVoList
.
size
();
index1
++){
UserVo
userVo
=
userVoList
.
get
(
index1
);
GetUserRoleListByUserIdReqVo
reqVo
=
new
GetUserRoleListByUserIdReqVo
();
reqVo
.
setUserId
(
userVo
.
getId
());
List
<
UserRoleRelation
>
userRole
=
userServiceImpl
.
listUserRoleListByUserId
(
reqVo
);
List
<
String
>
roleIdList
=
new
ArrayList
(
userRole
.
size
());
for
(
UserRoleRelation
userRoleRelation:
userRole
)
{
roleIdList
.
add
(
userRoleRelation
.
getRoleId
());
}
List
<
String
>
roleNameList
=
new
ArrayList
(
roleIdList
.
size
());
for
(
int
index2
=
0
;
index2
<
roleIdList
.
size
();
index2
++){
GetRoleByRoleIdReqVo
getRoleByRoleIdReqVo
=
new
GetRoleByRoleIdReqVo
();
getRoleByRoleIdReqVo
.
setId
(
roleIdList
.
get
(
index2
));
RoleVo
role
=
userServiceImpl
.
getRoleByRoleId
(
getRoleByRoleIdReqVo
);
roleNameList
.
add
(
role
.
getName
());
}
UserDto
userDto
=
userServiceImpl
.
makeUserDto
(
userVo
,
roleIdList
,
roleNameList
);
userDtoList
.
add
(
userDto
);
}
Result
result
=
new
Result
(
0
,
"SUCCESS"
,
userDtoList
);
return
result
;
}
}
/**
/**
...
@@ -102,29 +63,9 @@ public class UserController {
...
@@ -102,29 +63,9 @@ public class UserController {
* @param //id
* @param //id
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/user/{userId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
user
(
@PathVariable
String
userId
){
public
ResponseResult
<
WebUserResVo
>
user
(
@RequestBody
WebUserReqVo
webUserReqVo
){
return
ResponseResult
.
result
(
userServiceImpl
.
getUserById
(
webUserReqVo
.
getId
()));
UserVo
userVo
=
userServiceImpl
.
getUserById
(
userId
);
if
(
userVo
==
null
){
return
new
Result
(
4001
,
"该用户不存在"
,
null
);
}
GetUserRoleListByUserIdReqVo
reqVo
=
new
GetUserRoleListByUserIdReqVo
();
reqVo
.
setUserId
(
userVo
.
getId
());
List
<
UserRoleRelation
>
userRole
=
userServiceImpl
.
listUserRoleListByUserId
(
reqVo
);
List
<
String
>
roleIdList
=
new
ArrayList
(
userRole
.
size
());
for
(
UserRoleRelation
userRoleRelation:
userRole
)
{
roleIdList
.
add
(
userRoleRelation
.
getRoleId
());
}
List
<
String
>
roleNameList
=
new
ArrayList
(
roleIdList
.
size
());
for
(
int
index2
=
0
;
index2
<
roleIdList
.
size
();
index2
++){
GetRoleByRoleIdReqVo
getRoleByRoleIdReqVo
=
new
GetRoleByRoleIdReqVo
();
getRoleByRoleIdReqVo
.
setId
(
roleIdList
.
get
(
index2
));
RoleVo
role
=
userServiceImpl
.
getRoleByRoleId
(
getRoleByRoleIdReqVo
);
roleNameList
.
add
(
role
.
getName
());
}
UserDto
userDto
=
userServiceImpl
.
makeUserDto
(
userVo
,
roleIdList
,
roleNameList
);
return
new
Result
(
0
,
"SUCCESS"
,
userDto
);
}
}
}
}
src/main/java/com/pangding/web/authority/dao/AuthorityDao.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
;
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.
reqvo.GetAuthorityById
ReqVo
;
import
com.pangding.web.authority.
vo.reqvo.AuthorityGet
ReqVo
;
import
com.pangding.web.authority.reqvo.ListLevel1ReqVo
;
import
com.pangding.web.authority.reqvo.ListLevel1ReqVo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.ListAuthorityReqVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
import
java.util.List
;
...
@@ -22,11 +24,14 @@ public interface AuthorityDao extends BaseDao {
...
@@ -22,11 +24,14 @@ public interface AuthorityDao extends BaseDao {
/**
/**
* 根据主键获取authorityVo对象
* 根据主键获取authorityVo对象
*
*
* @param
getAuthorityById
ReqVo 主键
* @param
authorityGet
ReqVo 主键
* @return authorityVo对象
* @return authorityVo对象
*/
*/
AuthorityVo
getAuthority
ById
(
GetAuthorityByIdReqVo
getAuthorityById
ReqVo
);
AuthorityVo
getAuthority
(
AuthorityGetReqVo
authorityGet
ReqVo
);
PageSizeData
<
AuthorityVo
>
getAuthorityList
(
ListAuthorityReqVo
reqVo
);
List
<
AuthorityVo
>
getAuthoritys
(
AuthorityGetReqVo
reqVo
);
/**
/**
* 获取authorityVo对象列表
* 获取authorityVo对象列表
*
*
...
...
src/main/java/com/pangding/web/authority/dao/RoleAuthorityDao.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
;
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.reqvo.GetRoleAuthorityListByRoleIdReqVo
;
import
com.pangding.web.authority.vo.reqvo.RoleAuthorityGetReqVo
;
import
com.pangding.web.authority.reqvo.GetRoleAuthorityListByAuthorityIdReqVo
;
import
com.pangding.web.authority.vo.RoleAuthorityVo
;
import
com.pangding.web.authority.vo.RoleAuthorityRelation
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.dao.BaseDao
;
import
java.util.List
;
import
java.util.List
;
...
@@ -11,19 +10,12 @@ import java.util.List;
...
@@ -11,19 +10,12 @@ import java.util.List;
* @author zhangjinyao
* @author zhangjinyao
*/
*/
public
interface
RoleAuthorityDao
extends
BaseDao
{
public
interface
RoleAuthorityDao
extends
BaseDao
{
/**
* 通过角色id获取角色权限关系表对象列表
*
* @param getRoleAuthorityListByRoleIdReqVo 角色id
* @return 角色权限关系表主键列表
*/
List
<
RoleAuthorityRelation
>
getRoleAuthorityListByRoleId
(
GetRoleAuthorityListByRoleIdReqVo
getRoleAuthorityListByRoleIdReqVo
);
/**
/**
* 通过权限id获取角色权限关系表主键列表
* 通过权限id获取角色权限关系表主键列表
*
*
* @param
getRoleAuthorityListByAuthorityId
ReqVo 封装权限id
* @param
roleAuthorityGet
ReqVo 封装权限id
* @return 角色权限关系表主键列表
* @return 角色权限关系表主键列表
*/
*/
List
<
RoleAuthority
Relation
>
getRoleAuthorityListByAuthorityId
(
GetRoleAuthorityListByAuthorityIdReqVo
getRoleAuthorityListByAuthorityId
ReqVo
);
List
<
RoleAuthority
Vo
>
getRoleAuthorityList
(
RoleAuthorityGetReqVo
roleAuthorityGet
ReqVo
);
}
}
src/main/java/com/pangding/web/authority/dao/RoleDao.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
;
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.
reqvo.GetRoleByRoleId
ReqVo
;
import
com.pangding.web.authority.
vo.reqvo.ListRole
ReqVo
;
import
com.pangding.web.authority.
reqvo.GetRoleByRoleName
ReqVo
;
import
com.pangding.web.authority.
vo.reqvo.RoleGet
ReqVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,10 +16,10 @@ public interface RoleDao extends BaseDao {
...
@@ -15,10 +16,10 @@ public interface RoleDao extends BaseDao {
/**
/**
* 通过主键id获取RoleVo对象
* 通过主键id获取RoleVo对象
*
*
* @param
getRoleByRoleId
ReqVo getRoleByRoleIdReqVo对象
* @param
roleGet
ReqVo getRoleByRoleIdReqVo对象
* @return RoleVo对象
* @return RoleVo对象
*/
*/
RoleVo
getRoleById
(
GetRoleByRoleIdReqVo
getRoleByRoleId
ReqVo
);
RoleVo
getRoleById
(
RoleGetReqVo
roleGet
ReqVo
);
/**
/**
* 通过角色名查询RoleVo对象
* 通过角色名查询RoleVo对象
...
@@ -26,7 +27,7 @@ public interface RoleDao extends BaseDao {
...
@@ -26,7 +27,7 @@ public interface RoleDao extends BaseDao {
* @param getRoleByRoleNameReqVo 角色名
* @param getRoleByRoleNameReqVo 角色名
* @return RoleVo对象
* @return RoleVo对象
*/
*/
RoleVo
getRoleByRoleName
(
GetRoleByRoleName
ReqVo
getRoleByRoleNameReqVo
);
RoleVo
getRoleByRoleName
(
RoleGet
ReqVo
getRoleByRoleNameReqVo
);
/**
/**
* 检查用户名是否已存在
* 检查用户名是否已存在
...
@@ -43,14 +44,14 @@ public interface RoleDao extends BaseDao {
...
@@ -43,14 +44,14 @@ public interface RoleDao extends BaseDao {
*
*
* @return RoleVo对象列表
* @return RoleVo对象列表
*/
*/
List
<
RoleVo
>
getRoleVoList
(
);
PageSizeData
<
RoleVo
>
getRoleVoList
(
ListRoleReqVo
req
);
/**
/**
* 通过角色id获取子角色列表
* 通过角色id获取子角色列表
*
*
* @param
getRoleByRoleId
ReqVo 封装角色id
* @param
roleGet
ReqVo 封装角色id
* @return 角色列表
* @return 角色列表
*/
*/
List
<
RoleVo
>
getChild
(
GetRoleByRoleIdReqVo
getRoleByRoleId
ReqVo
);
List
<
RoleVo
>
getChild
(
RoleGetReqVo
roleGet
ReqVo
);
}
}
src/main/java/com/pangding/web/authority/dao/UserDao.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
;
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.reqvo.GetUserByCompanyIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByIdReqVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.reqvo.ListUserReqVo
;
import
com.pangding.web.authority.vo.reqvo.UserGetReqVo
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
import
java.util.List
;
...
@@ -28,20 +29,14 @@ public interface UserDao extends BaseDao {
...
@@ -28,20 +29,14 @@ public interface UserDao extends BaseDao {
*/
*/
void
checkPhone
(
UserVo
phone
);
void
checkPhone
(
UserVo
phone
);
/**
* 获取UserVo对象列表
*
* @return UserVo对象列表
*/
List
<
UserVo
>
listUserVo
();
/**
/**
* 通过用户id查询UserVo对象
* 通过用户id查询UserVo对象
*
*
* @param
id
用户id
* @param
reqVo
用户id
* @return UserVo对象
* @return UserVo对象
*/
*/
UserVo
getUser
ById
(
GetUserByIdReqVo
id
);
UserVo
getUser
(
UserGetReqVo
reqVo
);
/**
/**
* 根据公司id获取UserVo对象
* 根据公司id获取UserVo对象
...
@@ -49,5 +44,7 @@ public interface UserDao extends BaseDao {
...
@@ -49,5 +44,7 @@ public interface UserDao extends BaseDao {
* @param companyId GetUserByCompanyIdReqVo请求对象,封装公司id
* @param companyId GetUserByCompanyIdReqVo请求对象,封装公司id
* @return UserVo对象
* @return UserVo对象
*/
*/
UserVo
getUserByCompanyId
(
GetUserByCompanyIdReqVo
companyId
);
UserVo
getUserByCompanyId
(
UserGetReqVo
companyId
);
PageSizeData
<
UserVo
>
getUserVoList
(
ListUserReqVo
reqVo
);
}
}
src/main/java/com/pangding/web/authority/dao/UserRoleDao.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
;
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByRoleIdReqVo
;
import
com.pangding.web.authority.vo.reqvo.UserRoleGetReqVo
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByUserIdReqVo
;
import
com.pangding.web.authority.vo.UserRoleVo
;
import
com.pangding.web.authority.vo.UserRoleRelation
;
import
com.yanzuoguang.dao.BaseDao
;
import
com.yanzuoguang.dao.BaseDao
;
import
java.util.List
;
import
java.util.List
;
...
@@ -15,16 +14,9 @@ public interface UserRoleDao extends BaseDao {
...
@@ -15,16 +14,9 @@ public interface UserRoleDao extends BaseDao {
/**
/**
* 通过userId查询用户角色对应关系列表
* 通过userId查询用户角色对应关系列表
*
*
* @param
userId
用户id
* @param
reqVo
用户id
* @return user和role对应关系对象列表
* @return user和role对应关系对象列表
*/
*/
List
<
UserRole
Relation
>
getUserRoleListByUserId
(
GetUserRoleListByUserIdReqVo
userId
);
List
<
UserRole
Vo
>
getUserRoleList
(
UserRoleGetReqVo
reqVo
);
/**
* 通过角色id获取用户和角色的对应关系对象列表
*
* @param roleId 封装角色id
* @return 用户和角色的对应关系对象列表
*/
List
<
UserRoleRelation
>
getUserRoleListByRoleId
(
GetUserRoleListByRoleIdReqVo
roleId
);
}
}
src/main/java/com/pangding/web/authority/dao/impl/AuthorityDaoImpl.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.
reqvo.GetAuthorityById
ReqVo
;
import
com.pangding.web.authority.
vo.reqvo.AuthorityGet
ReqVo
;
import
com.pangding.web.authority.reqvo.ListLevel1ReqVo
;
import
com.pangding.web.authority.reqvo.ListLevel1ReqVo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.ListAuthorityReqVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
...
@@ -25,7 +27,9 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
...
@@ -25,7 +27,9 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
table
.
add
(
SELECT
,
"select * from pd_authority where 1=1"
)
table
.
add
(
SELECT
,
"select * from pd_authority where 1=1"
)
.
add
(
"exist"
,
"and pid = '' "
)
.
add
(
"exist"
,
"and pid = '' "
)
.
add
(
"id"
,
"and pid = ?"
);
.
add
(
"id"
,
"and pid = ? "
)
.
add
(
"pid"
,
"and pid = ? "
)
.
add
(
"exist"
,
"and pid ? ''"
);
}
}
@Override
@Override
...
@@ -34,8 +38,18 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
...
@@ -34,8 +38,18 @@ public class AuthorityDaoImpl extends BaseDaoImpl implements AuthorityDao {
}
}
@Override
@Override
public
AuthorityVo
getAuthorityById
(
GetAuthorityByIdReqVo
getAuthorityByIdReqVo
)
{
public
AuthorityVo
getAuthority
(
AuthorityGetReqVo
authorityGetReqVo
)
{
return
this
.
load
(
getAuthorityByIdReqVo
,
AuthorityVo
.
class
);
return
this
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
}
@Override
public
PageSizeData
<
AuthorityVo
>
getAuthorityList
(
ListAuthorityReqVo
reqVo
)
{
return
this
.
queryPage
(
AuthorityVo
.
class
,
reqVo
,
SELECT
,
reqVo
);
}
@Override
public
List
<
AuthorityVo
>
getAuthoritys
(
AuthorityGetReqVo
reqVo
)
{
return
this
.
query
(
AuthorityVo
.
class
,
SELECT
,
reqVo
);
}
}
@Override
@Override
...
...
src/main/java/com/pangding/web/authority/dao/impl/RoleAuthorityDaoImpl.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.reqvo.GetRoleAuthorityListByRoleIdReqVo
;
import
com.pangding.web.authority.vo.reqvo.RoleAuthorityGetReqVo
;
import
com.pangding.web.authority.reqvo.GetRoleAuthorityListByAuthorityIdReqVo
;
import
com.pangding.web.authority.vo.RoleAuthorityVo
;
import
com.pangding.web.authority.vo.RoleAuthorityRelation
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -20,7 +19,7 @@ public class RoleAuthorityDaoImpl extends BaseDaoImpl implements RoleAuthorityDa
...
@@ -20,7 +19,7 @@ public class RoleAuthorityDaoImpl extends BaseDaoImpl implements RoleAuthorityDa
@Override
@Override
protected
void
init
()
{
protected
void
init
()
{
register
(
RoleAuthority
Relation
.
class
);
register
(
RoleAuthority
Vo
.
class
);
table
.
add
(
SELECT
,
"select id,role_id,authority_id from pd_role_authority where 1=1 "
)
table
.
add
(
SELECT
,
"select id,role_id,authority_id from pd_role_authority where 1=1 "
)
.
add
(
"roleId"
,
"and role_id = ?"
)
.
add
(
"roleId"
,
"and role_id = ?"
)
...
@@ -29,13 +28,7 @@ public class RoleAuthorityDaoImpl extends BaseDaoImpl implements RoleAuthorityDa
...
@@ -29,13 +28,7 @@ public class RoleAuthorityDaoImpl extends BaseDaoImpl implements RoleAuthorityDa
}
}
@Override
@Override
public
List
<
RoleAuthorityRelation
>
getRoleAuthorityListByRoleId
(
GetRoleAuthorityListByRoleIdReqVo
getRoleAuthorityListByRoleIdReqVo
)
{
public
List
<
RoleAuthorityVo
>
getRoleAuthorityList
(
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
)
{
return
this
.
query
(
RoleAuthorityVo
.
class
,
SELECT
,
roleAuthorityGetReqVo
);
return
this
.
query
(
RoleAuthorityRelation
.
class
,
SELECT
,
getRoleAuthorityListByRoleIdReqVo
);
}
@Override
public
List
<
RoleAuthorityRelation
>
getRoleAuthorityListByAuthorityId
(
GetRoleAuthorityListByAuthorityIdReqVo
getRoleAuthorityListByAuthorityIdReqVo
)
{
return
this
.
query
(
RoleAuthorityRelation
.
class
,
SELECT
,
getRoleAuthorityListByAuthorityIdReqVo
);
}
}
}
}
src/main/java/com/pangding/web/authority/dao/impl/RoleDaoImpl.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.RoleDao
;
import
com.pangding.web.authority.dao.RoleDao
;
import
com.pangding.web.authority.
reqvo.GetRoleByRoleId
ReqVo
;
import
com.pangding.web.authority.
vo.reqvo.ListRole
ReqVo
;
import
com.pangding.web.authority.
reqvo.GetRoleByRoleName
ReqVo
;
import
com.pangding.web.authority.
vo.reqvo.RoleGet
ReqVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
...
@@ -31,12 +32,12 @@ public class RoleDaoImpl extends BaseDaoImpl implements RoleDao {
...
@@ -31,12 +32,12 @@ public class RoleDaoImpl extends BaseDaoImpl implements RoleDao {
}
}
@Override
@Override
public
RoleVo
getRoleById
(
GetRoleByRoleIdReqVo
getRoleByRoleId
ReqVo
)
{
public
RoleVo
getRoleById
(
RoleGetReqVo
roleGet
ReqVo
)
{
return
this
.
load
(
getRoleByRoleId
ReqVo
,
RoleVo
.
class
);
return
this
.
load
(
roleGet
ReqVo
,
RoleVo
.
class
);
}
}
@Override
@Override
public
RoleVo
getRoleByRoleName
(
GetRoleByRoleName
ReqVo
getRoleByRoleNameReqVo
)
{
public
RoleVo
getRoleByRoleName
(
RoleGet
ReqVo
getRoleByRoleNameReqVo
)
{
return
this
.
load
(
getRoleByRoleNameReqVo
,
RoleVo
.
class
);
return
this
.
load
(
getRoleByRoleNameReqVo
,
RoleVo
.
class
);
}
}
...
@@ -46,12 +47,13 @@ public class RoleDaoImpl extends BaseDaoImpl implements RoleDao {
...
@@ -46,12 +47,13 @@ public class RoleDaoImpl extends BaseDaoImpl implements RoleDao {
}
}
@Override
@Override
public
List
<
RoleVo
>
getRoleVoList
()
{
public
PageSizeData
<
RoleVo
>
getRoleVoList
(
ListRoleReqVo
req
)
{
return
this
.
query
(
RoleVo
.
class
,
SELECT
,
null
);
return
this
.
queryPage
(
RoleVo
.
class
,
req
,
SELECT
,
req
);
}
}
@Override
@Override
public
List
<
RoleVo
>
getChild
(
GetRoleByRoleIdReqVo
getRoleByRoleId
ReqVo
)
{
public
List
<
RoleVo
>
getChild
(
RoleGetReqVo
roleGet
ReqVo
)
{
return
this
.
query
(
RoleVo
.
class
,
SELECT
,
getRoleByRoleId
ReqVo
);
return
this
.
query
(
RoleVo
.
class
,
SELECT
,
roleGet
ReqVo
);
}
}
}
}
src/main/java/com/pangding/web/authority/dao/impl/UserDaoImpl.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.reqvo.GetUserByCompanyIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByIdReqVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.reqvo.ListUserReqVo
;
import
com.pangding.web.authority.vo.reqvo.UserGetReqVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.List
;
...
@@ -43,19 +44,17 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
...
@@ -43,19 +44,17 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
}
}
@Override
@Override
public
List
<
UserVo
>
listUserVo
()
{
public
UserVo
getUser
(
UserGetReqVo
reqVo
)
{
return
this
.
load
(
reqVo
,
UserVo
.
class
);
return
this
.
query
(
UserVo
.
class
,
SELECT
,
null
);
}
}
@Override
@Override
public
UserVo
getUserBy
Id
(
GetUserByIdReqVo
i
d
)
{
public
UserVo
getUserBy
CompanyId
(
UserGetReqVo
companyI
d
)
{
return
this
.
load
(
i
d
,
UserVo
.
class
);
return
this
.
load
(
companyI
d
,
UserVo
.
class
);
}
}
@Override
@Override
public
UserVo
getUserByCompanyId
(
GetUserByCompanyIdReqVo
companyId
)
{
public
PageSizeData
<
UserVo
>
getUserVoList
(
ListUserReqVo
reqVo
)
{
return
this
.
load
(
companyId
,
UserVo
.
class
);
return
this
.
queryPage
(
UserVo
.
class
,
reqVo
,
SELECT
,
reqVo
);
}
}
}
}
src/main/java/com/pangding/web/authority/dao/impl/UserRoleDaoImpl.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByRoleIdReqVo
;
import
com.pangding.web.authority.vo.reqvo.UserRoleGetReqVo
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByUserIdReqVo
;
import
com.pangding.web.authority.vo.UserRoleVo
;
import
com.pangding.web.authority.vo.UserRoleRelation
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -20,7 +19,7 @@ public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
...
@@ -20,7 +19,7 @@ public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
@Override
@Override
protected
void
init
()
{
protected
void
init
()
{
register
(
UserRole
Relation
.
class
);
register
(
UserRole
Vo
.
class
);
table
.
add
(
GET_USER_ROLE_LIST
,
"select * from pd_user_role where 1=1 "
)
table
.
add
(
GET_USER_ROLE_LIST
,
"select * from pd_user_role where 1=1 "
)
.
add
(
"userId"
,
"and user_id = ?"
)
.
add
(
"userId"
,
"and user_id = ?"
)
...
@@ -29,12 +28,8 @@ public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
...
@@ -29,12 +28,8 @@ public class UserRoleDaoImpl extends BaseDaoImpl implements UserRoleDao {
}
}
@Override
@Override
public
List
<
UserRole
Relation
>
getUserRoleListByUserId
(
GetUserRoleListByUserIdReqVo
userId
)
{
public
List
<
UserRole
Vo
>
getUserRoleList
(
UserRoleGetReqVo
reqVo
)
{
return
this
.
query
(
UserRole
Relation
.
class
,
GET_USER_ROLE_LIST
,
userId
);
return
this
.
query
(
UserRole
Vo
.
class
,
GET_USER_ROLE_LIST
,
reqVo
);
}
}
@Override
public
List
<
UserRoleRelation
>
getUserRoleListByRoleId
(
GetUserRoleListByRoleIdReqVo
roleId
)
{
return
this
.
query
(
UserRoleRelation
.
class
,
GET_USER_ROLE_LIST
,
roleId
);
}
}
}
src/main/java/com/pangding/web/authority/reqvo/GetRoleAuthorityListByRoleIdReqVo.java
deleted
100644 → 0
View file @
fd52bb0e
package
com
.
pangding
.
web
.
authority
.
reqvo
;
import
com.yanzuoguang.util.vo.BaseVo
;
import
java.io.Serializable
;
/**
* @Author zhangjinyao
* @create 2019/5/11 14:38
*/
public
class
GetRoleAuthorityListByRoleIdReqVo
implements
Serializable
{
private
String
roleId
;
public
String
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
}
src/main/java/com/pangding/web/authority/reqvo/GetUserByCompanyIdReqVo.java
deleted
100644 → 0
View file @
fd52bb0e
package
com
.
pangding
.
web
.
authority
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/5/14 11:24
*/
public
class
GetUserByCompanyIdReqVo
{
private
String
companyId
;
public
String
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
String
companyId
)
{
this
.
companyId
=
companyId
;
}
}
src/main/java/com/pangding/web/authority/reqvo/GetUserByIdReqVo.java
deleted
100644 → 0
View file @
fd52bb0e
package
com
.
pangding
.
web
.
authority
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/5/10 17:21
*/
public
class
GetUserByIdReqVo
{
private
String
id
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
src/main/java/com/pangding/web/authority/reqvo/GetUserByPhoneReqVo.java
deleted
100644 → 0
View file @
fd52bb0e
package
com
.
pangding
.
web
.
authority
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/5/14 15:48
*/
public
class
GetUserByPhoneReqVo
{
private
String
phone
;
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
}
src/main/java/com/pangding/web/authority/reqvo/GetUserRoleListByUserIdReqVo.java
deleted
100644 → 0
View file @
fd52bb0e
package
com
.
pangding
.
web
.
authority
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/5/10 19:34
*/
public
class
GetUserRoleListByUserIdReqVo
{
private
String
userId
;
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
}
src/main/java/com/pangding/web/authority/service/AuthorityService.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
service
;
package
com
.
pangding
.
web
.
authority
.
service
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.ListAuthorityReqVo
;
import
com.pangding.web.authority.vo.reqvo.WebAuthorityReqVo
;
import
com.pangding.web.authority.vo.reqvo.WebAuthorityResVo
;
import
com.pangding.web.authority.vo.reqvo.WebUserResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
import
java.util.List
;
...
@@ -25,17 +30,17 @@ public interface AuthorityService {
...
@@ -25,17 +30,17 @@ public interface AuthorityService {
/**
/**
* 通过权限表主键获取authorityVo对象
* 通过权限表主键获取authorityVo对象
*
*
* @param
id
主键
* @param
reqVo
主键
* @return authorityVo对象
* @return authorityVo对象
*/
*/
AuthorityVo
getAuthorityById
(
String
id
);
AuthorityVo
getAuthorityById
(
WebAuthorityReqVo
reqVo
);
/**
/**
* 通过权限表主键删除authorityVo对象,并删除权限和角色的对应关系
* 通过权限表主键删除authorityVo对象,并删除权限和角色的对应关系
*
*
* @param
id
主键
* @param
reqVo
主键
*/
*/
void
deleteAuthorityById
(
String
id
);
void
deleteAuthorityById
(
WebAuthorityReqVo
reqVo
);
/**
/**
* 检查新建、修改的authorityVo对象是否合法
* 检查新建、修改的authorityVo对象是否合法
...
@@ -45,18 +50,7 @@ public interface AuthorityService {
...
@@ -45,18 +50,7 @@ public interface AuthorityService {
*/
*/
void
checkValid
(
AuthorityVo
authorityVo
);
void
checkValid
(
AuthorityVo
authorityVo
);
/**
* 获取authorityVo对象列表
*
* @return authorityVo对象列表
*/
List
<
AuthorityVo
>
listAllAuthority
();
/**
PageSizeData
<
WebAuthorityResVo
>
getWebAuthorityResVoList
(
ListAuthorityReqVo
reqVo
);
* 获取一级权限列表
*
* @return 一级权限列表
*/
List
<
AuthorityVo
>
listLevel1
();
}
}
src/main/java/com/pangding/web/authority/service/RoleService.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
service
;
package
com
.
pangding
.
web
.
authority
.
service
;
import
com.pangding.web.authority.dto.RoleDto
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.reqvo.ListRoleReqVo
;
import
com.pangding.web.authority.vo.reqvo.WebRoleReqVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.reqvo.WebRoleResVo
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
import
java.util.List
;
...
@@ -13,24 +17,24 @@ public interface RoleService {
...
@@ -13,24 +17,24 @@ public interface RoleService {
/**
/**
* 保存RoleDto对象,并保存角色权限的对应关系
* 保存RoleDto对象,并保存角色权限的对应关系
*
*
* @param
roleDt
o RoleDto对象
* @param
webRoleReqV
o RoleDto对象
*/
*/
void
saveRole
(
RoleDto
roleDt
o
);
void
saveRole
(
WebRoleReqVo
webRoleReqV
o
);
/**
/**
* 更新RoleDto对象,并更新角色权限的对应关系
* 更新RoleDto对象,并更新角色权限的对应关系
*
*
* @param
roleDt
o RoleDto对象
* @param
webRoleReqV
o RoleDto对象
*/
*/
void
updateRole
(
RoleDto
roleDt
o
);
void
updateRole
(
WebRoleReqVo
webRoleReqV
o
);
/**
/**
* 通过主键id查询RoleVo对象
* 通过主键id查询RoleVo对象
*
*
* @param
id
主键
* @param
webRoleReqVo
主键
* @return RoleVo对象
* @return RoleVo对象
*/
*/
RoleVo
getRoleById
(
String
id
);
WebRoleResVo
getRoleById
(
WebRoleReqVo
webRoleReqVo
);
/**
/**
* 通过角色名查询RoleVo对象
* 通过角色名查询RoleVo对象
...
@@ -51,9 +55,12 @@ public interface RoleService {
...
@@ -51,9 +55,12 @@ public interface RoleService {
/**
/**
* 获取RoleVo对象列表
* 获取RoleVo对象列表
*
*
* @param req
* @return RoleVo对象列表
* @return RoleVo对象列表
*/
*/
List
<
RoleVo
>
getRoleVoList
();
PageSizeData
<
RoleVo
>
getRoleVoList
(
ListRoleReqVo
req
);
PageSizeData
<
WebRoleResVo
>
getWebRoleResVoList
(
ListRoleReqVo
req
);
/**
/**
* 通过角色id查询该角色权限id列表
* 通过角色id查询该角色权限id列表
...
@@ -61,7 +68,7 @@ public interface RoleService {
...
@@ -61,7 +68,7 @@ public interface RoleService {
* @param roleId 角色id
* @param roleId 角色id
* @return 权限id列表
* @return 权限id列表
*/
*/
List
<
String
>
getAuthorityId
ListByRoleId
(
String
roleId
);
List
<
AuthorityVo
>
getAuthority
ListByRoleId
(
String
roleId
);
/**
/**
* 通过权限id查询权限名
* 通过权限id查询权限名
...
@@ -75,11 +82,10 @@ public interface RoleService {
...
@@ -75,11 +82,10 @@ public interface RoleService {
* 将RoleVo对象添加权限ID列表和权限名列表封装成RoleDto对象
* 将RoleVo对象添加权限ID列表和权限名列表封装成RoleDto对象
*
*
* @param roleVo RoleVo对象
* @param roleVo RoleVo对象
* @param authorityIdList 权限id列表
* @param authorityList 权限列表
* @param authorityNameList 权限名列表
* @return RoleDto对象
* @return RoleDto对象
*/
*/
RoleDto
makeRoleDto
(
RoleVo
roleVo
,
List
<
String
>
authorityIdList
,
List
<
String
>
authorityName
List
);
WebRoleResVo
makeResVo
(
RoleVo
roleVo
,
List
<
AuthorityVo
>
authority
List
);
/**
/**
* 删除角色,并删除角色和用户的对应关系以及角色和权限的对应关系
* 删除角色,并删除角色和用户的对应关系以及角色和权限的对应关系
...
@@ -88,4 +94,6 @@ public interface RoleService {
...
@@ -88,4 +94,6 @@ public interface RoleService {
*/
*/
void
deleteRole
(
RoleVo
roleVo
);
void
deleteRole
(
RoleVo
roleVo
);
void
delete
(
WebRoleReqVo
webRoleReqVo
);
}
}
src/main/java/com/pangding/web/authority/service/UserService.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
service
;
package
com
.
pangding
.
web
.
authority
.
service
;
import
com.pangding.web.authority.dto.UserDto
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.reqvo.GetRoleByRoleIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByUserIdReqVo
;
import
com.pangding.web.authority.vo.*
;
import
com.pangding.web.authority.vo.*
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
java.util.List
;
import
java.util.List
;
...
@@ -17,14 +16,14 @@ public interface UserService {
...
@@ -17,14 +16,14 @@ public interface UserService {
*
*
* @param userDto UserDto对象
* @param userDto UserDto对象
*/
*/
void
saveUser
(
UserDt
o
userDto
);
void
saveUser
(
WebUserReqV
o
userDto
);
/**
/**
* 保存更新后的用户信息,并更新用户和角色的对应关系
* 保存更新后的用户信息,并更新用户和角色的对应关系
*
*
* @param userDto UserDto对象
* @param userDto UserDto对象
*/
*/
void
updateUser
(
UserDt
o
userDto
);
void
updateUser
(
WebUserReqV
o
userDto
);
/**
/**
* 检查用户名是否存在
* 检查用户名是否存在
...
@@ -48,22 +47,14 @@ public interface UserService {
...
@@ -48,22 +47,14 @@ public interface UserService {
*/
*/
String
passwordEncoder
(
String
password
);
String
passwordEncoder
(
String
password
);
/**
* 获取UserVo对象列表
*
* @return UserVo对象列表
*/
List
<
UserVo
>
listUserVo
();
/**
/**
* 将UserVo对象添加角色id列表和角色名列表封装成UserDto对象
* 将UserVo对象添加角色id列表和角色名列表封装成UserDto对象
*
*
* @param userVo UserVo对象
* @param userVo UserVo对象
* @param roleIdList 角色id列表
* @param roleNameList 角色名列表
* @return UserDto对象
* @return UserDto对象
*/
*/
UserDto
makeUserDto
(
UserVo
userVo
,
List
<
String
>
roleIdList
,
List
<
String
>
roleNameList
);
WebUserResVo
makeResVo
(
UserVo
userVo
);
/**
/**
* 通过用户id查询UserVo对象
* 通过用户id查询UserVo对象
...
@@ -71,7 +62,11 @@ public interface UserService {
...
@@ -71,7 +62,11 @@ public interface UserService {
* @param userId 用户id
* @param userId 用户id
* @return UserVo对象
* @return UserVo对象
*/
*/
UserVo
getUserById
(
String
userId
);
WebUserResVo
getUserById
(
String
userId
);
PageSizeData
<
UserVo
>
getUserVoList
(
ListUserReqVo
reqVo
);
PageSizeData
<
WebUserResVo
>
getWebUserResVoList
(
ListUserReqVo
reqVo
);
/**
/**
* 通过userId查询user和role对应关系对象列表
* 通过userId查询user和role对应关系对象列表
...
@@ -79,15 +74,15 @@ public interface UserService {
...
@@ -79,15 +74,15 @@ public interface UserService {
* @param reqVo GetUserRoleListByUserIdReqVo对象
* @param reqVo GetUserRoleListByUserIdReqVo对象
* @return UserRole对应关系对象列表
* @return UserRole对应关系对象列表
*/
*/
List
<
UserRole
Relation
>
listUserRoleListByUserId
(
GetUserRoleListByUserId
ReqVo
reqVo
);
List
<
UserRole
Vo
>
listUserRoleListByUserId
(
UserRoleGet
ReqVo
reqVo
);
/**
/**
* 根据roleId查询RoleVo对象
* 根据roleId查询RoleVo对象
*
*
* @param
getRoleByRoleId
ReqVo GetRoleByRoleIdReqVo对象
* @param
roleGet
ReqVo GetRoleByRoleIdReqVo对象
* @return RoleVo对象
* @return RoleVo对象
*/
*/
RoleVo
getRoleByRoleId
(
GetRoleByRoleIdReqVo
getRoleByRoleId
ReqVo
);
RoleVo
getRoleByRoleId
(
RoleGetReqVo
roleGet
ReqVo
);
/**
/**
* 检查用户名是否合法
* 检查用户名是否合法
...
@@ -95,7 +90,7 @@ public interface UserService {
...
@@ -95,7 +90,7 @@ public interface UserService {
* @param account 用户名
* @param account 用户名
* @return
* @return
*/
*/
Boolean
isValid
(
String
account
);
void
isValid
(
String
account
);
/**
/**
* 检查是否为纯数字,用来判断输入的是用户名还是手机号
* 检查是否为纯数字,用来判断输入的是用户名还是手机号
...
@@ -120,4 +115,6 @@ public interface UserService {
...
@@ -120,4 +115,6 @@ public interface UserService {
* @return UserVo对象
* @return UserVo对象
*/
*/
UserVo
getUserByAccount
(
String
account
);
UserVo
getUserByAccount
(
String
account
);
List
<
RoleVo
>
getRoleListByUserId
(
String
userId
);
}
}
src/main/java/com/pangding/web/authority/service/impl/AuthorityServiceImpl.java
View file @
65d90702
...
@@ -2,16 +2,18 @@ package com.pangding.web.authority.service.impl;
...
@@ -2,16 +2,18 @@ package com.pangding.web.authority.service.impl;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.reqvo.GetAuthorityByIdReqVo
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.reqvo.GetRoleAuthorityListByAuthorityIdReqVo
;
import
com.pangding.web.authority.reqvo.ListLevel1ReqVo
;
import
com.pangding.web.authority.reqvo.ListLevel1ReqVo
;
import
com.pangding.web.authority.service.AuthorityService
;
import
com.pangding.web.authority.service.AuthorityService
;
import
com.pangding.web.authority.vo.*
;
import
com.pangding.web.authority.vo.*
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -28,12 +30,14 @@ public class AuthorityServiceImpl implements AuthorityService {
...
@@ -28,12 +30,14 @@ public class AuthorityServiceImpl implements AuthorityService {
@Override
@Override
public
void
save
(
AuthorityVo
authorityVo
)
{
public
void
save
(
AuthorityVo
authorityVo
)
{
this
.
checkValid
(
authorityVo
);
authorityVo
.
setId
(
StringHelper
.
getNewID
());
authorityVo
.
setId
(
StringHelper
.
getNewID
());
authorityDao
.
create
(
authorityVo
);
authorityDao
.
create
(
authorityVo
);
}
}
@Override
@Override
public
void
update
(
AuthorityVo
authorityVo
)
{
public
void
update
(
AuthorityVo
authorityVo
)
{
this
.
checkValid
(
authorityVo
);
authorityDao
.
update
(
authorityVo
);
authorityDao
.
update
(
authorityVo
);
}
}
...
@@ -43,38 +47,72 @@ public class AuthorityServiceImpl implements AuthorityService {
...
@@ -43,38 +47,72 @@ public class AuthorityServiceImpl implements AuthorityService {
}
}
@Override
@Override
public
AuthorityVo
getAuthorityById
(
String
id
)
{
public
AuthorityVo
getAuthorityById
(
WebAuthorityReqVo
reqVo
)
{
GetAuthorityByIdReqVo
getAuthorityByIdReqVo
=
new
GetAuthorityByIdReqVo
();
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
getAuthorityByIdReqVo
.
setId
(
id
);
authorityGetReqVo
.
setId
(
reqVo
.
getId
());
AuthorityVo
authorityVo
=
authorityDao
.
getAuthorityById
(
getAuthorityByIdReqVo
);
AuthorityVo
authorityVo
=
authorityDao
.
getAuthority
(
authorityGetReqVo
);
return
authorityVo
!=
null
?
authorityVo
:
null
;
if
(
authorityVo
==
null
){
throw
new
CodeException
(
"该权限不存在"
);
}
return
authorityVo
;
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteAuthorityById
(
String
id
)
{
public
void
deleteAuthorityById
(
WebAuthorityReqVo
reqVo
)
{
AuthorityVo
authorityVo
=
new
AuthorityVo
();
AuthorityVo
authorityVo
=
new
AuthorityVo
();
authorityVo
.
setId
(
id
);
authorityVo
.
setId
(
reqVo
.
getId
()
);
authorityDao
.
remove
(
authorityVo
);
authorityDao
.
remove
(
authorityVo
);
GetRoleAuthorityListByAuthorityIdReqVo
getRoleAuthorityListByAuthorityIdReqVo
=
new
GetRoleAuthorityListByAuthorityIdReqVo
();
getRoleAuthorityListByAuthorityIdReqVo
.
setAuthorityId
(
id
);
RoleAuthorityGetReqVo
roleAuthorityGetReqVo
=
new
RoleAuthorityGetReqVo
();
List
<
RoleAuthorityRelation
>
roleAuthorityList
=
roleAuthorityDao
.
getRoleAuthorityListByAuthorityId
(
getRoleAuthorityListByAuthorityIdReqVo
);
roleAuthorityGetReqVo
.
setAuthorityId
(
reqVo
.
getId
());
for
(
RoleAuthorityRelation
roleAuthority:
roleAuthorityList
)
{
List
<
RoleAuthorityVo
>
roleAuthorityList
=
roleAuthorityDao
.
getRoleAuthorityList
(
roleAuthorityGetReqVo
);
for
(
RoleAuthorityVo
roleAuthority:
roleAuthorityList
)
{
roleAuthorityDao
.
remove
(
roleAuthority
);
roleAuthorityDao
.
remove
(
roleAuthority
);
}
}
}
@Override
AuthorityGetReqVo
reqVo1
=
new
AuthorityGetReqVo
();
public
List
<
AuthorityVo
>
listAllAuthority
()
{
reqVo1
.
setPid
(
reqVo
.
getId
());
List
<
AuthorityVo
>
list
=
authorityDao
.
listAll
();
List
<
AuthorityVo
>
childList
=
authorityDao
.
getAuthoritys
(
reqVo1
);
return
(
list
!=
null
&&
list
.
size
()
!=
0
)
?
list
:
null
;
if
(
childList
!=
null
&&
childList
.
size
()
!=
0
){
for
(
AuthorityVo
child:
childList
)
{
WebAuthorityReqVo
reqVo2
=
new
WebAuthorityReqVo
();
reqVo2
.
setId
(
child
.
getId
());
this
.
deleteAuthorityById
(
reqVo2
);
}
}
}
}
@Override
@Override
public
List
<
AuthorityVo
>
listLevel1
()
{
public
PageSizeData
<
WebAuthorityResVo
>
getWebAuthorityResVoList
(
ListAuthorityReqVo
reqVo
)
{
ListLevel1ReqVo
listLevel1ReqVo
=
new
ListLevel1ReqVo
();
reqVo
.
setExist
(
"exist"
);
listLevel1ReqVo
.
setExist
(
"exist"
);
PageSizeData
<
AuthorityVo
>
authorityVoPageSizeData
=
authorityDao
.
getAuthorityList
(
reqVo
);
List
<
AuthorityVo
>
list
=
authorityDao
.
listLevel1
(
listLevel1ReqVo
);
PageSizeData
<
WebAuthorityResVo
>
webAuthorityResVoPageSizeData
=
new
PageSizeData
();
return
(
list
!=
null
&&
list
.
size
()
!=
0
)
?
list
:
null
;
List
<
AuthorityVo
>
authorityVoList
=
authorityVoPageSizeData
.
getList
();
if
(
authorityVoList
==
null
||
authorityVoList
.
size
()
==
0
){
throw
new
CodeException
(
"没有更多权限"
);
}
List
<
WebAuthorityResVo
>
webAuthorityResVoList
=
new
ArrayList
(
authorityVoList
.
size
());
for
(
AuthorityVo
authorityVo:
authorityVoList
)
{
WebAuthorityResVo
resVo
=
new
WebAuthorityResVo
();
resVo
.
setUrl
(
authorityVo
.
getUrl
());
resVo
.
setType
(
authorityVo
.
getType
());
resVo
.
setRemark
(
authorityVo
.
getRemark
());
resVo
.
setPid
(
authorityVo
.
getPid
());
resVo
.
setOpenMode
(
authorityVo
.
getOpenMode
());
resVo
.
setName
(
authorityVo
.
getName
());
resVo
.
setId
(
authorityVo
.
getId
());
resVo
.
setCreateTime
(
authorityVo
.
getCreateTime
());
resVo
.
setAlias
(
authorityVo
.
getAlias
());
webAuthorityResVoList
.
add
(
resVo
);
}
webAuthorityResVoPageSizeData
.
setPageSize
(
authorityVoPageSizeData
.
getPageSize
());
webAuthorityResVoPageSizeData
.
setPageIndex
(
authorityVoPageSizeData
.
getPageIndex
());
webAuthorityResVoPageSizeData
.
setPageTotal
(
authorityVoPageSizeData
.
getPageTotal
());
webAuthorityResVoPageSizeData
.
setList
(
webAuthorityResVoList
);
return
webAuthorityResVoPageSizeData
;
}
}
}
}
src/main/java/com/pangding/web/authority/service/impl/MobileRegisterServiceImpl.java
View file @
65d90702
...
@@ -2,9 +2,7 @@ package com.pangding.web.authority.service.impl;
...
@@ -2,9 +2,7 @@ package com.pangding.web.authority.service.impl;
import
com.pangding.web.authority.dao.MobileRegisterDao
;
import
com.pangding.web.authority.dao.MobileRegisterDao
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dto.RegisterIndividualDto
;
import
com.pangding.web.authority.reqvo.CheckMerchantIdReqVo
;
import
com.pangding.web.authority.reqvo.CheckMerchantIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByCompanyIdReqVo
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.UserVo
;
...
...
src/main/java/com/pangding/web/authority/service/impl/RoleServiceImpl.java
View file @
65d90702
...
@@ -4,11 +4,12 @@ import com.pangding.web.authority.dao.RoleDao;
...
@@ -4,11 +4,12 @@ import com.pangding.web.authority.dao.RoleDao;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.dao.RoleAuthorityDao
;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.dao.AuthorityDao
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.dto.RoleDto
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.reqvo.*
;
import
com.pangding.web.authority.service.RoleService
;
import
com.pangding.web.authority.service.RoleService
;
import
com.pangding.web.authority.vo.*
;
import
com.pangding.web.authority.vo.*
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -36,52 +37,68 @@ public class RoleServiceImpl implements RoleService {
...
@@ -36,52 +37,68 @@ public class RoleServiceImpl implements RoleService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveRole
(
RoleDto
roleDto
)
{
public
void
saveRole
(
WebRoleReqVo
webRoleReqVo
)
{
RoleVo
roleVo
=
roleDto
;
RoleVo
roleVo
=
webRoleReqVo
;
this
.
checkNameExist
(
roleVo
);
webRoleReqVo
.
setId
(
StringHelper
.
getNewID
());
roleDao
.
create
(
roleVo
);
roleDao
.
create
(
roleVo
);
List
<
String
>
authorityIds
=
roleDto
.
getAuthorityIds
();
List
<
String
>
authorityIds
=
webRoleReqVo
.
getAuthorityIds
();
for
(
String
authorityId
:
authorityIds
)
{
if
(
authorityIds
!=
null
&&
authorityIds
.
size
()
!=
0
){
RoleAuthorityRelation
roleAuthorityRelation
=
new
RoleAuthorityRelation
();
for
(
String
authorityId
:
authorityIds
)
{
roleAuthorityRelation
.
setAuthorityId
(
authorityId
);
RoleAuthorityVo
roleAuthorityRelation
=
new
RoleAuthorityVo
();
roleAuthorityRelation
.
setRoleId
(
roleDto
.
getId
());
roleAuthorityRelation
.
setAuthorityId
(
authorityId
);
roleAuthorityRelation
.
setId
(
StringHelper
.
getNewID
());
roleAuthorityRelation
.
setRoleId
(
webRoleReqVo
.
getId
());
roleAuthorityDaoImpl
.
create
(
roleAuthorityRelation
);
roleAuthorityRelation
.
setId
(
StringHelper
.
getNewID
());
roleAuthorityDaoImpl
.
create
(
roleAuthorityRelation
);
}
}
}
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateRole
(
RoleDto
roleDto
)
{
public
void
updateRole
(
WebRoleReqVo
webRoleReqVo
)
{
RoleVo
roleVo
=
roleDto
;
RoleVo
roleVo
=
webRoleReqVo
;
this
.
checkNameExist
(
roleVo
);
roleDao
.
update
(
roleVo
);
roleDao
.
update
(
roleVo
);
GetRoleAuthorityListByRoleIdReqVo
getRoleAuthorityListByRoleIdReqVo
=
new
GetRoleAuthorityListByRoleId
ReqVo
();
RoleAuthorityGetReqVo
reqVo
=
new
RoleAuthorityGet
ReqVo
();
getRoleAuthorityListByRoleIdReqVo
.
setRoleId
(
roleDt
o
.
getId
());
reqVo
.
setRoleId
(
webRoleReqV
o
.
getId
());
List
<
RoleAuthority
Relation
>
roleAuthorityList
=
roleAuthorityDaoImpl
.
getRoleAuthorityListByRoleId
(
getRoleAuthorityListByRoleIdR
eqVo
);
List
<
RoleAuthority
Vo
>
roleAuthorityList
=
roleAuthorityDaoImpl
.
getRoleAuthorityList
(
r
eqVo
);
if
(
roleAuthorityList
!=
null
&&
roleAuthorityList
.
size
()
!=
0
){
if
(
roleAuthorityList
!=
null
&&
roleAuthorityList
.
size
()
!=
0
){
for
(
RoleAuthority
Relation
roleAuthorityRelation:
roleAuthorityList
)
{
for
(
RoleAuthority
Vo
roleAuthorityRelation:
roleAuthorityList
)
{
roleAuthorityDaoImpl
.
remove
(
roleAuthorityRelation
);
roleAuthorityDaoImpl
.
remove
(
roleAuthorityRelation
);
}
}
}
}
List
<
String
>
authorityIds
=
roleDto
.
getAuthorityIds
();
List
<
String
>
authorityIds
=
webRoleReqVo
.
getAuthorityIds
();
for
(
String
authorityId
:
authorityIds
)
{
if
(
authorityIds
!=
null
&&
authorityIds
.
size
()
!=
0
){
RoleAuthorityRelation
roleAuthorityRelation
=
new
RoleAuthorityRelation
();
for
(
String
authorityId
:
authorityIds
)
{
roleAuthorityRelation
.
setAuthorityId
(
authorityId
);
RoleAuthorityVo
roleAuthorityRelation
=
new
RoleAuthorityVo
();
roleAuthorityRelation
.
setRoleId
(
roleDto
.
getId
());
roleAuthorityRelation
.
setAuthorityId
(
authorityId
);
roleAuthorityRelation
.
setId
(
StringHelper
.
getNewID
());
roleAuthorityRelation
.
setRoleId
(
webRoleReqVo
.
getId
());
roleAuthorityDaoImpl
.
create
(
roleAuthorityRelation
);
roleAuthorityRelation
.
setId
(
StringHelper
.
getNewID
());
roleAuthorityDaoImpl
.
create
(
roleAuthorityRelation
);
}
}
}
}
}
@Override
@Override
public
RoleVo
getRoleById
(
String
id
)
{
public
WebRoleResVo
getRoleById
(
WebRoleReqVo
webRoleReqVo
)
{
GetRoleByRoleIdReqVo
getRoleByRoleIdReqVo
=
new
GetRoleByRoleIdReqVo
();
RoleGetReqVo
roleGetReqVo
=
new
RoleGetReqVo
();
getRoleByRoleIdReqVo
.
setId
(
id
);
roleGetReqVo
.
setId
(
webRoleReqVo
.
getId
());
return
roleDao
.
getRoleById
(
getRoleByRoleIdReqVo
);
RoleVo
roleVo
=
roleDao
.
getRoleById
(
roleGetReqVo
);
if
(
roleVo
==
null
){
throw
new
CodeException
(
"未找到该角色"
);
}
List
<
AuthorityVo
>
authorityList
=
this
.
getAuthorityListByRoleId
(
webRoleReqVo
.
getId
());
return
this
.
makeResVo
(
roleVo
,
authorityList
);
}
}
@Override
@Override
public
RoleVo
getRoleByName
(
String
name
)
{
public
RoleVo
getRoleByName
(
String
name
)
{
GetRoleByRoleNameReqVo
getRoleByRoleNameReqVo
=
new
GetRoleByRoleName
ReqVo
();
RoleGetReqVo
getRoleByRoleNameReqVo
=
new
RoleGet
ReqVo
();
getRoleByRoleNameReqVo
.
setName
(
name
);
getRoleByRoleNameReqVo
.
setName
(
name
);
return
roleDao
.
getRoleByRoleName
(
getRoleByRoleNameReqVo
);
return
roleDao
.
getRoleByRoleName
(
getRoleByRoleNameReqVo
);
}
}
...
@@ -92,81 +109,121 @@ public class RoleServiceImpl implements RoleService {
...
@@ -92,81 +109,121 @@ public class RoleServiceImpl implements RoleService {
}
}
@Override
@Override
public
List
<
RoleVo
>
getRoleVoList
()
{
public
PageSizeData
<
RoleVo
>
getRoleVoList
(
ListRoleReqVo
req
)
{
return
roleDao
.
getRoleVoList
();
PageSizeData
<
RoleVo
>
roleVoPageSizeData
=
roleDao
.
getRoleVoList
(
req
);
if
(
roleVoPageSizeData
.
getList
()
==
null
||
roleVoPageSizeData
.
getList
().
size
()
==
0
){
throw
new
CodeException
(
"没有更多权限"
);
}
return
roleVoPageSizeData
;
}
@Override
public
PageSizeData
<
WebRoleResVo
>
getWebRoleResVoList
(
ListRoleReqVo
req
)
{
PageSizeData
<
RoleVo
>
roleVoPageSizeData
=
this
.
getRoleVoList
(
req
);
PageSizeData
<
WebRoleResVo
>
webRoleResVoPageSizeData
=
new
PageSizeData
();
List
<
RoleVo
>
roleVoList
=
roleVoPageSizeData
.
getList
();
List
<
WebRoleResVo
>
webRoleResVoList
=
new
ArrayList
(
roleVoList
.
size
());
for
(
RoleVo
roleVo:
roleVoList
)
{
WebRoleResVo
resVo
=
new
WebRoleResVo
();
List
<
AuthorityVo
>
authorityVoList
=
this
.
getAuthorityListByRoleId
(
roleVo
.
getId
());
resVo
.
setAuthorityList
(
authorityVoList
);
resVo
.
setId
(
roleVo
.
getId
());
resVo
.
setName
(
roleVo
.
getName
());
resVo
.
setPid
(
roleVo
.
getPid
());
resVo
.
setRemark
(
roleVo
.
getRemark
());
webRoleResVoList
.
add
(
resVo
);
}
webRoleResVoPageSizeData
.
setPageTotal
(
roleVoPageSizeData
.
getPageTotal
());
webRoleResVoPageSizeData
.
setList
(
webRoleResVoList
);
webRoleResVoPageSizeData
.
setPageIndex
(
roleVoPageSizeData
.
getPageIndex
());
webRoleResVoPageSizeData
.
setPageSize
(
roleVoPageSizeData
.
getPageSize
());
return
webRoleResVoPageSizeData
;
}
}
@Override
@Override
public
List
<
String
>
getAuthorityIdListByRoleId
(
String
roleId
)
{
public
List
<
AuthorityVo
>
getAuthorityListByRoleId
(
String
roleId
)
{
GetRoleAuthorityListByRoleIdReqVo
getRoleAuthorityListByRoleIdReqVo
=
new
GetRoleAuthorityListByRoleIdReqVo
();
RoleAuthorityGetReqVo
reqVo
=
new
RoleAuthorityGetReqVo
();
getRoleAuthorityListByRoleIdReqVo
.
setRoleId
(
roleId
);
reqVo
.
setRoleId
(
roleId
);
List
<
RoleAuthorityRelation
>
roleAuthorityRelationList
=
roleAuthorityDaoImpl
.
getRoleAuthorityListByRoleId
(
getRoleAuthorityListByRoleIdReqVo
);
List
<
RoleAuthorityVo
>
roleAuthorityRelationList
=
roleAuthorityDaoImpl
.
getRoleAuthorityList
(
reqVo
);
List
<
String
>
authorityIdList
=
new
ArrayList
(
roleAuthorityRelationList
.
size
());
if
(
roleAuthorityRelationList
!=
null
&&
roleAuthorityRelationList
.
size
()
!=
0
){
for
(
RoleAuthorityRelation
roleAuthorityRelation:
roleAuthorityRelationList
)
{
List
<
AuthorityVo
>
authorityList
=
new
ArrayList
(
roleAuthorityRelationList
.
size
());
authorityIdList
.
add
(
roleAuthorityRelation
.
getAuthorityId
());
for
(
RoleAuthorityVo
roleAuthorityRelation:
roleAuthorityRelationList
)
{
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGetReqVo
();
authorityGetReqVo
.
setId
(
roleAuthorityRelation
.
getAuthorityId
());
AuthorityVo
authorityVo
=
authorityDaoImpl
.
load
(
authorityGetReqVo
,
AuthorityVo
.
class
);
authorityList
.
add
(
authorityVo
);
}
return
authorityList
;
}
}
return
authorityIdList
;
return
null
;
}
}
@Override
@Override
public
String
getAuthorityNameByAuthorityId
(
String
authorityId
)
{
public
String
getAuthorityNameByAuthorityId
(
String
authorityId
)
{
GetAuthorityByIdReqVo
getAuthorityByIdReqVo
=
new
GetAuthorityById
ReqVo
();
AuthorityGetReqVo
authorityGetReqVo
=
new
AuthorityGet
ReqVo
();
getAuthorityById
ReqVo
.
setId
(
authorityId
);
authorityGet
ReqVo
.
setId
(
authorityId
);
AuthorityVo
authorityVo
=
authorityDaoImpl
.
getAuthority
ById
(
getAuthorityById
ReqVo
);
AuthorityVo
authorityVo
=
authorityDaoImpl
.
getAuthority
(
authorityGet
ReqVo
);
return
authorityVo
.
getName
();
return
authorityVo
.
getName
();
}
}
@Override
@Override
public
RoleDto
makeRoleDto
(
RoleVo
roleVo
,
List
<
String
>
authorityIdList
,
List
<
String
>
authorityNameList
)
{
public
WebRoleResVo
makeResVo
(
RoleVo
roleVo
,
List
<
AuthorityVo
>
authorityList
)
{
RoleDto
roleDto
=
new
RoleDto
();
WebRoleResVo
ResVo
=
new
WebRoleResVo
();
roleDto
.
setId
(
roleVo
.
getId
());
ResVo
.
setId
(
roleVo
.
getId
());
roleDto
.
setName
(
roleVo
.
getName
());
ResVo
.
setName
(
roleVo
.
getName
());
roleDto
.
setPid
(
roleVo
.
getPid
());
ResVo
.
setPid
(
roleVo
.
getPid
());
roleDto
.
setRemark
(
roleVo
.
getRemark
());
ResVo
.
setRemark
(
roleVo
.
getRemark
());
roleDto
.
setAuthorityIds
(
authorityIdList
);
ResVo
.
setAuthorityList
(
authorityList
);
roleDto
.
setAuthorityNames
(
authorityNameList
);
return
ResVo
;
return
roleDto
;
}
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteRole
(
RoleVo
roleVo
)
{
public
void
deleteRole
(
RoleVo
roleVo
)
{
roleDao
.
remove
(
roleVo
);
UserRoleGetReqVo
userRoleGetReqVo
=
new
UserRoleGetReqVo
();
GetUserRoleListByRoleIdReqVo
getUserRoleListByRoleIdReqVo
=
new
GetUserRoleListByRoleIdReqVo
();
userRoleGetReqVo
.
setRoleId
(
roleVo
.
getId
());
getUserRoleListByRoleIdReqVo
.
setRoleId
(
roleVo
.
getId
());
List
<
UserRoleVo
>
userRoleList
=
userRoleDaoImpl
.
getUserRoleList
(
userRoleGetReqVo
);
List
<
UserRoleRelation
>
userRoleList
=
userRoleDaoImpl
.
getUserRoleListByRoleId
(
getUserRoleListByRoleIdReqVo
);
if
(
userRoleList
!=
null
&&
userRoleList
.
size
()
!=
0
){
if
(
userRoleList
!=
null
&&
userRoleList
.
size
()
!=
0
){
for
(
UserRole
Relation
userRoleRelation:
userRoleList
)
{
for
(
UserRole
Vo
userRoleRelation:
userRoleList
)
{
userRoleDaoImpl
.
remove
(
userRoleRelation
);
userRoleDaoImpl
.
remove
(
userRoleRelation
);
}
}
}
}
GetRoleAuthorityListByRoleIdReqVo
getRoleAuthorityListByRoleIdReqVo
=
new
GetRoleAuthorityListByRoleId
ReqVo
();
RoleAuthorityGetReqVo
reqVo
=
new
RoleAuthorityGet
ReqVo
();
getRoleAuthorityListByRoleIdR
eqVo
.
setRoleId
(
roleVo
.
getId
());
r
eqVo
.
setRoleId
(
roleVo
.
getId
());
List
<
RoleAuthority
Relation
>
roleAuthorityList
=
roleAuthorityDaoImpl
.
getRoleAuthorityListByRoleId
(
getRoleAuthorityListByRoleIdR
eqVo
);
List
<
RoleAuthority
Vo
>
roleAuthorityList
=
roleAuthorityDaoImpl
.
getRoleAuthorityList
(
r
eqVo
);
if
(
roleAuthorityList
!=
null
&&
roleAuthorityList
.
size
()
!=
0
){
if
(
roleAuthorityList
!=
null
&&
roleAuthorityList
.
size
()
!=
0
){
for
(
RoleAuthority
Relation
roleAuthority:
roleAuthorityList
)
{
for
(
RoleAuthority
Vo
roleAuthority:
roleAuthorityList
)
{
roleAuthorityDaoImpl
.
remove
(
roleAuthority
);
roleAuthorityDaoImpl
.
remove
(
roleAuthority
);
}
}
}
}
GetRoleByRoleIdReqVo
getRoleByRoleIdReqVo
=
new
GetRoleByRoleId
ReqVo
();
RoleGetReqVo
roleGetReqVo
=
new
RoleGet
ReqVo
();
getRoleByRoleId
ReqVo
.
setId
(
roleVo
.
getId
());
roleGet
ReqVo
.
setId
(
roleVo
.
getId
());
List
<
RoleVo
>
childList
=
roleDao
.
getChild
(
getRoleByRoleId
ReqVo
);
List
<
RoleVo
>
childList
=
roleDao
.
getChild
(
roleGet
ReqVo
);
for
(
RoleVo
child:
childList
)
{
for
(
RoleVo
child:
childList
)
{
roleDao
.
remove
(
child
);
roleDao
.
remove
(
child
);
GetRoleAuthorityListByRoleIdReqVo
getRoleAuthorityListByRoleIdReqVo2
=
new
GetRoleAuthorityListByRoleId
ReqVo
();
RoleAuthorityGetReqVo
reqVo1
=
new
RoleAuthorityGet
ReqVo
();
getRoleAuthorityListByRoleIdReqVo
.
setRoleId
(
child
.
getId
());
reqVo1
.
setRoleId
(
child
.
getId
());
List
<
RoleAuthority
Relation
>
roleAuthorityList2
=
roleAuthorityDaoImpl
.
getRoleAuthorityListByRoleId
(
getRoleAuthorityListByRoleIdReqVo2
);
List
<
RoleAuthority
Vo
>
roleAuthorityList2
=
roleAuthorityDaoImpl
.
getRoleAuthorityList
(
reqVo1
);
if
(
roleAuthorityList2
!=
null
&&
roleAuthorityList2
.
size
()
!=
0
){
if
(
roleAuthorityList2
!=
null
&&
roleAuthorityList2
.
size
()
!=
0
){
for
(
RoleAuthority
Relation
roleAuthority:
roleAuthorityList
)
{
for
(
RoleAuthority
Vo
roleAuthority:
roleAuthorityList
)
{
roleAuthorityDaoImpl
.
remove
(
roleAuthority
);
roleAuthorityDaoImpl
.
remove
(
roleAuthority
);
}
}
}
}
}
}
roleDao
.
remove
(
roleVo
);
}
@Override
public
void
delete
(
WebRoleReqVo
webRoleReqVo
)
{
RoleVo
roleVo
=
this
.
getRoleById
(
webRoleReqVo
);
this
.
deleteRole
(
roleVo
);
}
}
}
}
src/main/java/com/pangding/web/authority/service/impl/UserServiceImpl.java
View file @
65d90702
...
@@ -3,12 +3,12 @@ package com.pangding.web.authority.service.impl;
...
@@ -3,12 +3,12 @@ package com.pangding.web.authority.service.impl;
import
com.pangding.web.authority.dao.RoleDao
;
import
com.pangding.web.authority.dao.RoleDao
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.dto.UserDto
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.reqvo.*
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.utils.Md5AndSalt
;
import
com.pangding.web.authority.vo.*
;
import
com.pangding.web.authority.vo.*
;
import
com.yanzuoguang.util.exception.CodeException
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
com.yanzuoguang.util.vo.PageSizeData
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -33,15 +33,23 @@ public class UserServiceImpl implements UserService {
...
@@ -33,15 +33,23 @@ public class UserServiceImpl implements UserService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveUser
(
UserDto
userDto
)
{
public
void
saveUser
(
WebUserReqVo
webUserReqVo
)
{
UserVo
userVo
=
userDto
;
this
.
isValid
(
webUserReqVo
.
getAccount
());
this
.
checkAccount
(
webUserReqVo
);
this
.
checkPhone
(
webUserReqVo
);
webUserReqVo
.
setRemark
(
webUserReqVo
.
getPassword
());
String
md5Password
=
this
.
passwordEncoder
(
webUserReqVo
.
getPassword
());
webUserReqVo
.
setPassword
(
md5Password
);
webUserReqVo
.
setId
(
StringHelper
.
getNewID
());
UserVo
userVo
=
webUserReqVo
;
userDao
.
create
(
userVo
);
userDao
.
create
(
userVo
);
if
(
userDto
.
getRoleIds
()!=
null
&&
userDt
o
.
getRoleIds
().
size
()!=
0
){
if
(
webUserReqVo
.
getRoleIds
()!=
null
&&
webUserReqV
o
.
getRoleIds
().
size
()!=
0
){
List
<
String
>
roleIds
=
userDt
o
.
getRoleIds
();
List
<
String
>
roleIds
=
webUserReqV
o
.
getRoleIds
();
for
(
String
roleId
:
roleIds
)
{
for
(
String
roleId
:
roleIds
)
{
UserRole
Relation
userRoleRelation
=
new
UserRoleRelation
();
UserRole
Vo
userRoleRelation
=
new
UserRoleVo
();
userRoleRelation
.
setRoleId
(
roleId
);
userRoleRelation
.
setRoleId
(
roleId
);
userRoleRelation
.
setUserId
(
userDt
o
.
getId
());
userRoleRelation
.
setUserId
(
webUserReqV
o
.
getId
());
userRoleRelation
.
setId
(
StringHelper
.
getNewID
());
userRoleRelation
.
setId
(
StringHelper
.
getNewID
());
userRoleDao
.
create
(
userRoleRelation
);
userRoleDao
.
create
(
userRoleRelation
);
}
}
...
@@ -50,41 +58,43 @@ public class UserServiceImpl implements UserService {
...
@@ -50,41 +58,43 @@ public class UserServiceImpl implements UserService {
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateUser
(
UserDto
userDto
)
{
public
void
updateUser
(
WebUserReqVo
webUserReqVo
)
{
UserVo
userVo
=
userDto
;
this
.
isValid
(
webUserReqVo
.
getAccount
());
this
.
checkAccount
(
webUserReqVo
);
this
.
checkPhone
(
webUserReqVo
);
webUserReqVo
.
setRemark
(
webUserReqVo
.
getPassword
());
webUserReqVo
.
setPassword
(
this
.
passwordEncoder
(
webUserReqVo
.
getPassword
()));
UserVo
userVo
=
webUserReqVo
;
userDao
.
update
(
userVo
);
userDao
.
update
(
userVo
);
GetUserRoleListByUserIdReqVo
userId
=
new
GetUserRoleListByUserIdReqVo
();
UserRoleGetReqVo
reqVo
=
new
UserRoleGetReqVo
();
userId
.
setUserId
(
userDto
.
getId
());
reqVo
.
setUserId
(
webUserReqVo
.
getId
());
List
<
UserRoleRelation
>
userRoleList
=
userRoleDao
.
getUserRoleListByUserId
(
userId
);
List
<
UserRoleVo
>
userRoleList
=
userRoleDao
.
getUserRoleList
(
reqVo
);
List
<
String
>
userRoleIdList
=
new
ArrayList
(
userRoleList
.
size
());
if
(
userRoleList
!=
null
&&
userRoleList
.
size
()
!=
0
){
for
(
UserRoleRelation
userRole:
userRoleList
)
{
List
<
String
>
userRoleIdList
=
new
ArrayList
(
userRoleList
.
size
());
userRoleIdList
.
add
(
userRole
.
getId
());
for
(
UserRoleVo
userRole:
userRoleList
)
{
}
userRoleIdList
.
add
(
userRole
.
getId
());
if
(
userRoleIdList
!=
null
&&
userRoleIdList
.
size
()
!=
0
){
for
(
String
userRoleId:
userRoleIdList
){
UserRoleDaoRemoveReqVo
userRole
=
new
UserRoleDaoRemoveReqVo
();
userRole
.
setId
(
userRoleId
);
userRoleDao
.
remove
(
userRole
);
}
}
}
if
(
userRoleIdList
!=
null
&&
userRoleIdList
.
size
()
!=
0
){
if
(
userDto
.
getRoleIds
()!=
null
&&
userDto
.
getRoleIds
().
size
()!=
0
){
for
(
String
userRoleId:
userRoleIdList
){
List
<
String
>
roleIds
=
userDto
.
getRoleIds
();
UserRoleRemoveReqVo
userRole
=
new
UserRoleRemoveReqVo
();
for
(
String
roleId
:
roleIds
)
{
userRole
.
setId
(
userRoleId
);
UserRoleRelation
userRoleRelation
=
new
UserRoleRelation
();
userRoleDao
.
remove
(
userRole
);
userRoleRelation
.
setRoleId
(
roleId
);
}
userRoleRelation
.
setUserId
(
userDto
.
getId
());
}
userRoleRelation
.
setId
(
StringHelper
.
getNewID
());
if
(
webUserReqVo
.
getRoleIds
()!=
null
&&
webUserReqVo
.
getRoleIds
().
size
()!=
0
){
userRoleDao
.
create
(
userRoleRelation
);
List
<
String
>
roleIds
=
webUserReqVo
.
getRoleIds
();
for
(
String
roleId
:
roleIds
)
{
UserRoleVo
userRoleRelation
=
new
UserRoleVo
();
userRoleRelation
.
setRoleId
(
roleId
);
userRoleRelation
.
setUserId
(
webUserReqVo
.
getId
());
userRoleRelation
.
setId
(
StringHelper
.
getNewID
());
userRoleDao
.
create
(
userRoleRelation
);
}
}
}
}
}
}
}
@Override
public
List
<
UserVo
>
listUserVo
()
{
return
userDao
.
listUserVo
();
}
@Override
@Override
public
void
checkAccount
(
UserVo
userVo
)
{
public
void
checkAccount
(
UserVo
userVo
)
{
userDao
.
checkAccount
(
userVo
);
userDao
.
checkAccount
(
userVo
);
...
@@ -96,40 +106,60 @@ public class UserServiceImpl implements UserService {
...
@@ -96,40 +106,60 @@ public class UserServiceImpl implements UserService {
}
}
@Override
@Override
public
String
passwordEncoder
(
String
password
)
{
return
Md5AndSalt
.
generate
(
password
);
}
public
String
passwordEncoder
(
String
password
)
{
return
StringHelper
.
md5
(
password
);
}
@Override
@Override
public
UserDto
makeUserDto
(
UserVo
userVo
,
List
<
String
>
roleIdList
,
List
<
String
>
roleNameList
)
{
public
WebUserResVo
makeResVo
(
UserVo
userVo
)
{
UserDto
userDto
=
new
UserDto
();
userDto
.
setPassword
(
userVo
.
getPassword
());
WebUserResVo
resVo
=
new
WebUserResVo
();
userDto
.
setAccount
(
userVo
.
getAccount
());
resVo
.
setPassword
(
userVo
.
getPassword
());
userDto
.
setCreateTime
(
userVo
.
getCreateTime
());
resVo
.
setAccount
(
userVo
.
getAccount
());
userDto
.
setCreator
(
userVo
.
getCreator
());
resVo
.
setCreateTime
(
userVo
.
getCreateTime
());
userDto
.
setId
(
userVo
.
getId
());
resVo
.
setCreator
(
userVo
.
getCreator
());
userDto
.
setPhone
(
userVo
.
getPhone
());
resVo
.
setId
(
userVo
.
getId
());
userDto
.
setRemark
(
userVo
.
getRemark
());
resVo
.
setPhone
(
userVo
.
getPhone
());
userDto
.
setStatus
(
userVo
.
getStatus
());
resVo
.
setRemark
(
userVo
.
getRemark
());
userDto
.
setRoleIds
(
roleIdList
);
resVo
.
setStatus
(
userVo
.
getStatus
());
userDto
.
setRoles
(
roleNameList
);
return
userDto
;
UserRoleGetReqVo
reqVo
=
new
UserRoleGetReqVo
();
reqVo
.
setUserId
(
userVo
.
getId
());
List
<
UserRoleVo
>
userRoleVoList
=
this
.
listUserRoleListByUserId
(
reqVo
);
if
(
userRoleVoList
!=
null
&&
userRoleVoList
.
size
()
!=
0
){
List
<
RoleVo
>
roleList
=
new
ArrayList
(
userRoleVoList
.
size
());
for
(
UserRoleVo
userRoleRelation:
userRoleVoList
)
{
String
roleId
=
userRoleRelation
.
getRoleId
();
RoleGetReqVo
roleGetReqVo
=
new
RoleGetReqVo
();
roleGetReqVo
.
setId
(
roleId
);
RoleVo
roleVo
=
roleDao
.
load
(
roleGetReqVo
,
RoleVo
.
class
);
roleList
.
add
(
roleVo
);
}
resVo
.
setRoleList
(
roleList
);
}
return
resVo
;
}
}
@Override
@Override
public
UserVo
getUserById
(
String
userId
)
{
public
WebUserResVo
getUserById
(
String
userId
)
{
GetUserByIdReqVo
id
=
new
GetUserByIdReqVo
();
UserGetReqVo
reqVo
=
new
UserGetReqVo
();
id
.
setId
(
userId
);
reqVo
.
setId
(
userId
);
return
userDao
.
getUserById
(
id
);
UserVo
userVo
=
userDao
.
getUser
(
reqVo
);
if
(
userVo
==
null
){
throw
new
CodeException
(
"该用户不存在"
);
}
WebUserResVo
resVo
=
this
.
makeResVo
(
userVo
);
return
resVo
;
}
}
@Override
@Override
public
List
<
UserRole
Relation
>
listUserRoleListByUserId
(
GetUserRoleListByUserId
ReqVo
reqVo
)
{
public
List
<
UserRole
Vo
>
listUserRoleListByUserId
(
UserRoleGet
ReqVo
reqVo
)
{
return
userRoleDao
.
getUserRoleList
ByUserId
(
reqVo
);
return
userRoleDao
.
getUserRoleList
(
reqVo
);
}
}
@Override
@Override
public
RoleVo
getRoleByRoleId
(
GetRoleByRoleIdReqVo
getRoleByRoleId
ReqVo
)
{
public
RoleVo
getRoleByRoleId
(
RoleGetReqVo
roleGet
ReqVo
)
{
return
roleDao
.
getRoleById
(
getRoleByRoleId
ReqVo
);
return
roleDao
.
getRoleById
(
roleGet
ReqVo
);
}
}
@Override
@Override
...
@@ -144,22 +174,80 @@ public class UserServiceImpl implements UserService {
...
@@ -144,22 +174,80 @@ public class UserServiceImpl implements UserService {
}
}
@Override
@Override
public
Boolean
isValid
(
String
account
)
{
public
void
isValid
(
String
account
)
{
String
regex
=
"^(?!\\d+$)[\\da-zA-Z]+$"
;
String
regex
=
"^(?!\\d+$)[\\da-zA-Z]+$"
;
return
account
.
matches
(
regex
);
if
(!
account
.
matches
(
regex
)){
throw
new
CodeException
(
"用户名仅支持字母和数字的组合,且不能为纯数字"
);
}
}
}
@Override
@Override
public
UserVo
getUserByPhone
(
String
phone
)
{
public
UserVo
getUserByPhone
(
String
phone
)
{
GetUserByPhoneReqVo
getUserByPhoneReqVo
=
new
GetUserByPhone
ReqVo
();
UserGetReqVo
reqVo
=
new
UserGet
ReqVo
();
getUserByPhoneR
eqVo
.
setPhone
(
phone
);
r
eqVo
.
setPhone
(
phone
);
return
userDao
.
load
(
getUserByPhoneR
eqVo
,
UserVo
.
class
);
return
userDao
.
load
(
r
eqVo
,
UserVo
.
class
);
}
}
@Override
@Override
public
UserVo
getUserByAccount
(
String
account
)
{
public
UserVo
getUserByAccount
(
String
account
)
{
GetUserByAccountReqVo
getUserByAccountReqVo
=
new
GetUserByAccountReqVo
();
UserGetReqVo
userGetReqVo
=
new
UserGetReqVo
();
getUserByAccountReqVo
.
setAccount
(
account
);
userGetReqVo
.
setAccount
(
account
);
return
userDao
.
load
(
getUserByAccountReqVo
,
UserVo
.
class
);
return
userDao
.
load
(
userGetReqVo
,
UserVo
.
class
);
}
@Override
public
PageSizeData
<
UserVo
>
getUserVoList
(
ListUserReqVo
reqVo
)
{
PageSizeData
<
UserVo
>
userVoPageSizeData
=
userDao
.
getUserVoList
(
reqVo
);
if
(
userVoPageSizeData
.
getList
()
==
null
||
userVoPageSizeData
.
getList
().
size
()
==
0
){
throw
new
CodeException
(
"没有更多用户"
);
}
return
userVoPageSizeData
;
}
@Override
public
PageSizeData
<
WebUserResVo
>
getWebUserResVoList
(
ListUserReqVo
reqVo
)
{
PageSizeData
<
UserVo
>
userVoPageSizeData
=
this
.
getUserVoList
(
reqVo
);
PageSizeData
<
WebUserResVo
>
webUserResVoPageSizeData
=
new
PageSizeData
();
List
<
UserVo
>
userVoList
=
userVoPageSizeData
.
getList
();
List
<
WebUserResVo
>
webUserResVoList
=
new
ArrayList
(
userVoList
.
size
());
for
(
UserVo
userVo:
userVoList
)
{
WebUserResVo
resVo
=
new
WebUserResVo
();
List
<
RoleVo
>
roleVoList
=
this
.
getRoleListByUserId
(
userVo
.
getId
());
resVo
.
setRoleList
(
roleVoList
);
resVo
.
setAccount
(
userVo
.
getAccount
());
resVo
.
setCompanyId
(
userVo
.
getCompanyId
());
resVo
.
setCreateTime
(
userVo
.
getCreateTime
());
resVo
.
setCreator
(
userVo
.
getCreator
());
resVo
.
setId
(
userVo
.
getId
());
resVo
.
setPhone
(
userVo
.
getPhone
());
resVo
.
setStatus
(
userVo
.
getStatus
());
webUserResVoList
.
add
(
resVo
);
}
webUserResVoPageSizeData
.
setPageTotal
(
webUserResVoPageSizeData
.
getPageTotal
());
webUserResVoPageSizeData
.
setList
(
webUserResVoList
);
webUserResVoPageSizeData
.
setPageIndex
(
webUserResVoPageSizeData
.
getPageIndex
());
webUserResVoPageSizeData
.
setPageSize
(
webUserResVoPageSizeData
.
getPageSize
());
return
webUserResVoPageSizeData
;
}
@Override
public
List
<
RoleVo
>
getRoleListByUserId
(
String
userId
)
{
UserRoleGetReqVo
reqVo
=
new
UserRoleGetReqVo
();
reqVo
.
setUserId
(
userId
);
List
<
UserRoleVo
>
userRoleVoList
=
userRoleDao
.
getUserRoleList
(
reqVo
);
if
(
userRoleVoList
!=
null
&&
userRoleVoList
.
size
()
!=
0
){
List
<
RoleVo
>
roleVoList
=
new
ArrayList
(
userRoleVoList
.
size
());
for
(
UserRoleVo
userRoleVo:
userRoleVoList
)
{
RoleGetReqVo
roleGetReqVo
=
new
RoleGetReqVo
();
roleGetReqVo
.
setId
(
userRoleVo
.
getRoleId
());
RoleVo
roleVo
=
roleDao
.
load
(
roleGetReqVo
,
RoleVo
.
class
);
roleVoList
.
add
(
roleVo
);
}
return
roleVoList
;
}
return
null
;
}
}
}
}
src/main/java/com/pangding/web/authority/utils/Md5AndSalt.java
deleted
100644 → 0
View file @
fd52bb0e
package
com
.
pangding
.
web
.
authority
.
utils
;
import
org.apache.commons.codec.binary.Hex
;
import
java.security.MessageDigest
;
import
java.util.Random
;
/**
* @author 源自网络
*/
public
class
Md5AndSalt
{
public
static
String
generate
(
String
password
)
{
Random
r
=
new
Random
();
StringBuilder
sb
=
new
StringBuilder
(
16
);
sb
.
append
(
r
.
nextInt
(
99999999
)).
append
(
r
.
nextInt
(
99999999
));
int
len
=
sb
.
length
();
int
defaultLen
=
16
;
if
(
len
<
defaultLen
)
{
for
(
int
i
=
0
;
i
<
defaultLen
-
len
;
i
++)
{
sb
.
append
(
"0"
);
}
}
String
salt
=
sb
.
toString
();
password
=
md5Hex
(
password
+
salt
);
char
[]
cs
=
new
char
[
48
];
int
bound
=
48
;
int
step
=
3
;
for
(
int
i
=
0
;
i
<
bound
;
i
+=
step
)
{
cs
[
i
]
=
password
.
charAt
(
i
/
3
*
2
);
char
c
=
salt
.
charAt
(
i
/
3
);
cs
[
i
+
1
]
=
c
;
cs
[
i
+
2
]
=
password
.
charAt
(
i
/
3
*
2
+
1
);
}
return
new
String
(
cs
);
}
/**
* 获取十六进制字符串形式的MD5摘要
*/
private
static
String
md5Hex
(
String
src
)
{
try
{
MessageDigest
md5
=
MessageDigest
.
getInstance
(
"MD5"
);
byte
[]
bs
=
md5
.
digest
(
src
.
getBytes
());
return
new
String
(
new
Hex
().
encode
(
bs
));
}
catch
(
Exception
e
)
{
return
null
;
}
}
public
static
boolean
verify
(
String
password
,
String
md5
)
{
char
[]
cs1
=
new
char
[
32
];
char
[]
cs2
=
new
char
[
16
];
int
bound
=
48
;
int
step
=
3
;
for
(
int
i
=
0
;
i
<
bound
;
i
+=
step
)
{
cs1
[
i
/
3
*
2
]
=
md5
.
charAt
(
i
);
cs1
[
i
/
3
*
2
+
1
]
=
md5
.
charAt
(
i
+
2
);
cs2
[
i
/
3
]
=
md5
.
charAt
(
i
+
1
);
}
String
salt
=
new
String
(
cs2
);
return
md5Hex
(
password
+
salt
).
equals
(
new
String
(
cs1
));
}
}
src/main/java/com/pangding/web/authority/vo/RoleAuthority
Relation
.java
→
src/main/java/com/pangding/web/authority/vo/RoleAuthority
Vo
.java
View file @
65d90702
...
@@ -9,7 +9,7 @@ import java.io.Serializable;
...
@@ -9,7 +9,7 @@ import java.io.Serializable;
* @author zhangjinyao
* @author zhangjinyao
*/
*/
@TableAnnotation
(
"pd_role_authority"
)
@TableAnnotation
(
"pd_role_authority"
)
public
class
RoleAuthority
Relation
implements
Serializable
{
public
class
RoleAuthority
Vo
implements
Serializable
{
private
String
id
;
private
String
id
;
...
...
src/main/java/com/pangding/web/authority/vo/UserRole
Relation
.java
→
src/main/java/com/pangding/web/authority/vo/UserRole
Vo
.java
View file @
65d90702
...
@@ -8,7 +8,7 @@ import java.io.Serializable;
...
@@ -8,7 +8,7 @@ import java.io.Serializable;
* @author zhangjinyao
* @author zhangjinyao
*/
*/
@TableAnnotation
(
"pd_user_role"
)
@TableAnnotation
(
"pd_user_role"
)
public
class
UserRole
Relation
implements
Serializable
{
public
class
UserRole
Vo
implements
Serializable
{
private
String
id
;
private
String
id
;
...
...
src/main/java/com/pangding/web/authority/
reqvo/GetAuthorityById
ReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/AuthorityGet
ReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
/**
* @Author zhangjinyao
* @Author zhangjinyao
* @create 2019/5/11 15:05
* @create 2019/5/11 15:05
*/
*/
public
class
GetAuthorityById
ReqVo
{
public
class
AuthorityGet
ReqVo
{
private
String
id
;
private
String
id
;
private
String
pid
;
public
String
getPid
()
{
return
pid
;
}
public
void
setPid
(
String
pid
)
{
this
.
pid
=
pid
;
}
public
String
getId
()
{
public
String
getId
()
{
return
id
;
return
id
;
}
}
...
...
src/main/java/com/pangding/web/authority/vo/reqvo/ListAuthorityReqVo.java
0 → 100644
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
com.yanzuoguang.util.vo.PageSizeReqVo
;
/**
* @Author zhangjinyao
* @create 2019/5/15 20:03
*/
public
class
ListAuthorityReqVo
extends
PageSizeReqVo
{
private
String
exist
;
public
String
getExist
()
{
return
exist
;
}
public
void
setExist
(
String
exist
)
{
this
.
exist
=
exist
;
}
}
src/main/java/com/pangding/web/authority/vo/reqvo/ListRoleReqVo.java
0 → 100644
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
com.yanzuoguang.util.vo.PageSizeReqVo
;
/**
* @Author zhangjinyao
* @create 2019/5/15 17:54
*/
public
class
ListRoleReqVo
extends
PageSizeReqVo
{
}
src/main/java/com/pangding/web/authority/vo/reqvo/ListUserReqVo.java
0 → 100644
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
com.yanzuoguang.util.vo.PageSizeReqVo
;
/**
* @Author zhangjinyao
* @create 2019/5/15 19:17
*/
public
class
ListUserReqVo
extends
PageSizeReqVo
{
}
src/main/java/com/pangding/web/authority/
reqvo/GetRoleAuthorityListByAuthorityId
ReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/RoleAuthorityGet
ReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
/**
* @Author zhangjinyao
* @Author zhangjinyao
* @create 2019/5/11 16:41
* @create 2019/5/11 16:41
*/
*/
public
class
GetRoleAuthorityListByAuthorityId
ReqVo
{
public
class
RoleAuthorityGet
ReqVo
{
private
String
authorityId
;
private
String
authorityId
;
private
String
roleId
;
public
String
getRoleId
()
{
return
roleId
;
}
public
void
setRoleId
(
String
roleId
)
{
this
.
roleId
=
roleId
;
}
public
String
getAuthorityId
()
{
public
String
getAuthorityId
()
{
return
authorityId
;
return
authorityId
;
}
}
...
...
src/main/java/com/pangding/web/authority/
reqvo/GetRoleByRoleName
ReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/RoleGet
ReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
/**
* @Author zhangjinyao
* @Author zhangjinyao
* @create 2019/5/10 20:
27
* @create 2019/5/10 20:
09
*/
*/
public
class
GetRoleByRoleNameReqVo
{
public
class
RoleGetReqVo
{
private
String
id
;
private
String
name
;
private
String
name
;
public
String
getName
()
{
public
String
getName
()
{
...
@@ -14,4 +16,12 @@ public class GetRoleByRoleNameReqVo {
...
@@ -14,4 +16,12 @@ public class GetRoleByRoleNameReqVo {
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
}
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
}
}
src/main/java/com/pangding/web/authority/
reqvo/GetUserByAccoun
tReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/UserGe
tReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
...
@@ -7,9 +7,39 @@ import org.springframework.context.annotation.Bean;
...
@@ -7,9 +7,39 @@ import org.springframework.context.annotation.Bean;
* @create 2019/5/10 17:17
* @create 2019/5/10 17:17
*/
*/
public
class
GetUserByAccoun
tReqVo
{
public
class
UserGe
tReqVo
{
private
String
account
;
private
String
account
;
private
String
companyId
;
private
String
id
;
private
String
phone
;
public
String
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
String
companyId
)
{
this
.
companyId
=
companyId
;
}
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
public
String
getAccount
()
{
public
String
getAccount
()
{
return
account
;
return
account
;
}
}
...
...
src/main/java/com/pangding/web/authority/
reqvo/GetUserRoleListByRoleId
ReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/UserRoleGet
ReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
/**
* @Author zhangjinyao
* @Author zhangjinyao
* @create 2019/5/11 15:37
* @create 2019/5/11 15:37
*/
*/
public
class
GetUserRoleListByRoleId
ReqVo
{
public
class
UserRoleGet
ReqVo
{
private
String
roleId
;
private
String
roleId
;
private
String
userId
;
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getRoleId
()
{
public
String
getRoleId
()
{
return
roleId
;
return
roleId
;
}
}
...
...
src/main/java/com/pangding/web/authority/
reqvo/UserRoleDao
RemoveReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/UserRole
RemoveReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
/**
* @Author zhangjinyao
* @Author zhangjinyao
* @create 2019/5/10 19:47
* @create 2019/5/10 19:47
*/
*/
public
class
UserRole
Dao
RemoveReqVo
{
public
class
UserRoleRemoveReqVo
{
private
String
id
;
private
String
id
;
public
String
getId
()
{
public
String
getId
()
{
...
...
src/main/java/com/pangding/web/authority/
reqvo/GetRoleByRoleId
ReqVo.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/WebAuthority
ReqVo.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
reqvo
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
/**
/**
* @Author zhangjinyao
* @Author zhangjinyao
* @create 2019/5/1
0 20:0
9
* @create 2019/5/1
5 15:5
9
*/
*/
public
class
GetRoleByRoleId
ReqVo
{
public
class
WebAuthority
ReqVo
{
private
String
id
;
private
String
id
;
public
String
getId
()
{
public
String
getId
()
{
...
...
src/main/java/com/pangding/web/authority/vo/reqvo/WebAuthorityResVo.java
0 → 100644
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
/**
* @Author zhangjinyao
* @create 2019/5/15 20:06
*/
public
class
WebAuthorityResVo
extends
AuthorityVo
{
}
src/main/java/com/pangding/web/authority/
dto/RoleDt
o.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/WebRoleReqV
o.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dt
o
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqv
o
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.RoleVo
;
...
@@ -7,13 +7,10 @@ import java.util.List;
...
@@ -7,13 +7,10 @@ import java.util.List;
/**
/**
* @author zhangjinyao
* @author zhangjinyao
*/
*/
public
class
RoleDt
o
extends
RoleVo
{
public
class
WebRoleReqV
o
extends
RoleVo
{
private
List
<
String
>
authorityIds
;
private
List
<
String
>
authorityIds
;
private
List
<
String
>
authorityNames
;
public
List
<
String
>
getAuthorityIds
()
{
public
List
<
String
>
getAuthorityIds
()
{
return
authorityIds
;
return
authorityIds
;
}
}
...
@@ -22,11 +19,4 @@ public class RoleDto extends RoleVo {
...
@@ -22,11 +19,4 @@ public class RoleDto extends RoleVo {
this
.
authorityIds
=
authorityIds
;
this
.
authorityIds
=
authorityIds
;
}
}
public
List
<
String
>
getAuthorityNames
()
{
return
authorityNames
;
}
public
void
setAuthorityNames
(
List
<
String
>
authorityNames
)
{
this
.
authorityNames
=
authorityNames
;
}
}
}
src/main/java/com/pangding/web/authority/vo/reqvo/WebRoleResVo.java
0 → 100644
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
com.pangding.web.authority.vo.AuthorityVo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
java.util.List
;
/**
* @author zhangjinyao
*/
public
class
WebRoleResVo
extends
RoleVo
{
private
List
<
AuthorityVo
>
authorityList
;
public
List
<
AuthorityVo
>
getAuthorityList
()
{
return
authorityList
;
}
public
void
setAuthorityList
(
List
<
AuthorityVo
>
authorityList
)
{
this
.
authorityList
=
authorityList
;
}
}
src/main/java/com/pangding/web/authority/
dto/UserDt
o.java
→
src/main/java/com/pangding/web/authority/
vo/reqvo/WebUserReqV
o.java
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
dt
o
;
package
com
.
pangding
.
web
.
authority
.
vo
.
reqv
o
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.pangding.web.authority.vo.UserVo
;
...
@@ -7,12 +7,10 @@ import java.util.List;
...
@@ -7,12 +7,10 @@ import java.util.List;
/**
/**
* @author zhangjinyao
* @author zhangjinyao
*/
*/
public
class
UserDt
o
extends
UserVo
{
public
class
WebUserReqV
o
extends
UserVo
{
private
List
<
String
>
roleIds
;
private
List
<
String
>
roleIds
;
private
List
<
String
>
roles
;
public
List
<
String
>
getRoleIds
()
{
public
List
<
String
>
getRoleIds
()
{
return
roleIds
;
return
roleIds
;
}
}
...
@@ -21,11 +19,4 @@ public class UserDto extends UserVo {
...
@@ -21,11 +19,4 @@ public class UserDto extends UserVo {
this
.
roleIds
=
roleIds
;
this
.
roleIds
=
roleIds
;
}
}
public
List
<
String
>
getRoles
()
{
return
roles
;
}
public
void
setRoles
(
List
<
String
>
roles
)
{
this
.
roles
=
roles
;
}
}
}
src/main/java/com/pangding/web/authority/vo/reqvo/WebUserResVo.java
0 → 100644
View file @
65d90702
package
com
.
pangding
.
web
.
authority
.
vo
.
reqvo
;
import
com.pangding.web.authority.vo.RoleVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
java.util.List
;
/**
* @author zhangjinyao
*/
public
class
WebUserResVo
extends
UserVo
{
private
List
<
RoleVo
>
roleList
;
public
List
<
RoleVo
>
getRoleList
()
{
return
roleList
;
}
public
void
setRoleList
(
List
<
RoleVo
>
roleList
)
{
this
.
roleList
=
roleList
;
}
}
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