Commit 300a9409 authored by liqin's avatar liqin 💬

bug fixed

parent 84af5cc5
......@@ -30,7 +30,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.DisabledAccountException;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.bytedeco.opencv.presets.opencv_core;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.validation.annotation.Validated;
......@@ -553,51 +552,6 @@ public class ChinaMobileRestApiController extends BaseController {
}
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "learningProjectId", value = "学习项目ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String")
})
@PostMapping("/learningContent/getPage")
@RequiresAuthentication //@RequiresPermissions("learning:content:page")
@ApiOperation(value = "查询学习内容", notes = "查询学习内容")
public Map<String, Object> getLearningContentPageList(GenericPageParam genericPageParam,
@RequestParam(value = "learningProjectId", required = false) String learningProjectId) {
LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(LearningContent::getPublished, true);
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(learningProjectId)) {
queryWrapper.eq(LearningContent::getLearningProjectId, learningProjectId);
}
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(LearningContent::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(LearningContent::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(LearningContent::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(LearningContent::getSortorder);
// 设置查询内容
queryWrapper.select(
LearningContent::getId,
LearningContent::getName,
LearningContent::getCover,
LearningContent::getSortorder,
LearningContent::getCreateTime,
LearningContent::getUpdateTime);
Page<LearningContent> page = this.learningContentService.page(getPage(), queryWrapper);
for (LearningContent learningContent : page.getRecords()) {
LambdaQueryWrapper<LearningContentBoard> lambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().eq(LearningContentBoard::getLearningContentId, learningContent.getId());
int exhibitionBoardCount = this.learningContentBoardService.count(lambdaQueryWrapper);
learningContent.setExhibitionBoardCount(exhibitionBoardCount);
}
return getResult(page);
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
......@@ -644,6 +598,51 @@ public class ChinaMobileRestApiController extends BaseController {
return getResult(page);
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "learningProjectId", value = "学习项目ID", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "nameOrCode", value = "名称或编码", paramType = "query", dataType = "String")
})
@PostMapping("/learningContent/getPage")
@RequiresAuthentication //@RequiresPermissions("learning:content:page")
@ApiOperation(value = "查询学习内容", notes = "查询学习内容")
public Map<String, Object> getLearningContentPageList(GenericPageParam genericPageParam,
@RequestParam(value = "learningProjectId", required = false) String learningProjectId) {
LambdaQueryWrapper<LearningContent> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(LearningContent::getPublished, true);
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(learningProjectId)) {
queryWrapper.eq(LearningContent::getLearningProjectId, learningProjectId);
}
// 对名称或编码模糊查询
if (StringUtils.isNotBlank(genericPageParam.getNameOrCode())) {
queryWrapper.like(LearningContent::getName, genericPageParam.getNameOrCode());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
queryWrapper.ge(LearningContent::getCreateTime, genericPageParam.getStartDate().atTime(0, 0, 0))
.le(LearningContent::getCreateTime, genericPageParam.getEndDate().atTime(23, 59, 59));
}
// 设置排序规则
queryWrapper.orderByDesc(LearningContent::getSortorder);
// 设置查询内容
queryWrapper.select(
LearningContent::getId,
LearningContent::getName,
LearningContent::getCover,
LearningContent::getSortorder,
LearningContent::getCreateTime,
LearningContent::getUpdateTime);
Page<LearningContent> page = this.learningContentService.page(getPage(), queryWrapper);
for (LearningContent learningContent : page.getRecords()) {
LambdaQueryWrapper<LearningContentBoard> lambdaQueryWrapper = Wrappers.<LearningContentBoard>lambdaQuery().eq(LearningContentBoard::getLearningContentId, learningContent.getId());
int exhibitionBoardCount = this.learningContentBoardService.count(lambdaQueryWrapper);
learningContent.setExhibitionBoardCount(exhibitionBoardCount);
}
return getResult(page);
}
@ApiImplicitParams(value = {
@ApiImplicitParam(name = "_index", value = "分页起始偏移量", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "_size", value = "返回条数", paramType = "query", dataType = "Integer"),
......
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