📄 studentcourseserviceimp.java
字号:
package com.tech.service.imp;
import java.util.List;
import com.common.dao.DaoSupport;
import com.common.exception.BusinessException;
import com.common.util.BeanUtils;
import com.tech.model.Studentcourse;
import com.tech.service.StudentCourseService;
public class StudentCourseServiceImp implements StudentCourseService {
private DaoSupport<Studentcourse,Long> studentCourseDao;
public void setStudentCourseDao(DaoSupport<Studentcourse, Long> studentCourseDao) {
this.studentCourseDao = studentCourseDao;
}
@Override
public Studentcourse getEntity(Long id) throws BusinessException {
try{
return studentCourseDao.getEntity(id);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("StudentCourseServiceImp 不能获取主键为:" + id
+ "的数据" + e.toString());
}
}
@Override
public boolean isExists(Studentcourse t, List<String> names)
throws BusinessException {
try{
return studentCourseDao.isExists(t,names);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("查找异常:" + e.getMessage());
}
}
@Override
public Studentcourse loadEntity(Long id) throws BusinessException {
try{
return studentCourseDao.loadEntity(id);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("StudentCourseServiceImp 不能获取主键为:" + id
+ "的数据" + e.toString());
}
}
@Override
public void removeEntity(Studentcourse entity) throws BusinessException {
try{
studentCourseDao.removeEntity(entity);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("删除异常:"
+ e.getMessage());
}
}
@Override
public void removeEntity(Studentcourse[] array) throws BusinessException {
try{
studentCourseDao.removeEntity(array);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("删除异常:"
+ e.getMessage());
}
}
@Override
public void saveEntity(Studentcourse entity) throws BusinessException {
try{
studentCourseDao.saveEntity(entity);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("添加异常:"
+ e.getMessage());
}
}
@Override
public void saveEntity(Studentcourse[] array) throws BusinessException {
try{
studentCourseDao.saveEntity(array);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("添加异常:"
+ e.getMessage());
}
}
@Override
public void updateEntity(Studentcourse entity) throws BusinessException {
try{
Studentcourse entityLoad = studentCourseDao.getEntity(entity.getId());
// 拷贝不需要更新的字段内容
BeanUtils.copyProperties(entityLoad,entity);
studentCourseDao.updateEntity(entityLoad);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("更新异常:"
+ e.getMessage());
}
}
@Override
public void updateEntity(Studentcourse[] array) throws BusinessException {
try{
studentCourseDao.updateEntity(array);
} catch (Exception e){
e.printStackTrace();
throw new BusinessException("更新异常:"
+ e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -