package com.xhkjedu.slive.controller.liveplay;

import com.xhkjedu.slive.model.liveplay.LCourseSectionHistory;
import com.xhkjedu.slive.service.liveplay.CourseSectionHistoryService;
import com.xhkjedu.utils.N_Utils;
import com.xhkjedu.vo.ResultVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* @author ywx
* @classname CourseSectionHistoryController
* @description
* @date 2021/08/31 17:05
**/
@RestController
@RequestMapping("/shistory")
public class CourseSectionHistoryController {
    @Resource
    private CourseSectionHistoryService courseSectionHistoryService;

    @PostMapping("/add")
    public ResultVo add(@RequestBody LCourseSectionHistory history) {
        N_Utils.validation(new Object[]{history.getSectionid(),"课节id",1,history.getCstype(),"直播类型",1});
        courseSectionHistoryService.save(history);
        return new ResultVo(0,"保存成功");
    }

    @PostMapping("/list")
    public ResultVo list(@RequestBody LCourseSectionHistory history) {
        N_Utils.validation(new Object[]{history.getSectionid(),"课节id",1});
        List<Map> list = courseSectionHistoryService.listBySectionId(history.getSectionid());
        return new ResultVo(0,"获取列表成功",list);
    }
}
