订单查询增加userId参数筛选

This commit is contained in:
2024-08-27 15:59:43 +08:00
parent 6863fbc100
commit d7fe7cf40a
3 changed files with 20 additions and 6 deletions

View File

@@ -108,6 +108,10 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
predicate = criteriaBuilder.and(predicate, criteriaBuilder.notEqual(root.get("orderType"), "return"));
}
if (criteria.getUserId() != null && criteria.getUserId() != 0) {
predicate = criteriaBuilder.and(predicate, criteriaBuilder.equal(root.get("userId"), criteria.getUserId()));
}
if (StringUtils.isNotBlank(criteria.getProductName())) {
Date startTime, endTime;
DateTime offsetMonth = cn.hutool.core.date.DateUtil.offsetMonth(new Date(), 3);
@@ -120,11 +124,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
startTime = new Date(startLong);
endTime = new Date(endLong);
// 如果开始时间小于三个月前,不查询
// if (startTime.before(offsetMonth)) {
// throw new BadRequestException("查询时间范围不能超过三个月");
// }
} else {
startTime = offsetMonth;
endTime = new Date();