package cn.iocoder.yudao.module.smartfactory.dal.mysql.factorydataoverview;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorydataoverview.vo.FactoryDataOverviewPageReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydataoverview.FactoryDataOverviewDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 工厂数据总览 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface FactoryDataOverviewMapper extends BaseMapperX<FactoryDataOverviewDO> {

    default PageResult<FactoryDataOverviewDO> selectPage(FactoryDataOverviewPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FactoryDataOverviewDO>()
                .eqIfPresent(FactoryDataOverviewDO::getFactoryId, reqVO.getFactoryId())
                .likeIfPresent(FactoryDataOverviewDO::getFullName, reqVO.getFullName())
                .likeIfPresent(FactoryDataOverviewDO::getShortName, reqVO.getShortName())
                .likeIfPresent(FactoryDataOverviewDO::getCityName, reqVO.getCityName())
                .eqIfPresent(FactoryDataOverviewDO::getWorkerNum, reqVO.getWorkerNum())
                .eqIfPresent(FactoryDataOverviewDO::getTruckTotalNum, reqVO.getTruckTotalNum())
                .eqIfPresent(FactoryDataOverviewDO::getDbxNum, reqVO.getDbxNum())
                .eqIfPresent(FactoryDataOverviewDO::getTpNum, reqVO.getTpNum())
                .eqIfPresent(FactoryDataOverviewDO::getBdNum, reqVO.getBdNum())
                .betweenIfPresent(FactoryDataOverviewDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FactoryDataOverviewDO::getId));
    }

}