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.LiveCasterEntity;
import com.platform.modules.live.service.LiveCasterService;


/**
 * 导播台信息表
 * 
 * @author TROY
 * @email 
 * @date 2019-01-20 16:33:33
 */
@RestController
@RequestMapping("/live/livecaster")
public class LiveCasterController {
	@Autowired
	private LiveCasterService liveCasterService;
	
	/**
	 * 列表
	 */
	@RequestMapping("/list")
	@RequiresPermissions("live:livecaster:list")
	public R list(LiveCasterEntity liveCaster){
		List list =  liveCasterService.selectList(new EntityWrapper<>(liveCaster));
		return R.ok().put("list", list);
	}
	
	
	/**
	 * 信息
	 */
	@RequestMapping("/info")
	@RequiresPermissions("live:livecaster:info")
	public R info(Integer id){
		return R.ok().put("info", liveCasterService.selectById(id));
	}
	
	/**
	 * 保存
	 */
	@SysLog("新增导播台")
	@RequestMapping("/save")
	@RequiresPermissions("live:livecaster:save")
	public R save(LiveCasterEntity liveCaster,BindingResult bindingResult){
		liveCasterService.save(liveCaster);
		return R.ok();
	}
	
	/**
	 * 修改
	 */
	@SysLog("修改导播台")
	@RequestMapping("/update")
	@RequiresPermissions("live:livecaster:update")
	public R update(LiveCasterEntity liveCaster,BindingResult bindingResult){
		liveCasterService.update(liveCaster);
		return R.ok();
	}
	
	/**
	 * 删除
	 */
	@SysLog("删除导播台")
	@RequestMapping("/delete")
	@RequiresPermissions("live:livecaster:delete")
	public R delete(Integer[] ids){
		liveCasterService.deleteBatch(ids);
		return R.ok();
	}
	
}
