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.AftersaleItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.common.excel.annotation.Excel;

import java.math.BigDecimal;

@Data
@ApiModel(description="订单中所包含的商品 查询 对象")
public class AftersaleItemBo {

    @Schema(description = "MEMBER_ID 精确匹配")
    private Long memberId;

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

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

    @Schema(description = "退款金额 精确匹配")
    private BigDecimal returnAmount;

    @Schema(description = "退货数量 精确匹配")
    private Integer quantity;

    @Schema(description = "售后单id")
    private Long aftersaleId;

    public Wrapper<AftersaleItem> toWrapper() {
        return new LambdaQueryWrapper<AftersaleItem>()
            .eq(memberId != null, AftersaleItem::getMemberId, memberId)
            .eq(orderId != null, AftersaleItem::getOrderId, orderId)
            .eq(orderItemId != null, AftersaleItem::getOrderItemId, orderItemId)
            .eq(returnAmount != null, AftersaleItem::getReturnAmount, returnAmount)
            .eq(quantity != null, AftersaleItem::getQuantity, quantity)
            .eq(aftersaleId != null, AftersaleItem::getAftersaleId, aftersaleId);
    }
}
