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

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

@Data
@Schema(description = "品牌管理 查询 对象")
public class BrandBo {

    @Schema(description = "NAME 模糊匹配")
    private String nameLike;

    @Schema(description = "SORT 精确匹配")
    private Integer sort;

    @Schema(description = "SHOW_STATUS 精确匹配")
    private Integer showStatus;

    @Schema(description = "品牌logo 精确匹配")
    private String logo;

    public Wrapper<Brand> toWrapper() {
        return new LambdaQueryWrapper<Brand>()
            .like(nameLike!= null &&!nameLike.isEmpty(), Brand::getName, nameLike)
            .eq(sort!= null, Brand::getSort, sort)
            .eq(showStatus!= null, Brand::getShowStatus, showStatus)
            .eq(logo!= null &&!logo.isEmpty(), Brand::getLogo, logo);
    }
}
