package cn.iocoder.yudao.module.wms.dal.mysql.productcategory;

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

/**
 * 产品分类 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface ProductCategoryMapper extends BaseMapperX<ProductCategoryDO> {

    default PageResult<ProductCategoryDO> selectPage(ProductCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductCategoryDO>()
                .eqIfPresent(ProductCategoryDO::getIndustryCategoryId, reqVO.getIndustryCategoryId())
                .likeIfPresent(ProductCategoryDO::getName, reqVO.getName())
                .eqIfPresent(ProductCategoryDO::getUnitI, reqVO.getUnitI())
                .eqIfPresent(ProductCategoryDO::getUnitIi, reqVO.getUnitIi())
                .eqIfPresent(ProductCategoryDO::getUnitIii, reqVO.getUnitIii())
                .eqIfPresent(ProductCategoryDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProductCategoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductCategoryDO::getId));
    }

}