|
@@ -12,11 +12,15 @@ import com.izouma.jiashanxia.exception.BusinessException;
|
|
|
import com.izouma.jiashanxia.repo.*;
|
|
import com.izouma.jiashanxia.repo.*;
|
|
|
import com.izouma.jiashanxia.utils.JpaUtils;
|
|
import com.izouma.jiashanxia.utils.JpaUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
|
+import javax.persistence.criteria.CriteriaQuery;
|
|
|
import javax.persistence.criteria.Predicate;
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
|
+import javax.persistence.criteria.Root;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -37,6 +41,7 @@ public class OrderInfoService {
|
|
|
private CommissionRecordRepo commissionRecordRepo;
|
|
private CommissionRecordRepo commissionRecordRepo;
|
|
|
private UserSetService userSetService;
|
|
private UserSetService userSetService;
|
|
|
private CompanyRepo companyRepo;
|
|
private CompanyRepo companyRepo;
|
|
|
|
|
+ private WithdrawService withdrawService;
|
|
|
|
|
|
|
|
public Page<OrderInfo> all(PageQuery pageQuery) {
|
|
public Page<OrderInfo> all(PageQuery pageQuery) {
|
|
|
return orderInfoRepo.findAll(JpaUtils.toSpecification(pageQuery, OrderInfo.class), JpaUtils.toPageRequest(pageQuery));
|
|
return orderInfoRepo.findAll(JpaUtils.toSpecification(pageQuery, OrderInfo.class), JpaUtils.toPageRequest(pageQuery));
|
|
@@ -49,11 +54,12 @@ public class OrderInfoService {
|
|
|
return orderInfoRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
|
|
return orderInfoRepo.findAll(((root, criteriaQuery, criteriaBuilder) -> {
|
|
|
List<Predicate> and = JpaUtils.toPredicates(pageQuery, OrderInfo.class, root, criteriaQuery, criteriaBuilder);
|
|
List<Predicate> and = JpaUtils.toPredicates(pageQuery, OrderInfo.class, root, criteriaQuery, criteriaBuilder);
|
|
|
if (StrUtil.isNotEmpty(pageQuery.getSearch())) {
|
|
if (StrUtil.isNotEmpty(pageQuery.getSearch())) {
|
|
|
- List<Predicate> or = new ArrayList<>();
|
|
|
|
|
|
|
+ /* List<Predicate> or = new ArrayList<>();
|
|
|
or.add(and.get(and.size() - 1));
|
|
or.add(and.get(and.size() - 1));
|
|
|
and.remove(and.get(and.size() - 1));
|
|
and.remove(and.get(and.size() - 1));
|
|
|
or.add(criteriaBuilder.like(root.join("user").get("nickname"), "%" + pageQuery.getSearch() + "%"));
|
|
or.add(criteriaBuilder.like(root.join("user").get("nickname"), "%" + pageQuery.getSearch() + "%"));
|
|
|
- and.add(criteriaBuilder.or(or.toArray(new Predicate[0])));
|
|
|
|
|
|
|
+ and.add(criteriaBuilder.or(or.toArray(new Predicate[0])));*/
|
|
|
|
|
+ withdrawService.getNickname(pageQuery.getSearch(), and, root, criteriaBuilder);
|
|
|
}
|
|
}
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
}), JpaUtils.toPageRequest(pageQuery));
|
|
}), JpaUtils.toPageRequest(pageQuery));
|