代码优化
This commit is contained in:
@@ -200,13 +200,15 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
|
||||
public Boolean updateRoleComponent(RoleParam.RoleFunctionComponent roleFunctionComponent) {
|
||||
deleteComponentsByRoleIndex(roleFunctionComponent.getId());
|
||||
if (!roleFunctionComponent.getIdList().isEmpty()){
|
||||
List<RoleFunction> list = new ArrayList<>();
|
||||
RoleFunction roleFunction = new RoleFunction();
|
||||
for (String pojo : roleFunctionComponent.getIdList()) {
|
||||
roleFunction = new RoleFunction();
|
||||
roleFunction.setRoleId(roleFunctionComponent.getId());
|
||||
roleFunctionComponent.getIdList().forEach(
|
||||
pojo->{
|
||||
roleFunction.setFunctionId(pojo);
|
||||
roleFunctionMapper.insert(roleFunction);
|
||||
});
|
||||
list.add(roleFunction);
|
||||
}
|
||||
roleFunctionService.saveBatch(list);
|
||||
}
|
||||
refreshRolesFunctionsCache();
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user