package com.fdkankan.ucenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fdkankan.ucenter.entity.SceneResource;
import com.fdkankan.ucenter.mapper.ISceneResourceMapper;
import com.fdkankan.ucenter.service.ISceneResourceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 场景资源表 服务实现类
 * </p>
 *
 * @author 
 * @since 2022-07-06
 */
@Service
public class SceneResourceServiceImpl extends ServiceImpl<ISceneResourceMapper, SceneResource> implements ISceneResourceService {

    @Override
    public List<SceneResource> sceneResourceByCameraId(Long cameraId) {
        return getBaseMapper().sceneResourceByCameraId(cameraId);
    }

    @Override
    public List<SceneResource> getByVersion(List<String> versionList) {
        if(versionList.size() >0){
            LambdaQueryWrapper<SceneResource> wrapper = new LambdaQueryWrapper<>();
            wrapper.in(SceneResource::getVersion,versionList);
            return this.list(wrapper);
        }
        return new ArrayList<>();
    }

    @Override
    public List<SceneResource> getByCooperationId(Long cooId) {
        return this.getBaseMapper().getByCooperationId(cooId);
    }
}
