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

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.cycle.vo.TaskCyclePageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.cycle.TaskCycleDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 循环任务点位 Mapper
 *
 * @author 陈宾顺
 */
@Mapper
public interface TaskCycleMapper extends BaseMapperX<TaskCycleDO> {

    default PageResult<TaskCycleDO> selectPage(TaskCyclePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TaskCycleDO>()
                .eqIfPresent(TaskCycleDO::getRobotTaskId, reqVO.getRobotTaskId())
                .eqIfPresent(TaskCycleDO::getMapItemId, reqVO.getMapItemId())
                .betweenIfPresent(TaskCycleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TaskCycleDO::getId));
    }

    void deletByRobotTaskId(@Param("robotTaskId") Long robotTaskId);

    /**
     * 批量删除
     * @param taskIds
     */
    void deletByRobotTaskIds(@Param("taskIds")  Set<Long> taskIds);
}