package cn.iocoder.yudao.module.system.dal.mysql.supplier;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.supplier.SupplierProductDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.supplier.vo.*;

/**
 * 供应商商品 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface SupplierProductMapper extends BaseMapperX<SupplierProductDO> {

    default PageResult<SupplierProductDO> selectPage(SupplierProductPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplierProductDO>()
                .eqIfPresent(SupplierProductDO::getSupplierId, reqVO.getSupplierId())
                .eqIfPresent(SupplierProductDO::getAssetsTypeId, reqVO.getAssetsTypeId())
                .likeIfPresent(SupplierProductDO::getAssetsName, reqVO.getAssetsName())
                .eqIfPresent(SupplierProductDO::getUtil, reqVO.getUtil())
                .eqIfPresent(SupplierProductDO::getModel, reqVO.getModel())
                .eqIfPresent(SupplierProductDO::getPrice, reqVO.getPrice())
                .eqIfPresent(SupplierProductDO::getRemarks, reqVO.getRemarks())
                .betweenIfPresent(SupplierProductDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SupplierProductDO::getId));
    }

}
