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

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.factorydata.vo.FactoryDataPageReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorydata.FactoryDataDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 工厂出库入库数据 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface FactoryDataMapper extends BaseMapperX<FactoryDataDO> {

    default PageResult<FactoryDataDO> selectPage(FactoryDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FactoryDataDO>()
                .eqIfPresent(FactoryDataDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(FactoryDataDO::getDataType, reqVO.getDataType())
                .betweenIfPresent(FactoryDataDO::getDate, reqVO.getDate())
                .likeIfPresent(FactoryDataDO::getPorterName, reqVO.getPorterName())
                .likeIfPresent(FactoryDataDO::getDirverName, reqVO.getDirverName())
                .likeIfPresent(FactoryDataDO::getKeeperName, reqVO.getKeeperName())
                .eqIfPresent(FactoryDataDO::getTotalNum, reqVO.getTotalNum())
                .eqIfPresent(FactoryDataDO::getTotalAmount, reqVO.getTotalAmount())
                .eqIfPresent(FactoryDataDO::getTotalTruck, reqVO.getTotalTruck())
                .eqIfPresent(FactoryDataDO::getMoveNum, reqVO.getMoveNum())
                .betweenIfPresent(FactoryDataDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FactoryDataDO::getId));
    }

}