|
@@ -11,7 +11,6 @@ import cc.mrbird.febs.server.system.service.IRoleService;
|
|
|
import cc.mrbird.febs.server.system.service.IUserRoleService;
|
|
import cc.mrbird.febs.server.system.service.IUserRoleService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -65,8 +64,10 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|
|
role.setCreateTime(new Date());
|
|
role.setCreateTime(new Date());
|
|
|
this.save(role);
|
|
this.save(role);
|
|
|
|
|
|
|
|
- String[] menuIds = role.getMenuIds().split(StringPool.COMMA);
|
|
|
|
|
- setRoleMenus(role, menuIds);
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(role.getMenuIds())) {
|
|
|
|
|
+ String[] menuIds = StringUtils.splitByWholeSeparatorPreserveAllTokens(role.getMenuIds(), ",");
|
|
|
|
|
+ setRoleMenus(role, menuIds);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -87,9 +88,10 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|
|
baseMapper.updateById(role);
|
|
baseMapper.updateById(role);
|
|
|
|
|
|
|
|
roleMenuService.remove(new LambdaQueryWrapper<RoleMenu>().eq(RoleMenu::getRoleId, role.getRoleId()));
|
|
roleMenuService.remove(new LambdaQueryWrapper<RoleMenu>().eq(RoleMenu::getRoleId, role.getRoleId()));
|
|
|
-
|
|
|
|
|
- String[] menuIds = role.getMenuIds().split(StringPool.COMMA);
|
|
|
|
|
- setRoleMenus(role, menuIds);
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(role.getMenuIds())) {
|
|
|
|
|
+ String[] menuIds = StringUtils.splitByWholeSeparatorPreserveAllTokens(role.getMenuIds(), ",");
|
|
|
|
|
+ setRoleMenus(role, menuIds);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void setRoleMenus(Role role, String[] menuIds) {
|
|
private void setRoleMenus(Role role, String[] menuIds) {
|