|
@@ -1,5 +1,6 @@
|
|
|
package com.ylx.servicecategory.service.impl;
|
|
package com.ylx.servicecategory.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -8,6 +9,7 @@ import com.ylx.common.utils.StringUtils;
|
|
|
import com.ylx.project.domain.Project;
|
|
import com.ylx.project.domain.Project;
|
|
|
import com.ylx.project.mapper.ProjectMapper;
|
|
import com.ylx.project.mapper.ProjectMapper;
|
|
|
import com.ylx.servicecategory.domain.ServiceCategory;
|
|
import com.ylx.servicecategory.domain.ServiceCategory;
|
|
|
|
|
+import com.ylx.servicecategory.domain.vo.ClientServiceCategoryVO;
|
|
|
import com.ylx.servicecategory.mapper.ServiceCategoryMapper;
|
|
import com.ylx.servicecategory.mapper.ServiceCategoryMapper;
|
|
|
import com.ylx.servicecategory.service.ServiceCategoryService;
|
|
import com.ylx.servicecategory.service.ServiceCategoryService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 服务类目服务实现类
|
|
* 服务类目服务实现类
|
|
@@ -24,6 +27,9 @@ public class ServiceCategoryServiceImpl extends ServiceImpl<ServiceCategoryMappe
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ProjectMapper projectMapper;
|
|
private ProjectMapper projectMapper;
|
|
|
|
|
+ private static final int ONLINE = 1;
|
|
|
|
|
+ private static final int NOT_DELETE = 0;
|
|
|
|
|
+ private static final int IS_DISPLAY = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -161,6 +167,31 @@ public class ServiceCategoryServiceImpl extends ServiceImpl<ServiceCategoryMappe
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Page<ClientServiceCategoryVO> page(Page<ServiceCategory> page) {
|
|
|
|
|
+ LambdaQueryWrapper<ServiceCategory> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(ServiceCategory::getIsDelete, NOT_DELETE)
|
|
|
|
|
+ .eq(ServiceCategory::getIsOnline, ONLINE)
|
|
|
|
|
+ .eq(ServiceCategory::getIsHomeDisplay, IS_DISPLAY)
|
|
|
|
|
+ .orderByDesc(ServiceCategory::getSort);
|
|
|
|
|
+
|
|
|
|
|
+ Page<ServiceCategory> serviceCategoryrPage = this.baseMapper.selectPage(page, wrapper);
|
|
|
|
|
+ Page<ClientServiceCategoryVO> pageData = new Page<>(
|
|
|
|
|
+ serviceCategoryrPage.getCurrent(),
|
|
|
|
|
+ serviceCategoryrPage.getSize(),
|
|
|
|
|
+ serviceCategoryrPage.getTotal()
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ if (CollectionUtil.isNotEmpty(serviceCategoryrPage.getRecords())) {
|
|
|
|
|
+ List<ClientServiceCategoryVO> voList = serviceCategoryrPage.getRecords().stream()
|
|
|
|
|
+ .map(ClientServiceCategoryVO::new)
|
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
|
+ pageData.setRecords(voList);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return pageData;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private void checkAddParam(ServiceCategory serviceCategory) {
|
|
private void checkAddParam(ServiceCategory serviceCategory) {
|
|
|
checkRequiredParam(serviceCategory);
|
|
checkRequiredParam(serviceCategory);
|
|
|
}
|
|
}
|