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

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

/**
 * 运行记录计划设备 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotOperationPlanDevMapper extends BaseMapperX<IotOperationPlanDevDO> {

    default PageResult<IotOperationPlanDevDO> selectPage(IotOperationPlanDevPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotOperationPlanDevDO>()
                .eqIfPresent(IotOperationPlanDevDO::getDeviceCode, reqVO.getDeviceCode())
                .likeIfPresent(IotOperationPlanDevDO::getDeviceName, reqVO.getDeviceName())
                .eqIfPresent(IotOperationPlanDevDO::getDeptId, reqVO.getDeptId())
                .eqIfPresent(IotOperationPlanDevDO::getPlanId, reqVO.getPlanId())
                .betweenIfPresent(IotOperationPlanDevDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(IotOperationPlanDevDO::getStatus, reqVO.getStatus())
                .orderByDesc(IotOperationPlanDevDO::getId));
    }

    int delByPlanId(Long planId);


    List<IotOperationPlanDevDO> devIdList(@Param("planIds")List<Long> planIds);

}