package cn.iocoder.yudao.module.member.dal.mysql.storegoods;

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.member.dal.dataobject.storegoods.StoreGoodsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.storegoods.vo.*;

/**
 * 商品 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface StoreGoodsMapper extends BaseMapperX<StoreGoodsDO> {

    default PageResult<StoreGoodsDO> selectPage(StoreGoodsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StoreGoodsDO>()
                .eqIfPresent(StoreGoodsDO::getCategoryId, reqVO.getCategoryId())
                .likeIfPresent(StoreGoodsDO::getGoodsName, reqVO.getGoodsName())
                .eqIfPresent(StoreGoodsDO::getPrice, reqVO.getPrice())
                .eqIfPresent(StoreGoodsDO::getSalesModel, reqVO.getSalesModel())
                .eqIfPresent(StoreGoodsDO::getEquipmentCode, reqVO.getEquipmentCode())
                .betweenIfPresent(StoreGoodsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StoreGoodsDO::getCategoryId));
    }

}