提交 0c201f49 编写于 作者: F fengyw

feat: 当es没数据,直接查库

上级 0258cc41
...@@ -98,10 +98,10 @@ public class ApiCourseBiz extends BaseBiz { ...@@ -98,10 +98,10 @@ public class ApiCourseBiz extends BaseBiz {
} }
nsb.withQuery(qb); nsb.withQuery(qb);
SearchHits<EsCourse> searchHits = elasticsearchRestTemplate.search(nsb.build(), EsCourse.class, IndexCoordinates.of(EsCourse.COURSE)); SearchHits<EsCourse> searchHits = elasticsearchRestTemplate.search(nsb.build(), EsCourse.class, IndexCoordinates.of(EsCourse.COURSE));
if(searchHits.getTotalHits() > 0){ if (searchHits.getTotalHits() > 0) {
// es // es
return Result.success(EsPageUtil.transform(searchHits, req.getPageCurrent(), req.getPageSize(), ApiCoursePageResp.class)); return Result.success(EsPageUtil.transform(searchHits, req.getPageCurrent(), req.getPageSize(), ApiCoursePageResp.class));
}else{ } else {
// 直接查库 // 直接查库
CourseExample example = new CourseExample(); CourseExample example = new CourseExample();
CourseExample.Criteria c = example.createCriteria(); CourseExample.Criteria c = example.createCriteria();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册