角色修改
This commit is contained in:
@@ -32,14 +32,6 @@ public class RoleController {
|
|||||||
private final RoleService roleService;
|
private final RoleService roleService;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("获取单个role")
|
|
||||||
@GetMapping(value = "/all")
|
|
||||||
// @SaCheckPermission("roles:list")
|
|
||||||
public ResponseEntity<Object> query() {
|
|
||||||
List<RoleVo> roles = roleService.findRoles(null, RoleVo.class);
|
|
||||||
return new ResponseEntity<>(roles, HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询角色")
|
@ApiOperation("查询角色")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@SaCheckPermission("roles:list")
|
@SaCheckPermission("roles:list")
|
||||||
|
|||||||
@@ -44,13 +44,6 @@ public interface RoleService {
|
|||||||
*/
|
*/
|
||||||
JSONObject queryAll(Map whereJson, Pageable page);
|
JSONObject queryAll(Map whereJson, Pageable page);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID查询
|
|
||||||
* @param id /
|
|
||||||
* @return /
|
|
||||||
*/
|
|
||||||
<T> List<T> findRoles(Long id, Class<T>target);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建
|
* 创建
|
||||||
* @param form /
|
* @param form /
|
||||||
@@ -69,27 +62,6 @@ public interface RoleService {
|
|||||||
*/
|
*/
|
||||||
void delete(Set<Long> ids);
|
void delete(Set<Long> ids);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户ID查询
|
|
||||||
* @param id 用户ID
|
|
||||||
* @return /
|
|
||||||
*/
|
|
||||||
List<RoleSmallDto> findByUsersId(Long id);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改绑定的菜单
|
|
||||||
* @param resources /
|
|
||||||
* @param roleDTO /
|
|
||||||
*/
|
|
||||||
void updateMenu(Role resources, RoleDto roleDTO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解绑菜单
|
|
||||||
* @param id /
|
|
||||||
*/
|
|
||||||
void untiedMenu(Long id);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id获取用户的权限
|
* 通过id获取用户的权限
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import org.nl.modules.system.domain.Role;
|
|||||||
import org.nl.modules.system.domain.User;
|
import org.nl.modules.system.domain.User;
|
||||||
import org.nl.modules.system.service.RoleService;
|
import org.nl.modules.system.service.RoleService;
|
||||||
import org.nl.modules.system.service.dto.RoleDto;
|
import org.nl.modules.system.service.dto.RoleDto;
|
||||||
import org.nl.modules.system.service.dto.RoleQueryCriteria;
|
|
||||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
import org.nl.modules.system.service.dto.RoleSmallDto;
|
||||||
import org.nl.modules.wql.WQL;
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.ResultBean;
|
import org.nl.modules.wql.core.bean.ResultBean;
|
||||||
@@ -73,18 +72,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public <T> List<T> findRoles(Long id, Class<T> target) {
|
|
||||||
String sql = "is_used = '1' and is_delete = '0' ";
|
|
||||||
if (id != null) {
|
|
||||||
sql = sql + "role_id = '" + id + "'";
|
|
||||||
}
|
|
||||||
JSONArray array = WQLObject.getWQLObject("sys_role").query(sql).getResultJSONArray(0);
|
|
||||||
return array.toJavaList(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(JSONObject form) {
|
public void create(JSONObject form) {
|
||||||
@@ -130,17 +117,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
roleTab.update(form);
|
roleTab.update(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateMenu(Role resources, RoleDto roleDTO) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public void untiedMenu(Long menuId) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(Set<Long> ids) {
|
public void delete(Set<Long> ids) {
|
||||||
@@ -152,12 +128,6 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<RoleSmallDto> findByUsersId(Long id) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPermissionList(JSONObject userDto) {
|
public List<String> getPermissionList(JSONObject userDto) {
|
||||||
List<String> permission = new LinkedList<>();
|
List<String> permission = new LinkedList<>();
|
||||||
@@ -174,21 +144,4 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 清理缓存
|
|
||||||
*
|
|
||||||
* @param id /
|
|
||||||
*/
|
|
||||||
public void delCaches(Long id, List<User> users) {
|
|
||||||
// users = CollectionUtil.isEmpty(users) ? userRepository.findByRoleId(id) : users;
|
|
||||||
if (CollectionUtil.isNotEmpty(users)) {
|
|
||||||
// users.forEach(item -> userCacheClean.cleanUserCache(item.getUsername()));
|
|
||||||
Set<Long> userIds = users.stream().map(User::getId).collect(Collectors.toSet());
|
|
||||||
redisUtils.delByKeys(CacheKey.DATA_USER, userIds);
|
|
||||||
redisUtils.delByKeys(CacheKey.MENU_USER, userIds);
|
|
||||||
redisUtils.delByKeys(CacheKey.ROLE_AUTH, userIds);
|
|
||||||
}
|
|
||||||
redisUtils.del(CacheKey.ROLE_ID + id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user