package com.platform.modules.live.controller;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.platform.common.annotation.SysLog;
import com.platform.common.utils.R;
import com.platform.modules.live.entity.LiveSceneCountEntity;
import com.platform.modules.live.service.LiveSceneCountService;


/**
 * 现场直播计数表
 * 
 * @author weiyan
 * @email 
 * @date 2019-02-20 10:29:20
 */
@RestController
@RequestMapping("/live/livescenecount")
public class LiveSceneCountController {
	@Autowired
	private LiveSceneCountService liveSceneCountService;
	
	/**
	 * 列表
	 */
	@RequestMapping("/list")
	@RequiresPermissions("live:livescenecount:list")
	public R list(LiveSceneCountEntity liveSceneCount){
		List list =  liveSceneCountService.selectList(new EntityWrapper<>(liveSceneCount));
		return R.ok().put("list", list);
	}
	
	
	/**
	 * 信息
	 */
	@RequestMapping("/info")
	@RequiresPermissions("live:livescenecount:info")
	public R info(Integer sceneId){
		return R.ok().put("info", liveSceneCountService.selectById(sceneId));
	}
	
	/**
	 * 保存
	 */
	@SysLog("保存现场计数信息")
	@RequestMapping("/save")
	@RequiresPermissions("live:livescenecount:save")
	public R save(LiveSceneCountEntity liveSceneCount,BindingResult bindingResult){
		liveSceneCountService.save(liveSceneCount);
		return R.ok();
	}
	
	/**
	 * 修改
	 */
	@SysLog("修改现场计数信息")
	@RequestMapping("/update")
	@RequiresPermissions("live:livescenecount:update")
	public R update(LiveSceneCountEntity liveSceneCount,BindingResult bindingResult){
		liveSceneCountService.update(liveSceneCount);
		return R.ok();
	}
	
	/**
	 * 删除
	 */
	@SysLog("删除现场计数信息")
	@RequestMapping("/delete")
	@RequiresPermissions("live:livescenecount:delete")
	public R delete(Integer[] sceneIds){
		liveSceneCountService.deleteBatch(sceneIds);
		return R.ok();
	}
	
}
