Commit 41688b83 authored by shangtx's avatar shangtx

feat: 服务小类首页筛选

parent 16ecdbd2
...@@ -13,6 +13,7 @@ import com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO; ...@@ -13,6 +13,7 @@ import com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO;
import com.onsiteservice.util.AttrCopyUtils; import com.onsiteservice.util.AttrCopyUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
...@@ -23,9 +24,6 @@ import java.util.stream.Collectors; ...@@ -23,9 +24,6 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ServiceCategoryService extends AbstractMapper<ServiceCategory> { public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
//@Resource
//private ServiceCategoryBizMapper serviceCategoryBizMapper;
@Resource @Resource
private ServiceCategoryMapper serviceCategoryMapper; private ServiceCategoryMapper serviceCategoryMapper;
@Resource @Resource
...@@ -35,7 +33,11 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> { ...@@ -35,7 +33,11 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
public Result<List<ServiceCategoryVO>> list(String keyWord) { public Result<List<ServiceCategoryVO>> list(String keyWord) {
List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence(); List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence();
List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByServiceNameLike(keyWord); var condition = new Condition(ServiceSubclass.class);
condition.createCriteria().andLike("serviceName", keyWord)
.andEqualTo("enabled", true)
.andEqualTo("showInHome", true);
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));
List<ServiceCategoryVO> serviceCategoryVOList = serviceCategoryList.parallelStream().map(e -> { List<ServiceCategoryVO> serviceCategoryVOList = serviceCategoryList.parallelStream().map(e -> {
......
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