package cn.iocoder.yudao.module.iot.dal.mysql.formula;

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.iot.controller.admin.formula.vo.FormulaRecordPageReqVO;
import cn.iocoder.yudao.module.iot.dal.dataobject.formula.FormulaRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 变量记录 Mapper
 *
 * @author 内蒙必硕
 */
@Mapper
public interface FormulaRecordMapper extends BaseMapperX<FormulaRecordDO> {

    default PageResult<FormulaRecordDO> selectPage(FormulaRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FormulaRecordDO>()
                .likeIfPresent(FormulaRecordDO::getMachineName, reqVO.getMachineName())
                .likeIfPresent(FormulaRecordDO::getWorkerName, reqVO.getWorkerName())
                .eqIfPresent(FormulaRecordDO::getResultType, reqVO.getResultType())
                .eqIfPresent(FormulaRecordDO::getFormulaCode, reqVO.getFormulaCode())
                .betweenIfPresent(FormulaRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FormulaRecordDO::getId));
    }

}