📄 courseserviceimpl.java
字号:
/* * CourseServiceImpl.java * * Created on 2006年5月20日, 下午5:13 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package enova.service.impl;import java.util.List;import enova.service.*;import enova.pojo.*;import enova.dao.*;/** * * @author vlinux */public class CourseServiceImpl implements CourseService { private CourseDao courseDao; /** Creates a new instance of CourseServiceImpl */ public CourseServiceImpl(CourseDao courseDao) { this.courseDao = courseDao; } /*通过课程ID获取课程*/ public Course get(Integer id) throws StoreException{ try{ return courseDao.get(id); }catch(DataAccessException dae){ throw new StoreException(); } } /*更新或者创建一个课程,如果课程名称、年份、学期、教师组合存在的话则抛出重复异常*/ public void updateOrCreate(Course course) throws UniqueException, StoreException{ try{ courseDao.updateOrInsert(course); }catch(DataAccessException dae){ throw new StoreException(); }catch(RecordExistException dee){ throw new UniqueException(); } } /*通过课程ID删除课程*/ public void delete(Integer id) throws NotExistException, StoreException{ try{ if( get(id)==null ) throw new NotExistException(); courseDao.delete(id); }catch(DataAccessException dae){ throw new StoreException(); } } /*通过课程开设年份、学期获取课程*/ public List getByYearAndTerm(Integer year,String term) throws StoreException{ try{ return courseDao.getByYearAndTerm(year,term); }catch(DataAccessException dae){ throw new StoreException(); } } /*通过课程开设年份按照学期排序获取课程*/ public List getByYear(Integer year) throws StoreException{ try{ return courseDao.getByYearSortTerm(year); }catch(DataAccessException dae){ throw new StoreException(); } } /*通过课程开设年份、学期、教师ID获取课程*/ public List getByYearAndTermAndTeacherId(Integer year,String term,Integer teacherId) throws StoreException{ try{ return courseDao.getByYearAndTermAndTeacherId(year,term,teacherId); }catch(DataAccessException dae){ throw new StoreException(); } } public List getByClassIdAndYearAndTerm(Integer classId,Integer year,String term)throws StoreException{ try{ return courseDao.getByClassIdAndYearAndTerm(classId,year,term); }catch(DataAccessException dae){ throw new StoreException(); } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -