订单查询增加userId参数筛选
This commit is contained in:
@@ -42,7 +42,6 @@ public class TbOrderInfoController {
|
|||||||
|
|
||||||
@PostMapping("/date")
|
@PostMapping("/date")
|
||||||
@ApiOperation("查询订单")
|
@ApiOperation("查询订单")
|
||||||
@AnonymousPostMapping
|
|
||||||
public ResponseEntity<Object> queryTbOrderInfo(@RequestBody TbOrderInfoQueryCriteria criteria){
|
public ResponseEntity<Object> queryTbOrderInfo(@RequestBody TbOrderInfoQueryCriteria criteria){
|
||||||
return new ResponseEntity<>(tbOrderInfoService.queryAllPage(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(tbOrderInfoService.queryAllPage(criteria),HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,8 @@ public class TbOrderInfoQueryCriteria{
|
|||||||
@Query(type = Query.Type.BETWEEN)
|
@Query(type = Query.Type.BETWEEN)
|
||||||
private List<Long> createdAt;
|
private List<Long> createdAt;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
|
||||||
@Query
|
@Query
|
||||||
private String tableName;
|
private String tableName;
|
||||||
@@ -79,4 +81,18 @@ public class TbOrderInfoQueryCriteria{
|
|||||||
public void setProductName(String productName) {
|
public void setProductName(String productName) {
|
||||||
if(StringUtils.isNotBlank(productName)) this.productName = 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"));
|
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())) {
|
if (StringUtils.isNotBlank(criteria.getProductName())) {
|
||||||
Date startTime, endTime;
|
Date startTime, endTime;
|
||||||
DateTime offsetMonth = cn.hutool.core.date.DateUtil.offsetMonth(new Date(), 3);
|
DateTime offsetMonth = cn.hutool.core.date.DateUtil.offsetMonth(new Date(), 3);
|
||||||
@@ -120,11 +124,6 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
|||||||
|
|
||||||
startTime = new Date(startLong);
|
startTime = new Date(startLong);
|
||||||
endTime = new Date(endLong);
|
endTime = new Date(endLong);
|
||||||
|
|
||||||
// 如果开始时间小于三个月前,不查询
|
|
||||||
// if (startTime.before(offsetMonth)) {
|
|
||||||
// throw new BadRequestException("查询时间范围不能超过三个月");
|
|
||||||
// }
|
|
||||||
} else {
|
} else {
|
||||||
startTime = offsetMonth;
|
startTime = offsetMonth;
|
||||||
endTime = new Date();
|
endTime = new Date();
|
||||||
|
|||||||
Reference in New Issue
Block a user