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

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.pms.controller.admin.iotmodeltemplateattrs.vo.IotModelTemplateAttrsRespVO;
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillSaveReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdevicerunlog.IotDeviceRunLogDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmodeltemplateattrs.IotModelTemplateAttrsDO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotopeationfill.IotOpeationFillOrderDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collection;
import java.util.List;

/**
 * 运行记录填报 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface IotOpeationFillOrderMapper extends BaseMapperX<IotOpeationFillOrderDO> {

    @TenantIgnore
    default PageResult<IotOpeationFillOrderDO> selectPage(IotOpeationFillPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotOpeationFillOrderDO>()
                .eqIfPresent(IotOpeationFillOrderDO::getDeptId, reqVO.getDeptId())
                .likeIfPresent(IotOpeationFillOrderDO::getOrderName, reqVO.getOrderName())
                .eqIfPresent(IotOpeationFillOrderDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(IotOpeationFillOrderDO::getOrderStatus, reqVO.getOrderStatus())
                .likeIfPresent(IotOpeationFillOrderDO::getUserName, reqVO.getUserName())
                .eqIfPresent(IotOpeationFillOrderDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(IotOpeationFillOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotOpeationFillOrderDO::getId));
    }
    @TenantIgnore
    default PageResult<IotOpeationFillOrderDO>  selectPage1(IotOpeationFillPageReqVO reqVO,
                                                           Collection<Long> deptIds,
                                                           Collection<Long> orderIds
                                                           ) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotOpeationFillOrderDO>()
                .inIfPresent(IotOpeationFillOrderDO::getDeptId, deptIds)
                .inIfPresent(IotOpeationFillOrderDO::getId, orderIds)
                .eqIfPresent(IotOpeationFillOrderDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(IotOpeationFillOrderDO::getOrderStatus, reqVO.getOrderStatus())
                .eqIfPresent(IotOpeationFillOrderDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(IotOpeationFillOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotOpeationFillOrderDO::getCreateTime)
                .orderByAsc(IotOpeationFillOrderDO::getOrderStatus)
                .orderByAsc(IotOpeationFillOrderDO::getDeptId));

    }
}