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

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.factorypackingline.vo.FactoryPackingLinePageReqVO;
import cn.iocoder.yudao.module.smartfactory.controller.admin.factorypackingline.vo.FactoryPackingLineRespVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.factorypackingline.FactoryPackingLineDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 打包线配置 Mapper
 *
 * @author 姚君
 */
@Mapper
public interface FactoryPackingLineMapper extends BaseMapperX<FactoryPackingLineDO> {

    default PageResult<FactoryPackingLineDO> selectPage(FactoryPackingLinePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FactoryPackingLineDO>()
                .eqIfPresent(FactoryPackingLineDO::getFactoryId, reqVO.getFactoryId())
                .likeIfPresent(FactoryPackingLineDO::getName, reqVO.getName())
                .eqIfPresent(FactoryPackingLineDO::getType, reqVO.getType())
                .eqIfPresent(FactoryPackingLineDO::getKilnId, reqVO.getKilnId())
                .betweenIfPresent(FactoryPackingLineDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FactoryPackingLineDO::getId));
    }

    /**
     * 分页列表
     *
     * @param vo
     * @param page
     * @return
     */
    IPage<FactoryPackingLineRespVO> getFactoryPackingLinePage(@Param("vo") FactoryPackingLinePageReqVO vo, @Param("page") Page<Object> page);
}
