package cn.iocoder.yudao.module.pms.dal.mysql.iotoperationplan;

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.pms.dal.dataobject.iotoperationplan.IotOperationPlanDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pms.controller.admin.iotoperationplan.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 运行记录计划 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotOperationPlanMapper extends BaseMapperX<IotOperationPlanDO> {

    default PageResult<IotOperationPlanDO> selectPage(IotOperationPlanPageReqVO reqVO,Collection<Long> deptIds) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotOperationPlanDO>()
                .eqIfPresent(IotOperationPlanDO::getPlanTitle, reqVO.getPlanTitle())
                .eqIfPresent(IotOperationPlanDO::getPlanCode, reqVO.getPlanCode())
                .eqIfPresent(IotOperationPlanDO::getPlanCycle, reqVO.getPlanCycle())
                .eqIfPresent(IotOperationPlanDO::getPlanUnit, reqVO.getPlanUnit())
                .eqIfPresent(IotOperationPlanDO::getCharge, reqVO.getCharge())
                .eqIfPresent(IotOperationPlanDO::getDeviceIds, reqVO.getDeviceIds())
                .eqIfPresent(IotOperationPlanDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotOperationPlanDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(IotOperationPlanDO::getDeptId, deptIds)
                .eqIfPresent(IotOperationPlanDO::getStatus, reqVO.getStatus())
                .likeIfPresent(IotOperationPlanDO::getChargeName, reqVO.getChargeName())
                .betweenIfPresent(IotOperationPlanDO::getLastCreateTime, reqVO.getLastCreateTime())
                .betweenIfPresent(IotOperationPlanDO::getBeginCreateTime, reqVO.getBeginCreateTime())
                .orderByDesc(IotOperationPlanDO::getId));
    }

    List<IotOperationPlanDO> getPlanList();

    List<IotOperationPlanDO> getReportPlan(@Param("deviceIds")Collection<Long> deviceIds);

}