package org.jeecg.modules.opencv.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.opencv.entity.ModelVideoInfoConfig;
import org.jeecg.modules.opencv.mapper.ModelVideoInfoConfigMapper;
import org.jeecg.modules.opencv.service.IModelVideoInfoConfigService;
import org.springframework.stereotype.Service;

/**
 * 模板视频配置信息
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2020-04-17
 */
@Service
public class ModelVideoInfoConfigServiceImpl extends ServiceImpl<ModelVideoInfoConfigMapper, ModelVideoInfoConfig> implements IModelVideoInfoConfigService {

    @Override
    public ModelVideoInfoConfig getByModelId(Long modelId) {
        QueryWrapper<ModelVideoInfoConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("model_id", modelId);
        queryWrapper.orderByDesc("id").last("limit 1");
        return this.getOne(queryWrapper);
    }
}
