🐛 修复lov模块新增时 body或search组件为0时,保存成功却提示异常

This commit is contained in:
b2baccline
2020-11-09 19:20:20 +08:00
parent 1a9f7653b4
commit 1c9df9c46a

View File

@@ -93,12 +93,18 @@ public class LovServiceImpl extends ServiceImpl<LovMapper, Lov> implements LovSe
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(Lov lov, List<LovBody> bodyList, List<LovSearch> searchList) {
return save(lov)
&& bodyService.saveBatch(
bodyList.stream().map(body -> body.setKeyword(lov.getKeyword())).collect(Collectors.toList()))
&& searchService.saveBatch(searchList.stream().map(search -> search.setKeyword(lov.getKeyword()))
boolean res = save(lov);
if (res && bodyList.size() > 0) {
res = bodyService.saveBatch(
bodyList.stream().map(body -> body.setKeyword(lov.getKeyword())).collect(Collectors.toList()));
}
if (res && searchList.size() > 0) {
res = searchService.saveBatch(searchList.stream().map(search -> search.setKeyword(lov.getKeyword()))
.collect(Collectors.toList()));
}
return res;
}
@Override
public LovVo getDataByKeyword(String keyword) {