mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 20:49:00 +08:00
🐛 Fixing a bug.修改角色权限,没有更新用户缓存
This commit is contained in:
1 parent
0ff6b01bb5
commit
38abb69344
1 file changed
+9
-2
+9
-2
@@ -25,6 +25,8 @@ import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRoleMenu;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysRoleMenuMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysRoleMenuService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -41,9 +43,11 @@ import java.util.List;
|
||||
* @since 2017-10-29
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRoleMenu> implements SysRoleMenuService {
|
||||
private CacheManager cacheManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param role
|
||||
* @param roleId 角色
|
||||
* @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔
|
||||
@@ -57,7 +61,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
this.delete(new EntityWrapper<>(condition));
|
||||
List<SysRoleMenu> roleMenuList = new ArrayList<>();
|
||||
List<String> menuIdList = Arrays.asList(menuIds.split(","));
|
||||
if(CollUtil.isEmpty(menuIdList)){
|
||||
if (CollUtil.isEmpty(menuIdList)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
for (String menuId : menuIdList) {
|
||||
@@ -66,6 +70,9 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
roleMenu.setMenuId(Integer.valueOf(menuId));
|
||||
roleMenuList.add(roleMenu);
|
||||
}
|
||||
|
||||
//清空userinfo
|
||||
cacheManager.getCache("user_details").clear();
|
||||
return this.insertBatch(roleMenuList);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user