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

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.robot.chargelog.RobotChargeLogPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotChargeLogDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 车辆充电记录 Mapper
 *
 * @author 陈宾顺
 */
@Mapper
public interface RobotChargeLogMapper extends BaseMapperX<RobotChargeLogDO> {

    default PageResult<RobotChargeLogDO> selectPage(RobotChargeLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RobotChargeLogDO>()
                .eqIfPresent(RobotChargeLogDO::getRobotNo, reqVO.getRobotNo())
                .eqIfPresent(RobotChargeLogDO::getStartElectricity, reqVO.getStartElectricity())
                .eqIfPresent(RobotChargeLogDO::getEndElectricity, reqVO.getEndElectricity())
                .betweenIfPresent(RobotChargeLogDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(RobotChargeLogDO::getDeviceNo, reqVO.getDeviceNo())
                .betweenIfPresent(RobotChargeLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RobotChargeLogDO::getId));
    }

    /**
     *
     * @param chanceCycle
     * @return
     */
    List<String> getChargeFullRobotNos(@Param("chanceCycle") Integer chanceCycle,
                                       @Param("robotNos") List<String> robotNos);

    /**
     *
     * @param taskDetailId
     * @param taskStatus
     */
    void updateChargStatusByTaskId(@Param("taskDetailId") Long taskDetailId, @Param("taskStatus")  Integer taskStatus);
}