Commit c855ab08 authored by shangtx's avatar shangtx

fix: 服务搜索接口

parent c5e440c3
...@@ -40,7 +40,7 @@ public class ServiceCategoryController { ...@@ -40,7 +40,7 @@ public class ServiceCategoryController {
@ApiOperation(value = "服务列表") @ApiOperation(value = "服务列表")
@GetMapping("list") @GetMapping("list")
public Result<List<ServiceCategoryVO>> list() { public Result<List<ServiceCategoryVO>> list() {
return serviceCategoryService.list(null); return serviceCategoryService.list(null, true);
} }
@ApiOperation(value = "根据key查询子类") @ApiOperation(value = "根据key查询子类")
......
...@@ -78,7 +78,7 @@ public class HomeCommonService { ...@@ -78,7 +78,7 @@ public class HomeCommonService {
.map(e -> AttrCopyUtils.copy(e, new HomeNoticeVO())).collect(Collectors.toList()); .map(e -> AttrCopyUtils.copy(e, new HomeNoticeVO())).collect(Collectors.toList());
// 服务 // 服务
Result<List<ServiceCategoryVO>> serviceResult = serviceCategoryService.list(null); Result<List<ServiceCategoryVO>> serviceResult = serviceCategoryService.list(null, false);
// 首页底部图片 // 首页底部图片
String bottomImage = sysParamMapper.selectOne(SysParam.builder().code(SysParamConstants.HOME_BOTTOM_IMAGE).build()).getValue(); String bottomImage = sysParamMapper.selectOne(SysParam.builder().code(SysParamConstants.HOME_BOTTOM_IMAGE).build()).getValue();
......
...@@ -30,13 +30,16 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> { ...@@ -30,13 +30,16 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
private ServiceSubclassMapper serviceSubclassMapper; private ServiceSubclassMapper serviceSubclassMapper;
public Result<List<ServiceCategoryVO>> list(String keyWord) { public Result<List<ServiceCategoryVO>> list(String keyWord, Boolean search) {
List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence(); List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence();
var condition = new Condition(ServiceSubclass.class); var condition = new Condition(ServiceSubclass.class);
condition.createCriteria().andLike("serviceName", keyWord) var criteria = condition.createCriteria();
.andEqualTo("enabled", true) criteria.andLike("serviceName", keyWord)
.andEqualTo("showInHome", true); .andEqualTo("enabled", true);
if (!search) {
criteria.andEqualTo("showInHome", true);
}
List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByCondition(condition); List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByCondition(condition);
Map<Integer, List<ServiceSubclass>> categoryIdServiceSubclassMap = serviceSubclassList.parallelStream().collect(Collectors.groupingBy(ServiceSubclass::getCategoryId)); Map<Integer, List<ServiceSubclass>> categoryIdServiceSubclassMap = serviceSubclassList.parallelStream().collect(Collectors.groupingBy(ServiceSubclass::getCategoryId));
......
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