|
@@ -15,6 +15,7 @@ import com.cyksj.service.information.InformationCategoryService;
|
|
|
import com.cyksj.service.information.InformationService;
|
|
import com.cyksj.service.information.InformationService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
|
|
+import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -102,8 +103,12 @@ public class CmsInformationController {
|
|
|
* 获取文章
|
|
* 获取文章
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/get")
|
|
@GetMapping("/get")
|
|
|
- public Result<SearchResult<InformationView>> getInformation() {
|
|
|
|
|
- SearchResult<InformationView> list = beanSearcher.search(InformationView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
|
|
|
|
|
|
|
+ public Result<SearchResult<InformationView>> getInformation(Long category) {
|
|
|
|
|
+ MapBuilder builder = MapUtils.flatBuilder(request.getParameterMap());
|
|
|
|
|
+ if (category != null) {
|
|
|
|
|
+ builder.put("ct", String.format(" and JSON_CONTAINS(i.category_ids,'%s')", category));
|
|
|
|
|
+ }
|
|
|
|
|
+ SearchResult<InformationView> list = beanSearcher.search(InformationView.class, builder.build());
|
|
|
list.getDataList().forEach(data -> {
|
|
list.getDataList().forEach(data -> {
|
|
|
try {
|
|
try {
|
|
|
List<Long> goodsIds = Jsons.parseList(data.getGoodsIds(), Long.class);
|
|
List<Long> goodsIds = Jsons.parseList(data.getGoodsIds(), Long.class);
|