📄 departmentserviceimpl.java
字号:
/* * DepartmentServiceImpl.java * * Created on 2006年5月20日, 下午4:14 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */package enova.service.impl;import java.util.*;import enova.dao.*;import enova.pojo.*;import enova.service.*;/** * * @author vlinux */public class DepartmentServiceImpl implements DepartmentService { private DepartmentDao departmentDao; /** Creates a new instance of DepartmentServiceImpl */ public DepartmentServiceImpl(DepartmentDao departmentDao) { this.departmentDao = departmentDao; } /*通过Id获取学院*/ public Department get(Integer departmentId) throws StoreException{ try{ return departmentDao.get(departmentId); }catch(DataAccessException dae){ throw new StoreException(); } } /*获取全部学院*/ public List getAll() throws StoreException{ try{ return departmentDao.getAll(); }catch(DataAccessException dae){ throw new StoreException(); } } /*更新或者创建一个学院,如果学院名称出现重复则抛出重复异常*/ public void updateOrCreate(Department department) throws UniqueException, StoreException{ try{ departmentDao.updateOrInsert(department); }catch(DataAccessException dae){ throw new StoreException(); }catch(RecordExistException ree){ throw new UniqueException(); } } /*通过Id删除学院*/ public void delete(Integer departmentId) throws NotExistException, StoreException{ try{ if( departmentDao.get(departmentId)==null ) throw new NotExistException(); departmentDao.delete(departmentId); }catch(DataAccessException dae){ throw new StoreException(); } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -