Commit bfb1d1ee authored by shangtx's avatar shangtx

fix: 服务搜索接口

parent aa6bfe03
......@@ -40,7 +40,7 @@ public class ServiceCategoryController {
@ApiOperation(value = "服务列表")
@GetMapping("list")
public Result<List<ServiceCategoryVO>> list() {
return serviceCategoryService.list(null);
return serviceCategoryService.list(null, true);
}
@ApiOperation(value = "根据key查询子类")
......
......@@ -78,7 +78,7 @@ public class HomeCommonService {
.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();
......
......@@ -30,13 +30,16 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
private ServiceSubclassMapper serviceSubclassMapper;
public Result<List<ServiceCategoryVO>> list(String keyWord) {
public Result<List<ServiceCategoryVO>> list(String keyWord, Boolean search) {
List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence();
var condition = new Condition(ServiceSubclass.class);
condition.createCriteria().andLike("serviceName", keyWord)
.andEqualTo("enabled", true)
.andEqualTo("showInHome", true);
var criteria = condition.createCriteria();
criteria.andLike("serviceName", keyWord)
.andEqualTo("enabled", true);
if (!search) {
criteria.andEqualTo("showInHome", true);
}
List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByCondition(condition);
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