📄 classmeetservice.java
字号:
package edu.yinhe.mis.services;
import java.sql.SQLException;
import javax.sql.DataSource;
import edu.yinhe.mis.dto.ClassmeetDTO;
import edu.yinhe.mis.model.ClassmeetDAO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.mis.vo.ClassmeetVO;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.model.IBaseDAO;
import edu.yinhe.system.services.Service;
public class ClassmeetService extends Service{
IBaseDAO classmeetDAO=null;
public Object alllist(Object arg0) throws AppException {
classmeetDAO=DAOFactory.getClassmeetDAO(conn);
Object obj=null;
try {
obj= classmeetDAO.findAll(arg0);
} catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
this.closeConnection();
classmeetDAO=null;
}
return obj;
}
public Object create(Object arg0) throws AppException {
classmeetDAO=DAOFactory.getClassmeetDAO(conn);
Object flag=false;
try {
flag =classmeetDAO.insert(arg0);
} catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e1.getMessage());
}
}finally{
closeConnection();
arg0=null;
}
return flag;
}
public Object findAll() throws AppException {
classmeetDAO = DAOFactory.getClassmeetDAO(conn);
int count=0;
try {
count=classmeetDAO.getCount(null);
}catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// TODO Auto-generated catch block
e.printStackTrace();
}
finally
{
this.closeConnection();
classmeetDAO=null;
}
return count;
}
public Object list(Object arg0) throws AppException {
return null;
}
public Object load(Object arg0) throws AppException {
classmeetDAO=DAOFactory.getClassmeetDAO(conn);
Object obj=null;
ClassmeetVO vo = null;
boolean flag=false;
try {
vo=(ClassmeetVO)classmeetDAO.findById(arg0);
} catch (SQLException e) {
e.printStackTrace();
}finally
{
this.closeConnection();
classmeetDAO=null;
}
return vo;
}
public Object modify(Object arg0) throws AppException {
return false;
}
public Object remove(Object obj) throws AppException {
classmeetDAO=DAOFactory.getClassmeetDAO(conn);
Object flag=false;
ClassmeetDTO dto=null;
String[] ids=null;
try {
dto=(ClassmeetDTO)obj;
ids=dto.getCheck();
for(int i=0;i<ids.length;i++){
dto.setId(Integer.parseInt(ids[i]));
flag = classmeetDAO.delete(dto);
}
} catch (SQLException e) {
try {
conn.rollback();
} catch (SQLException e1) {
flag=false;
}
flag=false;
}
finally
{
this.closeConnection();
classmeetDAO=null;
conn = null;
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -