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

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.wzj.soopin.member.domain.po.MemberCart;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.dromara.common.core.domain.BaseBO;

/**
 * 购物车 查询 对象
 *
 * @author zcc
 */
@Schema(description="购物车 查询 对象")
@Data
public class MemberCartBO extends BaseBO<MemberCart> {

    @Schema(description ="0->失效；1->有效 精确匹配")
    private Integer status;

    @Schema(description ="用户ID 精确匹配")
    private Long memberId;

    @Schema(description ="商品ID 精确匹配")
    private Long productId;

    @Schema(description ="展示图片 精确匹配")
    private String pic;

    @Schema(description ="SKU ID 精确匹配")
    private Long skuId;

    @Schema(description ="商品名称 精确匹配")
    private String productName;

    @Schema(description ="商品属性 精确匹配")
    private String spec;

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


    @Override
    public LambdaQueryWrapper<MemberCart> toWrapper() {
        return super.toWrapper()
            .eq(status!=null,MemberCart::getStatus,status)
            .eq(memberId!=null,MemberCart::getMemberId,memberId)
            .eq(productId!=null,MemberCart::getProductId,productId)
            .eq(pic!=null,MemberCart::getPic,pic)
            .eq(skuId!=null,MemberCart::getSkuId,skuId)
            .eq(productName!=null,MemberCart::getProductName,productName)
            .eq(spec!=null,MemberCart::getSpec,spec)
            .eq(quantity!=null,MemberCart::getQuantity,quantity);
    }
}
