forked from pyia8e6p9/student_system
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
996 B
37 lines
996 B
package com.example.service;
|
|
|
|
import com.example.entity.Course;
|
|
import com.example.mapper.CourseMapper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
@Service
|
|
public class CourseService {
|
|
@Resource
|
|
private CourseMapper courseMapper;
|
|
|
|
|
|
//total是查询总数 list是数据列表
|
|
public PageInfo<Course> selectPage(Integer pageNum, Integer pageSize,Course course){
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
List<Course> coursesList = courseMapper.selectAll(course);
|
|
return PageInfo.of(coursesList);
|
|
}
|
|
//新增数据
|
|
public void add(Course course) {
|
|
courseMapper.insert(course);
|
|
}
|
|
|
|
public void updateById(Course course) {
|
|
courseMapper.updateById(course);
|
|
}
|
|
|
|
public void deleteById(Integer id) {
|
|
courseMapper.deleteById(id);
|
|
}
|
|
}
|