package com.ly.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ly.dao.CourseDao;

import com.ly.domain.Course;

import com.ly.service.CourseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements CourseService {
    @Resource
    private CourseDao courseDao;
    @Override
    public Page<Course> findPage(Page<Course> page, String name) {
        return courseDao.findPage(page, name);
    }

    @Transactional
    @Override
    public void setStudentCourse(Integer courseId, Integer studentId) {
        courseDao.deleteStudentCourse(courseId, studentId);
        courseDao.setStudentCourse(courseId, studentId);
    }
}
