Commit 7554f448 authored by wzp's avatar wzp

修改appbug

parent 09a5b074
...@@ -2,6 +2,9 @@ package cn.chnmuseum.party.mapper; ...@@ -2,6 +2,9 @@ package cn.chnmuseum.party.mapper;
import cn.chnmuseum.party.model.ExhibitionBoard; import cn.chnmuseum.party.model.ExhibitionBoard;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p> * <p>
...@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -13,4 +16,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface ExhibitionBoardMapper extends BaseMapper<ExhibitionBoard> { public interface ExhibitionBoardMapper extends BaseMapper<ExhibitionBoard> {
List<ExhibitionBoard> getList(@Param("learningProjectId") String learningProjectId, @Param("isPublished") boolean isPublished);
} }
...@@ -118,4 +118,20 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo ...@@ -118,4 +118,20 @@ public interface LearningContentBoardMapper extends BaseMapper<LearningContentBo
) )
IPage<Asset> selectAssetPageByOrganCode(Page<?> page, String organCode); IPage<Asset> selectAssetPageByOrganCode(Page<?> page, String organCode);
@Select("<script>"
+ "SELECT distinct a.* from "
+ "(SELECT eb.* FROM learning_project p,learning_content lc,learning_content_board lcb, exhibition_board eb "
+ "WHERE lcb.exhibition_board_id = eb.id and p.id = lc.learning_project_id and lc.id = lcb.learning_content_id "
+ "and eb.is_published = 1 and eb.is_deleted = 0 and lc.is_deleted = 0 "
+ "<if test='learningProjectId != null'>and p.id = #{learningProjectId} </if>"
+ "<if test='nameOrCode != null'>"
+"AND ( eb.name LIKE CONCAT('%', #{nameOrCode}, '%') OR eb.name_pin_yin LIKE CONCAT('%', #{nameOrCode}, '%') " +
"OR eb.name_first_pin_yin LIKE CONCAT('%', #{nameOrCode}, '%') " +
"OR eb.serial_no LIKE CONCAT('%', #{nameOrCode}, '%'))"
+ "</if>"
+ "order by lcb.sortorder, eb.create_time DESC)a "
+ "</script>"
)
IPage<ExhibitionBoard> getBoardPageByLearningProjectId(Page<ExhibitionBoard> page, String learningProjectId, String nameOrCode);
} }
...@@ -145,6 +145,10 @@ public class ExhibitionBoard implements Serializable { ...@@ -145,6 +145,10 @@ public class ExhibitionBoard implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String learningContentId; private String learningContentId;
@ApiModelProperty("所属学习项目ID")
@TableField(exist = false)
private String learningProjectId;
@ApiModelProperty("展板版权方名称") @ApiModelProperty("展板版权方名称")
@TableField(exist = false) @TableField(exist = false)
private String boardCopyrightOwnerName; private String boardCopyrightOwnerName;
......
...@@ -66,4 +66,8 @@ public class LearningProject implements Serializable { ...@@ -66,4 +66,8 @@ public class LearningProject implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private String learningContentNames; private String learningContentNames;
@ApiModelProperty("相关展板")
@TableField(exist = false)
private String exhibitionBoardNames;
} }
...@@ -3,6 +3,8 @@ package cn.chnmuseum.party.service; ...@@ -3,6 +3,8 @@ package cn.chnmuseum.party.service;
import cn.chnmuseum.party.model.ExhibitionBoard; import cn.chnmuseum.party.model.ExhibitionBoard;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/** /**
* <p> * <p>
* 展板 服务类 * 展板 服务类
...@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface ExhibitionBoardService extends IService<ExhibitionBoard> { public interface ExhibitionBoardService extends IService<ExhibitionBoard> {
List<ExhibitionBoard> getList(String learningProjectId, boolean b);
} }
...@@ -25,4 +25,5 @@ public interface LearningContentBoardService extends IService<LearningContentBoa ...@@ -25,4 +25,5 @@ public interface LearningContentBoardService extends IService<LearningContentBoa
IPage<Asset> getAssetPageByOrganCode(Page<Asset> page, String organCode); IPage<Asset> getAssetPageByOrganCode(Page<Asset> page, String organCode);
IPage<ExhibitionBoard> getBoardPageByLearningProjectId(Page<ExhibitionBoard> page, String learningProjectId, String nameOrCode);
} }
...@@ -4,8 +4,11 @@ import cn.chnmuseum.party.model.ExhibitionBoard; ...@@ -4,8 +4,11 @@ import cn.chnmuseum.party.model.ExhibitionBoard;
import cn.chnmuseum.party.mapper.ExhibitionBoardMapper; import cn.chnmuseum.party.mapper.ExhibitionBoardMapper;
import cn.chnmuseum.party.service.ExhibitionBoardService; import cn.chnmuseum.party.service.ExhibitionBoardService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* <p> * <p>
* 展板 服务实现类 * 展板 服务实现类
...@@ -17,4 +20,11 @@ import org.springframework.stereotype.Service; ...@@ -17,4 +20,11 @@ import org.springframework.stereotype.Service;
@Service @Service
public class ExhibitionBoardServiceImpl extends ServiceImpl<ExhibitionBoardMapper, ExhibitionBoard> implements ExhibitionBoardService { public class ExhibitionBoardServiceImpl extends ServiceImpl<ExhibitionBoardMapper, ExhibitionBoard> implements ExhibitionBoardService {
@Autowired
private ExhibitionBoardMapper exhibitionBoardMapper;
@Override
public List<ExhibitionBoard> getList(String learningProjectId, boolean isPublished) {
return exhibitionBoardMapper.getList(learningProjectId,isPublished);
}
} }
...@@ -42,4 +42,9 @@ public class LearningContentBoardServiceImpl extends ServiceImpl<LearningContent ...@@ -42,4 +42,9 @@ public class LearningContentBoardServiceImpl extends ServiceImpl<LearningContent
return learningContentBoardMapper.selectAssetPageByOrganCode(page, organCode); return learningContentBoardMapper.selectAssetPageByOrganCode(page, organCode);
} }
@Override
public IPage<ExhibitionBoard> getBoardPageByLearningProjectId(Page<ExhibitionBoard> page, String learningProjectId, String nameOrCode) {
return learningContentBoardMapper.getBoardPageByLearningProjectId(page, learningProjectId, nameOrCode);
}
} }
...@@ -402,15 +402,21 @@ public class ChinaMobileRestApiController extends BaseController { ...@@ -402,15 +402,21 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "learningContentId", value = "学习内容ID", paramType = "query", dataType = "String") @ApiImplicitParam(name = "learningProjectId", value = "学习项目ID", paramType = "query", dataType = "String")
}) })
@PostMapping("/exhibitionBoard/getPage") @PostMapping("/exhibitionBoard/getPage")
@RequiresAuthentication //@RequiresPermissions("exhibition:board:page") @RequiresAuthentication //@RequiresPermissions("exhibition:board:page")
@ApiOperation(value = "展板列表查询", notes = "展板列表查询") @ApiOperation(value = "展板列表查询", notes = "展板列表查询")
public Map<String, Object> getExhibitionBoardPageList(@RequestParam(value = "learningContentId", required = false) String learningContentId) { public Map<String, Object> getExhibitionBoardPageList(@RequestParam(value = "learningProjectId", required = false) String learningProjectId) {
final IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningContentId(getPage(), learningContentId, null); Page<ExhibitionBoard> page1 = getPage();
long l = page1.getCurrent() * page1.getSize()-10;
int size = exhibitionBoardService.getList(learningProjectId, true).size();
if (l>size){
page1 = new Page<>(1, 10);
}
final IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningProjectId(page1, learningProjectId, null);
for (ExhibitionBoard exhibitionBoard : page.getRecords()) { for (ExhibitionBoard exhibitionBoard : page.getRecords()) {
exhibitionBoard.setLearningContentId(learningContentId); exhibitionBoard.setLearningProjectId(learningProjectId);
if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) { if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName(); String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
exhibitionBoard.setBoardCopyrightOwnerName(name); exhibitionBoard.setBoardCopyrightOwnerName(name);
...@@ -451,6 +457,60 @@ public class ChinaMobileRestApiController extends BaseController { ...@@ -451,6 +457,60 @@ public class ChinaMobileRestApiController extends BaseController {
return getResult(page); return getResult(page);
} }
// @ApiImplicitParams(value = {
// @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
// @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
// @ApiImplicitParam(name = "learningContentId", value = "学习内容ID", paramType = "query", dataType = "String")
// })
// @PostMapping("/exhibitionBoard/getPage1")
// @RequiresAuthentication //@RequiresPermissions("exhibition:board:page")
// @ApiOperation(value = "展板列表查询", notes = "展板列表查询")
// public Map<String, Object> getExhibitionBoardPageList(@RequestParam(value = "learningContentId", required = false) String learningContentId) {
// final IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningContentId(getPage(), learningContentId, null);
// for (ExhibitionBoard exhibitionBoard : page.getRecords()) {
// exhibitionBoard.setLearningContentId(learningContentId);
// if (exhibitionBoard.getVideoContentCopyrightOwnerId() != null) {
// String name = this.copyrightOwnerService.getById(exhibitionBoard.getVideoContentCopyrightOwnerId()).getName();
// exhibitionBoard.setBoardCopyrightOwnerName(name);
// }
// if (exhibitionBoard.getExhibitionBoardCatId() != null) {
// String name = this.exhibitionBoardCatService.getById(exhibitionBoard.getExhibitionBoardCatId()).getName();
// exhibitionBoard.setExhibitionBoardCatName(name);
// }
// if (exhibitionBoard.getVideoContentId() != null) {
// final VideoContent videoContent = this.videoContentService.getById(exhibitionBoard.getVideoContentId());
// if (videoContent != null) {
// exhibitionBoard.setBoardVideoContentThumbnail(videoContent.getThumbnail());
// }
// }
// LambdaQueryWrapper<Asset> assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getVideoContentId());
// assetQueryWrapper.eq(Asset::getPublished, true);
// assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.VIDEO_CONTENT.name());
// List<Asset> videoList = this.assetService.list(assetQueryWrapper);
// for (Asset asset : videoList) {
// asset.setExhibitionBoardName(exhibitionBoard.getName());
// asset.setExhibitionBoardId(exhibitionBoard.getId());
// }
//
// assetQueryWrapper.clear();
// assetQueryWrapper = Wrappers.<Asset>lambdaQuery().eq(Asset::getRefItemId, exhibitionBoard.getId());
// assetQueryWrapper.eq(Asset::getPublished, true);
// assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_DATUM.name());
// List<Asset> datumList = this.assetService.list(assetQueryWrapper);
// for (Asset asset : datumList) {
// asset.setExhibitionBoardName(exhibitionBoard.getName());
// asset.setExhibitionBoardId(exhibitionBoard.getId());
// }
// exhibitionBoard.setDatumList(datumList);
//
// videoList.addAll(datumList.stream().filter(x -> FileTypeEnum.VIDEO.name().equalsIgnoreCase(x.getFileType())).collect(Collectors.toList()));
// exhibitionBoard.setVideoList(videoList);
// }
// return getResult(page);
// }
@ApiOperation(value = "展板详情查询", notes = "展板详情查询") @ApiOperation(value = "展板详情查询", notes = "展板详情查询")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "boardId", value = "展板ID", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "boardId", value = "展板ID", dataType = "String", paramType = "query"),
...@@ -596,17 +656,24 @@ public class ChinaMobileRestApiController extends BaseController { ...@@ -596,17 +656,24 @@ public class ChinaMobileRestApiController extends BaseController {
LearningProject::getRemarks, LearningProject::getRemarks,
LearningProject::getCreateTime, LearningProject::getCreateTime,
LearningProject::getUpdateTime); LearningProject::getUpdateTime);
Page<LearningProject> page = this.learningProjectService.page(getPage(), queryWrapper); Page<LearningProject> page = this.learningProjectService.page(getPage(), queryWrapper);
for (LearningProject learningProject : page.getRecords()) { for (LearningProject learningProject : page.getRecords()) {
LambdaQueryWrapper<LearningContent> lambdaQueryWrapper = Wrappers.<LearningContent>lambdaQuery() LambdaQueryWrapper<LearningContent> lambdaQueryWrapper = Wrappers.<LearningContent>lambdaQuery()
.eq(LearningContent::getLearningProjectId, learningProject.getId()) .eq(LearningContent::getLearningProjectId, learningProject.getId())
.eq(LearningContent::getPublished, true).orderByDesc(LearningContent::getSortorder); .eq(LearningContent::getPublished, true).orderByDesc(LearningContent::getSortorder);
lambdaQueryWrapper.select(LearningContent::getName, LearningContent::getCover); lambdaQueryWrapper.select(LearningContent::getName, LearningContent::getCover);
List<LearningContent> learningContentList = this.learningContentService.list(lambdaQueryWrapper); // List<LearningContent> learningContentList = this.learningContentService.list(lambdaQueryWrapper);
if (!learningContentList.isEmpty()) { // if (!learningContentList.isEmpty()) {
String learningContentNames = learningContentList.stream().map(LearningContent::getName).collect(Collectors.joining("、")); // String learningContentNames = learningContentList.stream().map(LearningContent::getName).collect(Collectors.joining("、"));
learningProject.setThumbnail(learningContentList.get(0).getCover()); // learningProject.setThumbnail(learningContentList.get(0).getCover());
learningProject.setLearningContentNames(learningContentNames); // learningProject.setLearningContentNames(learningContentNames);
// }
List<ExhibitionBoard> list= exhibitionBoardService.getList(learningProject.getId(),true);
if (!list.isEmpty()) {
String exhibitionBoardNames = list.stream().map(ExhibitionBoard::getName).collect(Collectors.joining("、"));
learningProject.setThumbnail(list.get(0).getCover());
learningProject.setExhibitionBoardNames(exhibitionBoardNames);
} }
} }
return getResult(page); return getResult(page);
...@@ -677,18 +744,33 @@ public class ChinaMobileRestApiController extends BaseController { ...@@ -677,18 +744,33 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "learningContentId", value = "学习内容ID", paramType = "query", dataType = "String"), @ApiImplicitParam(name = "learningProjectId", value = "学习项目ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String") @ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String")
}) })
@PostMapping("/exhibitionBoard/search") @PostMapping("/exhibitionBoard/search")
@RequiresAuthentication //@RequiresPermissions("learning:content:board:page") @RequiresAuthentication //@RequiresPermissions("learning:content:board:page")
@ApiOperation(value = "模糊搜索查询", notes = "模糊搜索查询") @ApiOperation(value = "模糊搜索查询", notes = "模糊搜索查询")
public Map<String, Object> getLearningContentBoardPageList(GenericPageParam genericPageParam, public Map<String, Object> getLearningContentBoardPageList(GenericPageParam genericPageParam,
@RequestParam(value = "learningContentId", required = false) String learningContentId) { @RequestParam(value = "learningProjectId", required = false) String learningProjectId) {
IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningContentId(getPage(), learningContentId, genericPageParam.getNameOrCode()); IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningProjectId(getPage(), learningProjectId, genericPageParam.getNameOrCode());
return getResult(page); return getResult(page);
} }
// @ApiImplicitParams(value = {
// @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
// @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
// @ApiImplicitParam(name = "learningContentId", value = "学习内容ID", paramType = "query", dataType = "String"),
// @ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String")
// })
// @PostMapping("/exhibitionBoard/search1")
// @RequiresAuthentication //@RequiresPermissions("learning:content:board:page")
// @ApiOperation(value = "模糊搜索查询", notes = "模糊搜索查询")
// public Map<String, Object> getLearningContentBoardPageList(GenericPageParam genericPageParam,
// @RequestParam(value = "learningContentId", required = false) String learningContentId) {
// IPage<ExhibitionBoard> page = this.learningContentBoardService.getBoardPageByLearningContentId(getPage(), learningContentId, genericPageParam.getNameOrCode());
// return getResult(page);
// }
@ApiImplicitParams(value = { @ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"), @ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer") @ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer")
......
...@@ -30,4 +30,16 @@ ...@@ -30,4 +30,16 @@
audit_status, is_published, is_deleted, create_time, update_time audit_status, is_published, is_deleted, create_time, update_time
</sql> </sql>
<select id="getList" resultMap="BaseResultMap">
SELECT distinct a.name,a.cover from
( select e.name,e.cover,lb.sortorder,e.create_time
from exhibition_board e
left join learning_content_board lb on lb.exhibition_board_id = e.id
left join learning_content lc on lb.learning_content_id = lc.id and lc.is_deleted = 0
left join learning_project p on lc.learning_project_id = p.id
where e.is_published = #{isPublished} and p.id = #{learningProjectId}
order by lb.sortorder,e.create_time DESC)a
</select>
</mapper> </mapper>
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