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

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.module.pms.controller.admin.iotprojecttaskschedule.vo.IotProjectTaskSchedulePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskschedule.IotProjectTaskScheduleDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 项目任务时间表/施工进度 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotProjectTaskScheduleMapper extends BaseMapperX<IotProjectTaskScheduleDO> {

    default PageResult<IotProjectTaskScheduleDO> selectPage(IotProjectTaskSchedulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotProjectTaskScheduleDO>()
                .eqIfPresent(IotProjectTaskScheduleDO::getProjectId, reqVO.getProjectId())
                .eqIfPresent(IotProjectTaskScheduleDO::getTaskId, reqVO.getTaskId())
                .eqIfPresent(IotProjectTaskScheduleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotProjectTaskScheduleDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(IotProjectTaskScheduleDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(IotProjectTaskScheduleDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(IotProjectTaskScheduleDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotProjectTaskScheduleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(IotProjectTaskScheduleDO::getId));
    }

    default List<IotProjectTaskScheduleDO> selectList(IotProjectTaskSchedulePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<IotProjectTaskScheduleDO>()
                .eqIfPresent(IotProjectTaskScheduleDO::getProjectId, reqVO.getProjectId())
                .eqIfPresent(IotProjectTaskScheduleDO::getTaskId, reqVO.getTaskId())
                .eqIfPresent(IotProjectTaskScheduleDO::getStatus, reqVO.getStatus())
                .eqIfPresent(IotProjectTaskScheduleDO::getDescription, reqVO.getDescription())
                .betweenIfPresent(IotProjectTaskScheduleDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(IotProjectTaskScheduleDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(IotProjectTaskScheduleDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(IotProjectTaskScheduleDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(IotProjectTaskScheduleDO::getStartTime, IotProjectTaskScheduleDO::getStatus));
    }

}