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

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.handlingspecifications.vo.HandlingSpecificationsPageReqVO;
import cn.iocoder.yudao.module.smartfactory.dal.dataobject.handlingspecifications.HandlingSpecificationsDO;
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;

import java.util.List;

/**
 * 工厂搬运规格 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface HandlingSpecificationsMapper extends BaseMapperX<HandlingSpecificationsDO> {

    default PageResult<HandlingSpecificationsDO> selectPage(HandlingSpecificationsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HandlingSpecificationsDO>()
                .eqIfPresent(HandlingSpecificationsDO::getFactoryId, reqVO.getFactoryId())
                .likeIfPresent(HandlingSpecificationsDO::getSpecificationsName, reqVO.getSpecificationsName())
                .eqIfPresent(HandlingSpecificationsDO::getType, reqVO.getType())
                .orderByDesc(HandlingSpecificationsDO::getId));
    }

    /**
     * 分页列表
     *
     * @param page
     * @param vo
     * @return
     */
    IPage<HandlingSpecificationsDO> getHandlingSpecificationsPage(@Param("page") Page page, @Param("vo") HandlingSpecificationsPageReqVO vo);

    /**
     * 获取列表
     *
     * @param vo
     * @return
     */
    List<HandlingSpecificationsDO> getHandlingSpecificationsList(@Param("vo") HandlingSpecificationsPageReqVO vo);

    /**
     *
     * @param id
     * @return
     */
    HandlingSpecificationsDO getHandlingSpecifications(@Param("id") Long id);
}
