代码优化

This commit is contained in:
2023-04-19 21:38:09 +08:00
parent ed1e288ec2
commit 94c409bcde

View File

@@ -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;