package com.wzj.soopin.order.domain.bo;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wzj.soopin.order.domain.entity.OrderDeliveryHistory;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
@ApiModel(description="订单发货记录 查询 对象")
public class OrderDeliveryHistoryBo {

    @Schema(description ="订单id  精确匹配")
    private Long orderId;

    @Schema(description ="物流公司  精确匹配")
    private String deliveryCompany;

    @Schema(description ="物流单号  精确匹配")
    private String deliverySn;

    public Wrapper<OrderDeliveryHistory> toWrapper() {
        return new LambdaQueryWrapper<OrderDeliveryHistory>()
            .eq(orderId != null, OrderDeliveryHistory::getOrderId, orderId)
            .eq(deliveryCompany != null && !deliveryCompany.isEmpty(),
                OrderDeliveryHistory::getDeliveryCompany, deliveryCompany)
            .eq(deliverySn != null && !deliverySn.isEmpty(),
                OrderDeliveryHistory::getDeliverySn, deliverySn);
    }
}
