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.mqtt.api.path.dto.PositionMapLineDTO;
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapLinePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapLineDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 仓库点位地图连线 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PositionMapLineMapper extends BaseMapperX<PositionMapLineDO> {

    default PageResult<PositionMapLineDO> selectPage(PositionMapLinePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PositionMapLineDO>()
                .eqIfPresent(PositionMapLineDO::getStartingPointId, reqVO.getStartingPointId())
                .eqIfPresent(PositionMapLineDO::getEndPointId, reqVO.getEndPointId())
                .eqIfPresent(PositionMapLineDO::getMethod, reqVO.getMethod())
                .betweenIfPresent(PositionMapLineDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PositionMapLineDO::getId));
    }

    /**
     * 查看所有的点位地图连线
     * @return
     */
    List<PositionMapLineDTO> getAllPositionMapLine(PositionMapLineDO positionMapLineDO);

    /**
     * 根据地图id删除
     * @param mapId
     */
    void deleteByMapId(@Param("mapId") Long mapId);
}
