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