package com.platform.modules.live.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.platform.modules.live.dao.LiveSceneChannelDao;
import com.platform.modules.live.entity.LiveSceneChannelEntity;

import com.platform.modules.live.service.LiveSceneChannelService;

import java.util.Arrays;
import java.util.List;

@Service("liveSceneChannelService")
public class LiveSceneChannelServiceImpl extends ServiceImpl<LiveSceneChannelDao, LiveSceneChannelEntity> implements LiveSceneChannelService {

	@Override
	public void save(LiveSceneChannelEntity liveSceneChannel){
		this.baseMapper.insert(liveSceneChannel);
	}
	
	@Override
	public void update(LiveSceneChannelEntity liveSceneChannel){
		this.baseMapper.update(liveSceneChannel, null);
	}
	
	@Override
	public void delete(Long id){
		this.baseMapper.deleteById(id);
	}
	
	@Override
	public void deleteBatch(Long[] ids){
		this.baseMapper.deleteBatchIds(Arrays.asList(ids));
	}

	@Override
	public List<LiveSceneChannelEntity> getBySceneId(Integer sceneId) {

		EntityWrapper<LiveSceneChannelEntity> wrapper = new EntityWrapper<>();

		wrapper.eq("scene_id", sceneId);
		return this.selectList(wrapper);
	}
}
