package cn.iocoder.yudao.module.system.dal.mysql.positionmap;

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.system.controller.admin.positionmap.vo.PositionMapPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotPositionMapVO;
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Set;

/**
 * 仓库点位地图 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PositionMapMapper extends BaseMapperX<PositionMapDO> {

    default PageResult<PositionMapDO> selectPage(PositionMapPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PositionMapDO>()
                .eqIfPresent(PositionMapDO::getFloor, reqVO.getFloor())
                .eqIfPresent(PositionMapDO::getArea, reqVO.getArea())
                .eqIfPresent(PositionMapDO::getYamlJson, reqVO.getYamlJson())
                .eqIfPresent(PositionMapDO::getYamlUrl, reqVO.getYamlUrl())
                .eqIfPresent(PositionMapDO::getPngUrl, reqVO.getPngUrl())
                .betweenIfPresent(PositionMapDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PositionMapDO::getId));
    }

    /**
     * 根据id查询
     * @param ids
     * @return
     */
    List<PositionMapDO> selectByIds(@Param("ids") Set<Long> ids);
}
