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

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.api.path.dto.PositionAllChangePointBindingDTO;
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionChangePointBindingPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionChangePointBindingDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 区域变更点绑定 Mapper
 *
 * @author 陈宾顺
 */
@Mapper
public interface PositionChangePointBindingMapper extends BaseMapperX<PositionChangePointBindingDO> {

    default PageResult<PositionChangePointBindingDO> selectPage(PositionChangePointBindingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PositionChangePointBindingDO>()
                .eqIfPresent(PositionChangePointBindingDO::getStartingPointId, reqVO.getStartingPointId())
                .eqIfPresent(PositionChangePointBindingDO::getEndPointId, reqVO.getEndPointId())
                .eqIfPresent(PositionChangePointBindingDO::getStartingPointSortNum, reqVO.getStartingPointSortNum())
                .eqIfPresent(PositionChangePointBindingDO::getEndPointSortNum, reqVO.getEndPointSortNum())
                .betweenIfPresent(PositionChangePointBindingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PositionChangePointBindingDO::getId));
    }

    /**
     * 查询所有的区域绑定信息
     * @return
     */
    List<PositionAllChangePointBindingDTO> getAllPositionChangePointBinding();

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