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

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.log.vo.RobotOperationLogPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.log.RobotOperationLogDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 机器人动作记录 Mapper
 *
 * @author 陈宾顺
 */
@Mapper
public interface RobotOperationLogMapper extends BaseMapperX<RobotOperationLogDO> {

    default PageResult<RobotOperationLogDO> selectPage(RobotOperationLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RobotOperationLogDO>()
                .eqIfPresent(RobotOperationLogDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(RobotOperationLogDO::getRobotNo, reqVO.getRobotNo())
                .eqIfPresent(RobotOperationLogDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(RobotOperationLogDO::getCommandType, reqVO.getCommandType())
                .eqIfPresent(RobotOperationLogDO::getWorkProgress, reqVO.getWorkProgress())
                .eqIfPresent(RobotOperationLogDO::getExecutionState, reqVO.getExecutionState())
                .betweenIfPresent(RobotOperationLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RobotOperationLogDO::getId));
    }

}