package com.xhkjedu.slive.service.liveplay;

import com.xhkjedu.slive.mapper.liveplay.CourseTypeMapper;
import com.xhkjedu.slive.model.liveplay.LCourseType;
import com.xhkjedu.utils.N_Utils;
import org.springframework.stereotype.Service;

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

/**
 * @author ywx
 * @classname CourseTypeService
 * @description 
 * @date 2021/1/23 11:48
 **/
@Service
public class CourseTypeService {
    @Resource
    private CourseTypeMapper courseTypeMapper;

    //添加
    public void save(LCourseType model) {
        model.setCreatetime(N_Utils.getSecondTimestamp());
        courseTypeMapper.insertSelective(model);
    }

    //删除
    public Integer deleteById(Integer id) {
        LCourseType type = new LCourseType();
        type.setCtypeid(id);
        type.setCtstate(10);
        return courseTypeMapper.updateByPrimaryKeySelective(type);
    }

    //修改
    public Integer update(LCourseType model) {
        model.setCreatetime(N_Utils.getSecondTimestamp());
        return courseTypeMapper.updateByPrimaryKeySelective(model);
    }

    //获取列表
    public List <LCourseType> listAll(Integer schoolid, Integer ctstate) {
        return courseTypeMapper.listAll(schoolid, ctstate);
    }
}
