merge
This commit is contained in:
@@ -22,7 +22,7 @@ import java.util.stream.Collectors;
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 13:20
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
* 说明: 权限服务层
|
||||
*/
|
||||
@Service
|
||||
public class SysAuthorityService {
|
||||
@@ -142,6 +142,8 @@ public class SysAuthorityService {
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> listByParentEnable(String parentId, String enable) {
|
||||
if(StringUtils.isEmpty(parentId))
|
||||
parentId=CommonConstant.ROOT;
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
return sysAuthorityRepository.getByParentIdAndEnable(parentId, enable);
|
||||
else
|
||||
@@ -177,7 +179,7 @@ public class SysAuthorityService {
|
||||
* @return
|
||||
*/
|
||||
public boolean disableChildrenByParentId(String parentId) {
|
||||
List<SysAuthority> sysAuthorities = listChildren(parentId);
|
||||
List<SysAuthority> sysAuthorities = disableChildren(parentId);
|
||||
if (CollectionUtils.isNotEmpty(sysAuthorities)) {
|
||||
List<SysAuthority> save = sysAuthorityRepository.save(sysAuthorities);
|
||||
return CollectionUtils.isNotEmpty(save);
|
||||
@@ -186,7 +188,7 @@ public class SysAuthorityService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归查询所有节点(包括禁用)
|
||||
* 根据状态递归查询所有节点
|
||||
*
|
||||
* @param parentId
|
||||
* @param enable
|
||||
@@ -216,7 +218,7 @@ public class SysAuthorityService {
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
private List<SysAuthority> listChildren(String parentId) {
|
||||
private List<SysAuthority> disableChildren(String parentId) {
|
||||
//获取结果
|
||||
List<SysAuthority> sysAuthoritys = listByParentEnable(parentId, CommonConstant.ISENABLE);
|
||||
//遍历子集
|
||||
@@ -226,7 +228,7 @@ public class SysAuthorityService {
|
||||
sysAuthority.setEnable(CommonConstant.ISNOTENABLE);
|
||||
sysAuthority.setModifiedTime(new Date());
|
||||
list.add(sysAuthority);
|
||||
list.addAll(listChildren(sysAuthority.getId()));
|
||||
list.addAll(disableChildren(sysAuthority.getId()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -246,7 +248,7 @@ public class SysAuthorityService {
|
||||
if (CollectionUtils.isNotEmpty(sysAuthoritys)) {
|
||||
for (SysAuthority sysAuthority : sysAuthoritys) {
|
||||
list.add(sysAuthority);
|
||||
list.addAll(listChildren(sysAuthority.getId()));
|
||||
list.addAll(listChildrenForRemove(sysAuthority.getId()));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 15:15
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
* 说明: 角色权限服务层
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleAuthorityService {
|
||||
@@ -37,7 +37,7 @@ public class SysRoleAuthorityService {
|
||||
if (CollectionUtils.isNotEmpty(roleAuthorities)) {
|
||||
sysRoleAuthorityRepository.deleteInBatch(roleAuthorities);
|
||||
}
|
||||
//角色新增权限
|
||||
//新增角色权限
|
||||
list.forEach(roleAuthority -> {
|
||||
roleAuthority.setId(PassWordUtil.createId());
|
||||
roleAuthority.setModifiedTime(new Date());
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 9:24
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
* 说明: 角色服务层
|
||||
*/
|
||||
@Service
|
||||
public class SysRoleService {
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.List;
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2017/11/14 14:15
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
* 说明: 用户角色服务层
|
||||
*/
|
||||
@Service
|
||||
public class SysUserRoleService {
|
||||
@@ -37,7 +37,7 @@ public class SysUserRoleService {
|
||||
if (CollectionUtils.isNotEmpty(sysUserRoles)) {
|
||||
sysUserRoleRepository.deleteInBatch(sysUserRoles);
|
||||
}
|
||||
//用户新增角色
|
||||
//新增用户角色
|
||||
list.forEach(sysUserRole -> {
|
||||
sysUserRole.setId(PassWordUtil.createId());
|
||||
sysUserRole.setCreateTime(new Date());
|
||||
|
||||
@@ -347,7 +347,7 @@ public class SysUserService {
|
||||
* @return
|
||||
*/
|
||||
private boolean checkPassWord(String passWord, String realPassWord, String salt) {
|
||||
// 根据密码盐值, 解码
|
||||
// 根据密码盐值 解码
|
||||
byte[] saltByte = EncodeUtils.hexDecode(salt);
|
||||
byte[] hashPassword = Digests.sha1(passWord.getBytes(), saltByte,
|
||||
PassWordUtil.HASH_INTERATIONS);
|
||||
|
||||
@@ -24,7 +24,7 @@ public class JSONObjResult {
|
||||
/**
|
||||
* 消息体
|
||||
*/
|
||||
private String message = "未知异常";
|
||||
private String message = "";
|
||||
/**
|
||||
* 返回数据
|
||||
*/
|
||||
|
||||
@@ -15,5 +15,4 @@ public class RestMessage implements Serializable {
|
||||
private String message;// 成功、错误返回提示信息
|
||||
private Object data;// 返回的数据
|
||||
private String id;// 新增、修改主鍵返回id
|
||||
private Integer code;//错误码
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user