Commit 658a7841 authored by liqin's avatar liqin 💬

bug fixed

parent d785d73a
......@@ -308,12 +308,15 @@ public class CopyrightOwnerController extends BaseController {
final LambdaQueryWrapper<LearningContentCopyrightOwner> learningContentCopyrightOwnerLambdaQueryWrapper = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id);
final List<LearningContentCopyrightOwner> learningContentCopyrightOwnerList = this.learningContentCopyrightOwnerService.list(learningContentCopyrightOwnerLambdaQueryWrapper);
if (learningContentCopyrightOwnerList != null && !learningContentCopyrightOwnerList.isEmpty()) {
final Map<String, List<String>> collect = learningContentCopyrightOwnerList.stream().collect(Collectors.groupingBy(LearningContentCopyrightOwner::getLearningContentId, Collectors.mapping(LearningContentCopyrightOwner::getCopyrightOwnerId, Collectors.toList())));
collect.forEach((k , v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
}
});
LambdaUpdateWrapper<LearningContentCopyrightOwner> deleteWrapper2 = Wrappers.<LearningContentCopyrightOwner>lambdaUpdate().eq(LearningContentCopyrightOwner::getCopyrightOwnerId, id);
this.learningContentCopyrightOwnerService.remove(deleteWrapper2);
if (learningContentCopyrightOwnerList.size() == 1) {
this.learningContentService.removeById(learningContentCopyrightOwnerList.get(0).getLearningContentId());
}
}
return getSuccessResult();
......
......@@ -210,12 +210,15 @@ public class ExhibitionBoardCatController extends BaseController {
final LambdaQueryWrapper<LearningContentBoardCat> learningContentBoardCatLambdaQueryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getExhibitionBoardCatId, id);
final List<LearningContentBoardCat> learningContentBoardCatList = this.learningContentBoardCatService.list(learningContentBoardCatLambdaQueryWrapper);
if (learningContentBoardCatList != null && !learningContentBoardCatList.isEmpty()) {
final Map<String, List<String>> collect = learningContentBoardCatList.stream().collect(Collectors.groupingBy(LearningContentBoardCat::getLearningContentId, Collectors.mapping(LearningContentBoardCat::getExhibitionBoardCatId, Collectors.toList())));
collect.forEach((k , v) -> {
if (v.size() == 1) {
this.learningContentService.removeById(k);
}
});
LambdaUpdateWrapper<LearningContentBoardCat> deleteWrapper1 = Wrappers.<LearningContentBoardCat>lambdaUpdate().eq(LearningContentBoardCat::getExhibitionBoardCatId, id);
this.learningContentBoardCatService.remove(deleteWrapper1);
if (learningContentBoardCatList.size() == 1) {
this.learningContentService.removeById(learningContentBoardCatList.get(0).getLearningContentId());
}
}
LambdaUpdateWrapper<LearningContentBoard> deleteWrapper2 = Wrappers.<LearningContentBoard>lambdaUpdate().eq(LearningContentBoard::getExhibitionBoardCatId, id);
......
......@@ -316,8 +316,8 @@ public class LearningContentController extends BaseController {
final LambdaQueryWrapper<LearningContentBoardCat> queryWrapper = Wrappers.<LearningContentBoardCat>lambdaQuery().eq(LearningContentBoardCat::getLearningContentId, id);
queryWrapper.select(LearningContentBoardCat::getExhibitionBoardCatId);
final List<String> exhibitionBoardCatIdList = this.learningContentBoardCatService.listObjs(queryWrapper, Object::toString);
if (!exhibitionBoardCatIdList.isEmpty()) {
final List<ExhibitionBoardCat> exhibitionBoardCats = this.exhibitionBoardCatService.listByIds(exhibitionBoardCatIdList);
if (!exhibitionBoardCats.isEmpty()) {
learningContent.setExhibitionBoardCatIdList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardCatNameList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getName).collect(Collectors.toList()));
}
......@@ -325,8 +325,8 @@ public class LearningContentController extends BaseController {
final LambdaQueryWrapper<LearningContentCopyrightOwner> queryWrapper1 = Wrappers.<LearningContentCopyrightOwner>lambdaQuery().eq(LearningContentCopyrightOwner::getLearningContentId, id);
queryWrapper1.select(LearningContentCopyrightOwner::getCopyrightOwnerId);
final List<String> copyrightOwnerIdList = this.learningContentCopyrightOwnerService.listObjs(queryWrapper1, Object::toString);
if (!copyrightOwnerIdList.isEmpty()) {
final List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(copyrightOwnerIdList);
if (!copyrightOwnerList.isEmpty()) {
learningContent.setCopyrightOwnerIdList(copyrightOwnerList.stream().map(CopyrightOwner::getId).collect(Collectors.toList()));
learningContent.setCopyrightOwnerNameList(copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.toList()));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment