Commit 07442699 authored by liqin's avatar liqin 💬

bug fixed

parent 298a47c9
......@@ -20,11 +20,11 @@ import java.util.List;
*/
public interface LearningContentBoardMapper extends BaseMapper<LearningContentBoard> {
@Select("SELECT lcb.*, eb.`name` as exhibition_board_name FROM learning_content_board lcb, exhibition_board eb WHERE lcb.learning_content_id=eb.id and lcb.learning_content_id = #{learningContentId}")
@Select("SELECT lcb.*, eb.`name` as exhibition_board_name FROM learning_content_board lcb, exhibition_board eb WHERE lcb.exhibition_board_id=eb.id and lcb.learning_content_id = #{learningContentId}")
List<LearningContentBoard> selectBoardListByLearningContentId(String learningContentId);
@Select("<script>" + "SELECT eb.* FROM learning_content_board lcb, exhibition_board eb "
+ "WHERE lcb.learning_content_id=eb.id "
+ "WHERE lcb.exhibition_board_id=eb.id "
+ "<if test='learningContentId!=null'> and lcb.learning_content_id = #{learningContentId} </if>"
+ "<if test='nameOrCode!=null'> and eb.name like CONCAT('%',#{nameOrCode},'%')</if>"
+ "</script>"
......
......@@ -101,6 +101,10 @@ public class LearningContent implements Serializable {
@TableField(exist = false)
private List<String> exhibitionBoardIdList;
@ApiModelProperty("展板内容名称列表")
@TableField(exist = false)
private List<String> exhibitionBoardNameList;
@ApiModelProperty("展板分类名称列表")
@TableField(exist = false)
private List<String> exhibitionBoardCatNameList;
......
......@@ -27,6 +27,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <pre>
......@@ -55,6 +56,8 @@ public class LearningContentController extends BaseController {
@Resource
private LearningContentBoardService learningContentBoardService;
@Resource
private ExhibitionBoardService exhibitionBoardService;
@Resource
private LearningContentCopyrightOwnerService learningContentCopyrightOwnerService;
@Resource
private LearningProjectService learningProjectService;
......@@ -295,6 +298,27 @@ public class LearningContentController extends BaseController {
learningContent.setLearningProjectName(learningProject.getName());
}
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);
final List<ExhibitionBoardCat> exhibitionBoardCats = this.exhibitionBoardCatService.listByIds(exhibitionBoardCatIdList);
learningContent.setExhibitionBoardCatIdList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardCatNameList(exhibitionBoardCats.stream().map(ExhibitionBoardCat::getName).collect(Collectors.toList()));
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);
final List<CopyrightOwner> copyrightOwnerList = this.copyrightOwnerService.listByIds(copyrightOwnerIdList);
learningContent.setCopyrightOwnerIdList(copyrightOwnerList.stream().map(CopyrightOwner::getId).collect(Collectors.toList()));
learningContent.setCopyrightOwnerNameList(copyrightOwnerList.stream().map(CopyrightOwner::getName).collect(Collectors.toList()));
final LambdaQueryWrapper<LearningContentBoard> queryWrapper2 = Wrappers.<LearningContentBoard>lambdaQuery().eq(LearningContentBoard::getLearningContentId, id);
queryWrapper2.select(LearningContentBoard::getExhibitionBoardId);
final List<String> exhibitionBoardIdList = this.learningContentBoardService.listObjs(queryWrapper2, Object::toString);
final List<ExhibitionBoard> exhibitionBoardList = this.exhibitionBoardService.listByIds(exhibitionBoardIdList);
learningContent.setExhibitionBoardIdList(exhibitionBoardList.stream().map(ExhibitionBoard::getId).collect(Collectors.toList()));
learningContent.setExhibitionBoardNameList(exhibitionBoardList.stream().map(ExhibitionBoard::getName).collect(Collectors.toList()));
return getResult(learningContent);
}
......@@ -308,12 +332,12 @@ public class LearningContentController extends BaseController {
@ApiOperation(value = "学习内容排序")
@PutMapping(value = "/sort")
@RequiresPermissions("learning:content:sort")
public Map<String,Object> updateSortorder(String sourceId, String targetId) {
public Map<String, Object> updateSortorder(String sourceId, String targetId) {
String moveType;
LearningContent theSource = this.learningContentService.getById(sourceId);
LearningContent theTarget = this.learningContentService.getById(targetId);
if(theSource.getSortorder() > theTarget.getSortorder()) {
if (theSource.getSortorder() > theTarget.getSortorder()) {
moveType = "down";
} else {
moveType = "up";
......
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