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

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

/**
 * 打包线数据 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface PackageDataMapper extends BaseMapperX<PackageDataDO> {

    default PageResult<PackageDataDO> selectPage(PackageDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PackageDataDO>()
                .eqIfPresent(PackageDataDO::getFactoryId, reqVO.getFactoryId())
                .eqIfPresent(PackageDataDO::getSizeId, reqVO.getSizeId())
                .likeIfPresent(PackageDataDO::getSizeName, reqVO.getSizeName())
                .eqIfPresent(PackageDataDO::getPackageId, reqVO.getPackageId())
                .likeIfPresent(PackageDataDO::getPackageName, reqVO.getPackageName())
                .eqIfPresent(PackageDataDO::getNum, reqVO.getNum())
                .betweenIfPresent(PackageDataDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PackageDataDO::getId));
    }

}