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

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

/**
 * 产线管理 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface ProductionLineMapper extends BaseMapperX<ProductionLineDO> {

    default PageResult<ProductionLineDO> selectPage(ProductionLinePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ProductionLineDO>()
                .eqIfPresent(ProductionLineDO::getFactoryId, reqVO.getFactoryId())
                .likeIfPresent(ProductionLineDO::getName, reqVO.getName())
                .eqIfPresent(ProductionLineDO::getAddress, reqVO.getAddress())
                .eqIfPresent(ProductionLineDO::getPrincipal, reqVO.getPrincipal())
                .eqIfPresent(ProductionLineDO::getPhone, reqVO.getPhone())
                .eqIfPresent(ProductionLineDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ProductionLineDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(ProductionLineDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ProductionLineDO::getId));
    }

}