Commit 2a545c98 authored by lining's avatar lining

feat: 查子类只返回子类

parent 073c30cc
......@@ -5,6 +5,7 @@ import com.onsiteservice.dao.common.page.PageInfoVO;
import com.onsiteservice.dao.common.page.PageParams;
import com.onsiteservice.miniapp.controller.category.dto.PageServiceCategoryDTO;
import com.onsiteservice.miniapp.controller.category.vo.ServiceCategoryVO;
import com.onsiteservice.miniapp.controller.category.vo.ServiceSubclassVO;
import com.onsiteservice.miniapp.service.category.ServiceCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -38,8 +39,8 @@ public class ServiceCategoryController {
@ApiOperation(value = "查询服务子类(大类全部返回)")
@GetMapping("list")
public Result<List<ServiceCategoryVO>> list(@RequestParam(required = false) String keyWord) {
return serviceCategoryService.list(keyWord);
public Result<List<ServiceSubclassVO>> list(@RequestParam(required = false) String keyWord) {
return serviceCategoryService.selectByKeyWord(keyWord);
}
......
......@@ -31,17 +31,6 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
@Resource
private ServiceSubclassMapper serviceSubclassMapper;
/**
* 分页查询列表
*/
/*public Result<PageInfoVO<ServiceCategoryVO>> getPage(PageServiceCategoryDTO dto) {
PageHelper.startPage(dto.getPage(), dto.getSize());
List<ServiceCategory> serviceCategoryList = serviceCategoryBizMapper.selectServiceCategoryPage(dto);
List<ServiceCategoryVO> serviceCategoryVOList = serviceCategoryList.parallelStream()
.map(e -> AttrCopyUtils.copy(e, new ServiceCategoryVO())).collect(Collectors.toList());
return ResultGenerator.success(new PageInfoVO<>(serviceCategoryVOList));
}*/
public Result<List<ServiceCategoryVO>> list(String keyWord) {
List<ServiceCategory> serviceCategoryList = serviceCategoryMapper.selectAllOrderBySequence();
......@@ -62,5 +51,12 @@ public class ServiceCategoryService extends AbstractMapper<ServiceCategory> {
return ResultGenerator.success(serviceCategoryVOList);
}
public Result<List<ServiceSubclassVO>> selectByKeyWord(String keyWord) {
List<ServiceSubclass> serviceSubclassList = serviceSubclassMapper.selectByServiceNameLike(keyWord);
List<ServiceSubclassVO> serviceSubclassVOList = serviceSubclassList.parallelStream()
.map(e1 -> AttrCopyUtils.copy(e1, new ServiceSubclassVO())).collect(Collectors.toList());
return ResultGenerator.success(serviceSubclassVOList);
}
}
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