Commit e3bbf060 authored by nie'hong's avatar nie'hong

修改-删除展板判断展板是否被内容使用只对上架状态展板判断

parent dd32683c
......@@ -611,16 +611,20 @@ public class ExhibitionBoardController extends BaseController {
})
@MethodLog(operModule = OperModule.DISPLAYCONTENT, operType = OperType.DELETE)
public Map<String, Object> deleteExhibitionBoard(@PathVariable("id") String id) {
// 查询该展板是否被学习内容使用
final LambdaQueryWrapper<LearningContentBoard> queryWrapper = Wrappers.lambdaQuery();
// 查询展板对应的学习内容id
queryWrapper.eq(LearningContentBoard::getExhibitionBoardId, id);
queryWrapper.select(LearningContentBoard::getLearningContentId);
List<String> list = this.learningContentBoardService.listObjs(queryWrapper, Object::toString);
List<LearningContent> learningContents = this.learningContentService.listByIds(list);
String collect = learningContents.stream().map(LearningContent::getName).collect(Collectors.joining(","));
if (CollectionUtil.isNotEmpty(list)) {
return getFailResult("该展板被学习内容:" + collect + "使用,不能被删除!");
ExhibitionBoard byId = this.exhibitionBoardService.getById(id);
// 上架状态下的展板需要判断是否被学习内容使用
if (byId.getPublished()) {
// 查询该展板是否被学习内容使用
final LambdaQueryWrapper<LearningContentBoard> queryWrapper = Wrappers.lambdaQuery();
// 查询展板对应的学习内容id
queryWrapper.eq(LearningContentBoard::getExhibitionBoardId, id);
queryWrapper.select(LearningContentBoard::getLearningContentId);
List<String> list = this.learningContentBoardService.listObjs(queryWrapper, Object::toString);
List<LearningContent> learningContents = this.learningContentService.listByIds(list);
String collect = learningContents.stream().map(LearningContent::getName).collect(Collectors.joining(","));
if (CollectionUtil.isNotEmpty(list)) {
return getFailResult("该展板被学习内容:" + collect + "使用,不能被删除!");
}
}
TUser user = getcurUser();
......
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