- 添加发货功能
parent
8b11176353
commit
10807b0c6f
|
@ -7,12 +7,13 @@ import cn.iocoder.mall.order.api.bo.OrderPageBO;
|
||||||
import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
|
import cn.iocoder.mall.order.api.bo.OrderRecipientBO;
|
||||||
import cn.iocoder.mall.order.api.dto.*;
|
import cn.iocoder.mall.order.api.dto.*;
|
||||||
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
import cn.iocoder.mall.order.application.convert.OrderConvertAPP;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderItemUpdateVO;
|
import cn.iocoder.mall.order.application.convert.OrderDeliveryConvert;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderLogisticsVO;
|
import cn.iocoder.mall.order.application.po.OrderDeliverPO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderPageQueryVO;
|
import cn.iocoder.mall.order.application.po.OrderItemUpdatePO;
|
||||||
|
import cn.iocoder.mall.order.application.po.OrderLogisticsPO;
|
||||||
|
import cn.iocoder.mall.order.application.po.OrderPageQueryPO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
@ -35,7 +36,7 @@ public class AdminsOrderController {
|
||||||
|
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@ApiOperation("订单列表")
|
@ApiOperation("订单列表")
|
||||||
public CommonResult<OrderPageBO> getOrderPage(@Validated OrderPageQueryVO orderPageQueryVO) {
|
public CommonResult<OrderPageBO> getOrderPage(@Validated OrderPageQueryPO orderPageQueryVO) {
|
||||||
OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convertPageBO(orderPageQueryVO);
|
OrderQueryDTO orderQueryDTO = OrderConvertAPP.INSTANCE.convertPageBO(orderPageQueryVO);
|
||||||
return orderService.getOrderPage(orderQueryDTO);
|
return orderService.getOrderPage(orderQueryDTO);
|
||||||
}
|
}
|
||||||
|
@ -52,6 +53,12 @@ public class AdminsOrderController {
|
||||||
return orderService.getOrderRecipientBO(orderId);
|
return orderService.getOrderRecipientBO(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("order_deliver")
|
||||||
|
@ApiOperation("订单发货")
|
||||||
|
public CommonResult<OrderRecipientBO> orderDeliver(@RequestBody @Validated OrderDeliverPO orderDeliverPO) {
|
||||||
|
return orderService.orderDelivery(OrderDeliveryConvert.INSTANCE.convert(orderDeliverPO));
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("update_remark")
|
@PutMapping("update_remark")
|
||||||
@ApiOperation("更新-更新订单备注")
|
@ApiOperation("更新-更新订单备注")
|
||||||
public CommonResult updateRemark(@RequestParam("orderId") Integer orderId,
|
public CommonResult updateRemark(@RequestParam("orderId") Integer orderId,
|
||||||
|
@ -78,14 +85,14 @@ public class AdminsOrderController {
|
||||||
|
|
||||||
@PutMapping("order_item/update")
|
@PutMapping("order_item/update")
|
||||||
@ApiOperation("更新-订单item")
|
@ApiOperation("更新-订单item")
|
||||||
public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdateVO orderItemUpdateVO) {
|
public CommonResult updateOrderItem(@RequestBody @Validated OrderItemUpdatePO orderItemUpdateVO) {
|
||||||
OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderItemUpdateVO);
|
OrderItemUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderItemUpdateVO);
|
||||||
return orderService.updateOrderItem(dto);
|
return orderService.updateOrderItem(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("logistics/update")
|
@PutMapping("logistics/update")
|
||||||
@ApiOperation("更新-订单物流")
|
@ApiOperation("更新-订单物流")
|
||||||
public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsVO orderLogisticsVO) {
|
public CommonResult updateLogistics(@RequestBody @Validated OrderLogisticsPO orderLogisticsVO) {
|
||||||
OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderLogisticsVO);
|
OrderLogisticsUpdateDTO dto = OrderConvertAPP.INSTANCE.convertPageBO(orderLogisticsVO);
|
||||||
return orderService.updateLogistics(dto);
|
return orderService.updateLogistics(dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package cn.iocoder.mall.order.application.convert;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderItemUpdateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
|
import cn.iocoder.mall.order.api.dto.OrderQueryDTO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderItemUpdateVO;
|
import cn.iocoder.mall.order.application.po.OrderItemUpdatePO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderLogisticsVO;
|
import cn.iocoder.mall.order.application.po.OrderPageQueryPO;
|
||||||
import cn.iocoder.mall.order.application.vo.OrderPageQueryVO;
|
import cn.iocoder.mall.order.application.po.OrderLogisticsPO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
@ -24,11 +24,11 @@ public interface OrderConvertAPP {
|
||||||
OrderConvertAPP INSTANCE = Mappers.getMapper(OrderConvertAPP.class);
|
OrderConvertAPP INSTANCE = Mappers.getMapper(OrderConvertAPP.class);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderQueryDTO convertPageBO(OrderPageQueryVO orderPageQueryVO);
|
OrderQueryDTO convertPageBO(OrderPageQueryPO orderPageQueryVO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderLogisticsUpdateDTO convertPageBO(OrderLogisticsVO orderLogisticsVO);
|
OrderLogisticsUpdateDTO convertPageBO(OrderLogisticsPO orderLogisticsVO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderItemUpdateDTO convertPageBO(OrderItemUpdateVO orderItemUpdateVO);
|
OrderItemUpdateDTO convertPageBO(OrderItemUpdatePO orderItemUpdateVO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cn.iocoder.mall.order.application.convert;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
||||||
|
import cn.iocoder.mall.order.application.po.OrderDeliverPO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.Mappings;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-05 17:00
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface OrderDeliveryConvert {
|
||||||
|
|
||||||
|
OrderDeliveryConvert INSTANCE = Mappers.getMapper(OrderDeliveryConvert.class);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OrderDeliveryDTO convert(OrderDeliverPO orderDeliverPO);
|
||||||
|
}
|
|
@ -0,0 +1,89 @@
|
||||||
|
package cn.iocoder.mall.order.application.po;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单发货
|
||||||
|
*
|
||||||
|
* @author Sin
|
||||||
|
* @time 2019-04-05 16:55
|
||||||
|
*/
|
||||||
|
@ApiModel(description = "订单发货PO")
|
||||||
|
public class OrderDeliverPO implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单id")
|
||||||
|
@NotNull(message = "orderId不能为空")
|
||||||
|
private Integer orderId;
|
||||||
|
/**
|
||||||
|
* 物流 (字典)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("物流商家")
|
||||||
|
@NotNull(message = "必须选择商家")
|
||||||
|
private Integer logistics;
|
||||||
|
/**
|
||||||
|
* 物流编号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("物流单号")
|
||||||
|
@NotNull(message = "没有物流单号")
|
||||||
|
private String logisticsNo;
|
||||||
|
/**
|
||||||
|
* 订单 items
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("订单items")
|
||||||
|
@NotNull(message = "没有选择发货的商品")
|
||||||
|
private List<Integer> orderItemIds;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "OrderDeliverPO{" +
|
||||||
|
"orderId=" + orderId +
|
||||||
|
", logistics=" + logistics +
|
||||||
|
", logisticsNo='" + logisticsNo + '\'' +
|
||||||
|
", orderItemIds=" + orderItemIds +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOrderId() {
|
||||||
|
return orderId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDeliverPO setOrderId(Integer orderId) {
|
||||||
|
this.orderId = orderId;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLogistics() {
|
||||||
|
return logistics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDeliverPO setLogistics(Integer logistics) {
|
||||||
|
this.logistics = logistics;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogisticsNo() {
|
||||||
|
return logisticsNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDeliverPO setLogisticsNo(String logisticsNo) {
|
||||||
|
this.logisticsNo = logisticsNo;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getOrderItemIds() {
|
||||||
|
return orderItemIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderDeliverPO setOrderItemIds(List<Integer> orderItemIds) {
|
||||||
|
this.orderItemIds = orderItemIds;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,21 +12,9 @@ import java.util.List;
|
||||||
public class OrderDeliveryDTO implements Serializable {
|
public class OrderDeliveryDTO implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收件区域编号
|
* 订单id
|
||||||
*/
|
*/
|
||||||
private String areaNo;
|
private Integer orderId;
|
||||||
/**
|
|
||||||
* 收件人名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
|
||||||
* 收件手机号
|
|
||||||
*/
|
|
||||||
private String mobile;
|
|
||||||
/**
|
|
||||||
* 收件详细地址
|
|
||||||
*/
|
|
||||||
private String address;
|
|
||||||
/**
|
/**
|
||||||
* 物流 (字典)
|
* 物流 (字典)
|
||||||
*/
|
*/
|
||||||
|
@ -46,50 +34,20 @@ public class OrderDeliveryDTO implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "OrderDeliverGoodsDTO{" +
|
return "OrderDeliveryDTO{" +
|
||||||
"areaNo='" + areaNo + '\'' +
|
"orderId=" + orderId +
|
||||||
", name='" + name + '\'' +
|
|
||||||
", mobile='" + mobile + '\'' +
|
|
||||||
", address='" + address + '\'' +
|
|
||||||
", logistics=" + logistics +
|
", logistics=" + logistics +
|
||||||
", logisticsNo='" + logisticsNo + '\'' +
|
", logisticsNo='" + logisticsNo + '\'' +
|
||||||
", orderItemIds=" + orderItemIds +
|
", orderItemIds=" + orderItemIds +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAreaNo() {
|
public Integer getOrderId() {
|
||||||
return areaNo;
|
return orderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderDeliveryDTO setAreaNo(String areaNo) {
|
public OrderDeliveryDTO setOrderId(Integer orderId) {
|
||||||
this.areaNo = areaNo;
|
this.orderId = orderId;
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderDeliveryDTO setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobile() {
|
|
||||||
return mobile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderDeliveryDTO setMobile(String mobile) {
|
|
||||||
this.mobile = mobile;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAddress() {
|
|
||||||
return address;
|
|
||||||
}
|
|
||||||
|
|
||||||
public OrderDeliveryDTO setAddress(String address) {
|
|
||||||
this.address = address;
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import cn.iocoder.mall.order.api.dto.OrderCreateDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
import cn.iocoder.mall.order.api.dto.OrderDeliveryDTO;
|
||||||
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
import cn.iocoder.mall.order.api.dto.OrderLogisticsUpdateDTO;
|
||||||
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
|
import cn.iocoder.mall.order.biz.dataobject.OrderLogisticsDO;
|
||||||
|
import cn.iocoder.mall.order.biz.dataobject.OrderRecipientDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mappings;
|
import org.mapstruct.Mappings;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
|
@ -28,6 +29,9 @@ public interface OrderLogisticsConvert {
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
OrderLogisticsDO convert(OrderLogisticsUpdateDTO orderLogisticsDTO);
|
OrderLogisticsDO convert(OrderLogisticsUpdateDTO orderLogisticsDTO);
|
||||||
|
|
||||||
|
@Mappings({})
|
||||||
|
OrderLogisticsDO convert(OrderRecipientDO orderRecipientDO);
|
||||||
|
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
List<OrderLogisticsBO> convertOrderLogisticsBO(List<OrderLogisticsDO> orderLogisticsDOList);
|
List<OrderLogisticsBO> convertOrderLogisticsBO(List<OrderLogisticsDO> orderLogisticsDOList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public interface OrderItemMapper {
|
||||||
*
|
*
|
||||||
* @param orderItemDO
|
* @param orderItemDO
|
||||||
*/
|
*/
|
||||||
void updateById(OrderItemDO orderItemDO);
|
void updateById(@Param("orderItemDO") OrderItemDO orderItemDO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新 - 根据 orderId
|
* 更新 - 根据 orderId
|
||||||
|
@ -45,7 +45,7 @@ public interface OrderItemMapper {
|
||||||
*/
|
*/
|
||||||
void updateByIds(
|
void updateByIds(
|
||||||
@Param("ids") List<Integer> ids,
|
@Param("ids") List<Integer> ids,
|
||||||
OrderItemDO orderItemDO
|
@Param("orderItemDO") OrderItemDO orderItemDO
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,7 +54,7 @@ public interface OrderItemMapper {
|
||||||
* @param ids
|
* @param ids
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OrderItemDO> selectByIds(Collection<Integer> ids);
|
List<OrderItemDO> selectByIds(@Param("ids") Collection<Integer> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询 - 根据 orderIds 和 status
|
* 查询 - 根据 orderIds 和 status
|
||||||
|
|
|
@ -295,21 +295,55 @@ public class OrderServiceImpl implements OrderService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public CommonResult orderDelivery(OrderDeliveryDTO orderDelivery) {
|
public CommonResult orderDelivery(OrderDeliveryDTO orderDelivery) {
|
||||||
List<Integer> orderItemIds = orderDelivery.getOrderItemIds();
|
List<Integer> orderItemIds = orderDelivery.getOrderItemIds();
|
||||||
List<OrderItemDO> orderItemDOList = orderItemMapper.selectByIds(orderItemIds);
|
|
||||||
if (orderItemDOList.size() != orderItemIds.size()) {
|
// 获取所有订单 items
|
||||||
|
List<OrderItemDO> allOrderItems = orderItemMapper
|
||||||
|
.selectByOrderIdAndDeleted(orderDelivery.getOrderId(), DeletedStatusEnum.DELETED_NO.getValue());
|
||||||
|
|
||||||
|
// 当前需要发货订单,检查 id 和 status
|
||||||
|
List<OrderItemDO> needDeliveryOrderItems = allOrderItems.stream()
|
||||||
|
.filter(orderItemDO -> orderItemIds.contains(orderItemDO.getId())
|
||||||
|
&& OrderStatusEnum.WAIT_SHIPMENT.getValue() == orderItemDO.getStatus())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<OrderItemDO> deliveredOrderItems = allOrderItems.stream()
|
||||||
|
.filter(orderItemDO -> OrderStatusEnum.WAIT_SHIPMENT.getValue() == orderItemDO.getStatus())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 发货订单,检查
|
||||||
|
if (needDeliveryOrderItems.size() != orderItemIds.size()) {
|
||||||
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_DELIVERY_INCORRECT_DATA.getCode());
|
return ServiceExceptionUtil.error(OrderErrorCodeEnum.ORDER_DELIVERY_INCORRECT_DATA.getCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OrderRecipientDO orderRecipientDO = orderRecipientMapper.selectByOrderId(orderDelivery.getOrderId());
|
||||||
|
OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderRecipientDO);
|
||||||
|
|
||||||
// 保存物流信息
|
// 保存物流信息
|
||||||
OrderLogisticsDO orderLogisticsDO = OrderLogisticsConvert.INSTANCE.convert(orderDelivery);
|
|
||||||
orderLogisticsDO
|
orderLogisticsDO
|
||||||
|
.setLogisticsNo(orderDelivery.getLogisticsNo())
|
||||||
|
.setLogistics(orderDelivery.getLogistics())
|
||||||
.setCreateTime(new Date())
|
.setCreateTime(new Date())
|
||||||
.setUpdateTime(null);
|
.setUpdateTime(null);
|
||||||
|
|
||||||
orderLogisticsMapper.insert(orderLogisticsDO);
|
orderLogisticsMapper.insert(orderLogisticsDO);
|
||||||
|
|
||||||
// 关联订单item 和 物流信息
|
// 关联订单item 和 物流信息
|
||||||
orderItemMapper.updateByIds(orderItemIds, new OrderItemDO().setOrderLogisticsId(orderLogisticsDO.getId()));
|
orderItemMapper.updateByIds(
|
||||||
|
orderItemIds,
|
||||||
|
new OrderItemDO()
|
||||||
|
.setOrderLogisticsId(orderLogisticsDO.getId())
|
||||||
|
.setStatus(OrderStatusEnum.ALREADY_SHIPMENT.getValue())
|
||||||
|
);
|
||||||
|
|
||||||
|
// 子订单是否全部发货,如果发完,就更新 order
|
||||||
|
if (deliveredOrderItems.size() <= 0) {
|
||||||
|
orderMapper.updateById(
|
||||||
|
new OrderDO()
|
||||||
|
.setId(orderDelivery.getOrderId())
|
||||||
|
.setStatus(OrderStatusEnum.ALREADY_SHIPMENT.getValue())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,61 +29,64 @@
|
||||||
-->
|
-->
|
||||||
<sql id="updateFieldSql" >
|
<sql id="updateFieldSql" >
|
||||||
<set>
|
<set>
|
||||||
<if test="orderId != null">
|
<if test="orderItemDO.orderId != null">
|
||||||
, order_id = #{orderId}
|
, order_id = #{orderItemDO.orderId}
|
||||||
</if>
|
</if>
|
||||||
<if test="orderNo != null">
|
<if test="orderItemDO.orderNo != null">
|
||||||
, order_no = #{orderNo}
|
, order_no = #{orderItemDO.orderNo}
|
||||||
</if>
|
</if>
|
||||||
<if test="skuId != null">
|
<if test="orderItemDO.orderLogisticsId != null">
|
||||||
, sku_id = #{skuId}
|
, order_logistics_id = #{orderItemDO.orderLogisticsId}
|
||||||
</if>
|
</if>
|
||||||
<if test="skuName != null">
|
<if test="orderItemDO.skuId != null">
|
||||||
, sku_name = #{skuName}
|
, sku_id = #{orderItemDO.skuId}
|
||||||
</if>
|
</if>
|
||||||
<if test="skuImage != null">
|
<if test="orderItemDO.skuName != null">
|
||||||
, sku_image = #{skuImage}
|
, sku_name = #{orderItemDO.skuName}
|
||||||
</if>
|
</if>
|
||||||
<if test="quantity != null">
|
<if test="orderItemDO.skuImage != null">
|
||||||
, quantity = #{quantity}
|
, sku_image = #{orderItemDO.skuImage}
|
||||||
</if>
|
</if>
|
||||||
<if test="price != null">
|
<if test="orderItemDO.quantity != null">
|
||||||
, price = #{price}
|
, quantity = #{orderItemDO.quantity}
|
||||||
</if>
|
</if>
|
||||||
<if test="payAmount != null">
|
<if test="orderItemDO.price != null">
|
||||||
, pay_amount = #{payAmount}
|
, price = #{orderItemDO.price}
|
||||||
|
</if>
|
||||||
|
<if test="orderItemDO.payAmount != null">
|
||||||
|
, pay_amount = #{orderItemDO.payAmount}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="paymentTime != null">
|
<if test="orderItemDO.paymentTime != null">
|
||||||
, payment_time = #{paymentTime}
|
, payment_time = #{orderItemDO.paymentTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="deliveryTime != null">
|
<if test="orderItemDO.deliveryTime != null">
|
||||||
, delivery_time = #{deliveryTime}
|
, delivery_time = #{orderItemDO.deliveryTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="receiverTime != null">
|
<if test="orderItemDO.receiverTime != null">
|
||||||
, receiver_time = #{receiverTime}
|
, receiver_time = #{orderItemDO.receiverTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="closingTime != null">
|
<if test="orderItemDO.closingTime != null">
|
||||||
, closing_time = #{closingTime}
|
, closing_time = #{orderItemDO.closingTime}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="hasReturnExchange != null">
|
<if test="orderItemDO.hasReturnExchange != null">
|
||||||
, has_return_exchange = #{hasReturnExchange}
|
, has_return_exchange = #{orderItemDO.hasReturnExchange}
|
||||||
</if>
|
</if>
|
||||||
<if test="status != null">
|
<if test="orderItemDO.status != null">
|
||||||
, status = #{status}
|
, status = #{orderItemDO.status}
|
||||||
</if>
|
</if>
|
||||||
<if test="deliveryType != null">
|
<if test="orderItemDO.deliveryType != null">
|
||||||
, delivery_type = #{deliveryType}
|
, delivery_type = #{orderItemDO.deliveryType}
|
||||||
</if>
|
</if>
|
||||||
<if test="deleted != null">
|
<if test="orderItemDO.deleted != null">
|
||||||
, `deleted` = #{deleted}
|
, `deleted` = #{orderItemDO.deleted}
|
||||||
</if>
|
</if>
|
||||||
<if test="createTime != null">
|
<if test="orderItemDO.createTime != null">
|
||||||
, create_time = #{createTime}
|
, create_time = #{orderItemDO.createTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="updateTime != null">
|
<if test="orderItemDO.updateTime != null">
|
||||||
, update_time = #{updateTime}
|
, update_time = #{orderItemDO.updateTime}
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -94,7 +97,7 @@
|
||||||
<update id="updateById" parameterType="OrderDO">
|
<update id="updateById" parameterType="OrderDO">
|
||||||
UPDATE `order_item`
|
UPDATE `order_item`
|
||||||
<include refid="updateFieldSql" />
|
<include refid="updateFieldSql" />
|
||||||
WHERE id = #{id}
|
WHERE id = #{orderItemDO.id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
-->
|
-->
|
||||||
<insert id="insert" parameterType="OrderLogisticsDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderLogisticsDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order_logistics` (
|
INSERT INTO `order_logistics` (
|
||||||
area_no, `name`, mobile, address, logistics_no, create_time, update_time
|
area_no, `name`, mobile, address, logistics, logistics_no, create_time, update_time
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{areaNo}, #{name}, #{mobile}, #{address},
|
#{areaNo}, #{name}, #{mobile}, #{address},
|
||||||
#{logisticsNo}, #{createTime}, #{updateTime}
|
#{logistics}, #{logisticsNo}, #{createTime}, #{updateTime}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
@ -35,6 +35,9 @@
|
||||||
<if test="address != null">
|
<if test="address != null">
|
||||||
, address = #{address}
|
, address = #{address}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="logistics != null">
|
||||||
|
, logistics = #{logistics}
|
||||||
|
</if>
|
||||||
<if test="logisticsNo != null">
|
<if test="logisticsNo != null">
|
||||||
, logistics_no = #{logisticsNo}
|
, logistics_no = #{logisticsNo}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
-->
|
-->
|
||||||
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO `order` (
|
INSERT INTO `order` (
|
||||||
user_id, order_logistics_id, order_no, price, payment_time,
|
user_id, order_no, price, payment_time,
|
||||||
delivery_time, receiver_time, closing_time,
|
delivery_time, receiver_time, closing_time,
|
||||||
has_return_exchange, status, remark,
|
has_return_exchange, status, remark,
|
||||||
create_time, update_time, `deleted`
|
create_time, update_time, `deleted`
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{orderLogisticsId}, #{userId}, #{orderNo}, #{price}, #{paymentTime},
|
#{userId}, #{orderNo}, #{price}, #{paymentTime},
|
||||||
#{deliveryTime}, #{receiverTime}, #{closingTime},
|
#{deliveryTime}, #{receiverTime}, #{closingTime},
|
||||||
#{hasReturnExchange}, #{status}, #{remark},
|
#{hasReturnExchange}, #{status}, #{remark},
|
||||||
#{createTime}, #{updateTime}, #{deleted}
|
#{createTime}, #{updateTime}, #{deleted}
|
||||||
|
@ -31,9 +31,6 @@
|
||||||
-->
|
-->
|
||||||
<sql id="updateFieldSql" >
|
<sql id="updateFieldSql" >
|
||||||
<set>
|
<set>
|
||||||
<if test="orderLogisticsId != null">
|
|
||||||
, order_logistics_id = #{orderLogisticsId}
|
|
||||||
</if>
|
|
||||||
<if test="orderNo != null">
|
<if test="orderNo != null">
|
||||||
, order_no = #{orderNo}
|
, order_no = #{orderNo}
|
||||||
</if>
|
</if>
|
||||||
|
@ -110,9 +107,6 @@
|
||||||
<if test="orderNo != null">
|
<if test="orderNo != null">
|
||||||
AND `order_no` = #{orderNo}
|
AND `order_no` = #{orderNo}
|
||||||
</if>
|
</if>
|
||||||
<if test="orderLogisticsId != null">
|
|
||||||
AND `order_logistics_id` = #{orderLogisticsId}
|
|
||||||
</if>
|
|
||||||
<if test="hasReturnExchange != null">
|
<if test="hasReturnExchange != null">
|
||||||
AND `has_return_exchange` = #{hasReturnExchange}
|
AND `has_return_exchange` = #{hasReturnExchange}
|
||||||
</if>
|
</if>
|
||||||
|
|
Loading…
Reference in New Issue