订单查询增加userId参数筛选
This commit is contained in:
parent
6863fbc100
commit
d7fe7cf40a
|
|
@ -42,7 +42,6 @@ public class TbOrderInfoController {
|
|||
|
||||
@PostMapping("/date")
|
||||
@ApiOperation("查询订单")
|
||||
@AnonymousPostMapping
|
||||
public ResponseEntity<Object> queryTbOrderInfo(@RequestBody TbOrderInfoQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbOrderInfoService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@ public class TbOrderInfoQueryCriteria{
|
|||
@Query(type = Query.Type.BETWEEN)
|
||||
private List<Long> createdAt;
|
||||
|
||||
private Integer userId;
|
||||
|
||||
|
||||
@Query
|
||||
private String tableName;
|
||||
|
|
@ -79,4 +81,18 @@ public class TbOrderInfoQueryCriteria{
|
|||
public void setProductName(String productName) {
|
||||
if(StringUtils.isNotBlank(productName)) this.productName = productName;
|
||||
}
|
||||
|
||||
public Integer getPage() {
|
||||
if (page == null) {
|
||||
return 0;
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
if (pageSize == null) {
|
||||
return 10;
|
||||
}
|
||||
return pageSize;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue