Commit 41688b83 authored by shangtx's avatar shangtx

feat: 服务小类首页筛选

parent 16ecdbd2
......@@ -13,6 +13,7 @@ import com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO;
import com.onsiteservice.util.AttrCopyUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Condition;
import javax.annotation.Resource;
import java.util.List;
......@@ -23,9 +24,6 @@ import java.util.stream.Collectors;
@Transactional(rollbackFor = Exception.class)
public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
//@Resource
//private ServiceCategoryBizMapper serviceCategoryBizMapper;
@Resource
private ServiceCategoryMapper serviceCategoryMapper;
@Resource
......@@ -35,7 +33,11 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
public Result<List<ServiceCategoryVO>> list(String keyWord) {
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));
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