修复shiro拦截后,退出出错bug,修复角色组问题
This commit is contained in:
@@ -73,6 +73,7 @@ public class ShiroRealmConfig implements SystemRealm {
|
||||
// druid 资源路径
|
||||
map.put("/druid/**",ShiroType.ANON);
|
||||
map.put("/cas/valid",ShiroType.ANON);
|
||||
map.put("/cas/logout",ShiroType.ANON);
|
||||
// 其余路径均拦截
|
||||
map.put("/**", ShiroType.AUTH);
|
||||
return map;
|
||||
|
||||
@@ -57,20 +57,20 @@ public class RoleGroupController {
|
||||
@PostMapping("bind")
|
||||
@ApiOperation(value = "绑定角色组")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleGroupId", value = "角色组ID",required = true),
|
||||
@ApiImplicitParam(name = "groupId", value = "角色组ID",required = true),
|
||||
@ApiImplicitParam(name = "roleIds", value = "角色ID数组",required = true)
|
||||
})
|
||||
public ResultVO<Object> bind(Integer roleGroupId, String roleIds) {
|
||||
return roleGroupServie.bind(roleGroupId, roleIds);
|
||||
public ResultVO<Object> bind(Integer groupId, String roleIds) {
|
||||
return roleGroupServie.bind(groupId, roleIds);
|
||||
}
|
||||
|
||||
@GetMapping("getRoles")
|
||||
@ApiOperation(value = "绑定角色组")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roleGroupId", value = "角色组ID",required = true),
|
||||
@ApiImplicitParam(name = "groupId", value = "角色组ID",required = true),
|
||||
})
|
||||
public ResultVO<Object> getRoles(Integer roleGroupId) {
|
||||
return roleGroupServie.getRoles(roleGroupId);
|
||||
public ResultVO<Object> getRoles(Integer groupId) {
|
||||
return roleGroupServie.getRoles(groupId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,5 +26,5 @@ public interface RoleGroupServie {
|
||||
|
||||
ResultVO<Object> bind(Integer roleGroupId, String roleIds);
|
||||
|
||||
ResultVO<Object> getRoles(Integer roleGroupId);
|
||||
ResultVO<Object> getRoles(Integer groupId);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.hcframe.user.module.auth.service.RoleGroupServie;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -81,6 +82,9 @@ public class RoleGroupServiceImpl implements RoleGroupServie {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Object> bind(Integer roleGroupId, String roleIds) {
|
||||
baseMapper.deleteByCondition(OS_REL_GROUP_ROLE, Condition.creatCriteria().andEqual(PK_ID,roleGroupId).build());
|
||||
if (StringUtils.isEmpty(roleIds)) {
|
||||
return ResultVO.getSuccess();
|
||||
}
|
||||
for (String str : roleIds.split(COMMA)) {
|
||||
Integer roleId = Integer.parseInt(str);
|
||||
DataMap<Object> dataMap = DataMap
|
||||
@@ -96,10 +100,10 @@ public class RoleGroupServiceImpl implements RoleGroupServie {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultVO<Object> getRoles(Integer roleGroupId) {
|
||||
JudgeException.isNull(roleGroupId,"roleGroupId 不能为空!");
|
||||
public ResultVO<Object> getRoles(Integer groupId) {
|
||||
JudgeException.isNull(groupId,"roleGroupId 不能为空!");
|
||||
Map<String, Object> map = new HashMap<>(1);
|
||||
map.put(ROLE_GROUP_ID, roleGroupId);
|
||||
map.put(PK_ID, groupId);
|
||||
List<Map<String, Object>> list = baseMapper.selectByEqual(OS_REL_GROUP_ROLE,map);
|
||||
return ResultVO.getSuccess(list);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user