完善了订单接口

This commit is contained in:
chen-xin-zhi 2024-11-03 18:57:56 +08:00
parent 8ef61448a1
commit 9e031c3bfb
4 changed files with 17 additions and 8 deletions

View File

@ -17,6 +17,11 @@ public class OrderAddRequest implements Serializable {
*/
private Long userId;
/**
* 订单编号
*/
private String orderNumber;
/**
* 地址信息快照

View File

@ -1,13 +1,6 @@
package com.cultural.heritage.model.dto.order;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.cultural.heritage.common.PageRequest;
import com.cultural.heritage.model.dto.snapshot.AddressSnapshot;
import com.cultural.heritage.model.dto.snapshot.ContactsSnapshot;
import com.cultural.heritage.model.dto.snapshot.CouponSnapshot;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
@ -24,6 +17,11 @@ public class OrderQueryRequest extends PageRequest implements Serializable {
*/
private Long userId;
/**
* 订单编号
*/
private String OrderNumber;
/**
* 订单最小金额

View File

@ -31,6 +31,11 @@ public class Order implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;
/**
* 订单编号
*/
private String OrderNumber;
/**
* 用户id

View File

@ -10,7 +10,6 @@ import com.cultural.heritage.model.dto.order.OrderQueryRequest;
import com.cultural.heritage.model.entity.Order;
import com.cultural.heritage.service.order.OrderService;
import com.cultural.heritage.utils.SqlUtils;
import io.netty.util.internal.StringUtil;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -33,6 +32,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
Double minTotalAmount = orderQueryRequest.getMinTotalAmount();
Double maxTotalAmount = orderQueryRequest.getMaxTotalAmount();
String orderStatus = orderQueryRequest.getOrderStatus();
String orderNumber = orderQueryRequest.getOrderNumber();
Date startTime = orderQueryRequest.getStartTime();
Date endTime = orderQueryRequest.getEndTime();
String sortOrder = orderQueryRequest.getSortOrder();
@ -44,6 +44,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
queryWrapper.le(ObjectUtils.isNotEmpty(maxTotalAmount), "totalAmount", maxTotalAmount);
queryWrapper.eq(StringUtils.isNotBlank(orderStatus), "orderStatus", orderStatus);
queryWrapper.between("createTime", startTime, endTime);
queryWrapper.eq(StringUtils.isNotBlank(orderNumber), "orderNumber", orderNumber);
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC),
sortField);
return queryWrapper;