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

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.system.controller.admin.robot.mapstop.RobotMapStopPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotMapStopDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 车辆(地图)急停记录 Mapper
 *
 * @author 陈宾顺
 */
@Mapper
public interface RobotMapStopMapper extends BaseMapperX<RobotMapStopDO> {

    default PageResult<RobotMapStopDO> selectPage(RobotMapStopPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RobotMapStopDO>()
                .eqIfPresent(RobotMapStopDO::getPositionMapId, reqVO.getPositionMapId())
                .eqIfPresent(RobotMapStopDO::getRobotNo, reqVO.getRobotNo())
                .eqIfPresent(RobotMapStopDO::getStopType, reqVO.getStopType())
                .betweenIfPresent(RobotMapStopDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RobotMapStopDO::getId));
    }

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

    /**
     * 根据车辆编号删除
     * @param robotNos
     */
    void deleteRobotMapStopByRobotNos(@Param("robotNos") List<String> robotNos);

    /**
     * 更新车辆编号
     * @param oldRobotNo
     * @param newRobotNo
     */
    void updateRobotNo(@Param("oldRobotNo") String oldRobotNo, @Param("newRobotNo") String newRobotNo);
}