📄 checkinfoservice.java
字号:
/**
*
*/
package edu.yinhe.mis.services;
import java.sql.SQLException;
import java.util.ArrayList;
import edu.yinhe.mis.dto.CheckInfoDTO;
import edu.yinhe.mis.model.CheckInfoDAO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.services.Service;
/**
* @author 孙文
*
*/
public class CheckInfoService extends Service{
private CheckInfoDAO checkInfoDAO = null;//定义全局的checkInfoDAO
/**
* 得到object_name
*/
public Object alllist() throws AppException {
// TODO Auto-generated method stub
ArrayList alist = new ArrayList();
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
alist = (ArrayList) checkInfoDAO.findAll();
} catch (SQLException e) {
throw new AppException(e.getMessage());
}finally{
this.closeConnection();
checkInfoDAO = null;
}
return alist;
}
public Object alllist(Object arg0) throws AppException {
// TODO Auto-generated method stub
return arg0;
}
/**
* 添加一条信息
*/
public Object create(Object arg0) throws AppException {
// TODO Auto-generated method stub
Integer flag =0;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
flag= (Integer)checkInfoDAO.insert(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return flag;
}
/**
* 查看所有记录
*/
public Object findAll() throws AppException {
// TODO Auto-generated method stub
ArrayList alist=null;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
alist=(ArrayList) checkInfoDAO.find();
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return alist;
}
/**
* 得到搜索结束
*/
public Object findAll(Object arg0) throws AppException {
// TODO Auto-generated method stub
Object[] obj=null;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
obj = (Object[]) checkInfoDAO.findAll(arg0);
} catch (SQLException e) {
throw new AppException(e.getMessage());
}finally{
this.closeConnection();
checkInfoDAO = null;
}
return obj;
}
public Object findById(Object arg0) throws AppException {
// TODO Auto-generated method stub
return null;
}
/**
* 删除一条信息
*/
public Object findByObject(Object arg0) throws AppException {
// TODO Auto-generated method stub
Integer flag =0;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
flag= (Integer)checkInfoDAO.findByObject(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return flag;
}
public int getcount() throws AppException {
// TODO Auto-generated method stub
return 0;
}
/**
* 得到数据库总条数
*/
public int getcount(Object arg0) throws AppException {
// TODO Auto-generated method stub
int count=0;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
count = (Integer) checkInfoDAO.getCount(arg0);
} catch (SQLException e) {
throw new AppException(e.getMessage());
}finally{
this.closeConnection();
checkInfoDAO = null;
}
return count;
}
public Object list() throws AppException {
// TODO Auto-generated method stub
return null;
}
/**
* 得到试卷testpaper_no
*/
public Object list(Object arg0) throws AppException {
ArrayList alist=null;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
alist=(ArrayList) checkInfoDAO.find(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return alist;
}
/**
* 显示数据库记录
*/
public Object load(Object arg0) throws AppException {
// TODO Auto-generated method stub
ArrayList alist=new ArrayList();
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
alist=(ArrayList) checkInfoDAO.findById(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return alist;
}
/**
* 修改一条信息
*/
public Object modify(Object arg0) throws AppException {
// TODO Auto-generated method stub
Integer flag =0;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
flag=(Integer) checkInfoDAO.update(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return flag;
}
/**
* 删除一条信息
*/
public Object remove(Object arg0) throws AppException {
// TODO Auto-generated method stub
Integer flag =0;
checkInfoDAO=(CheckInfoDAO) DAOFactory.getCheckInfoDAO(conn);
try {
flag=(Integer) checkInfoDAO.delete(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
try {
conn.rollback();
} catch (SQLException e1) {
throw new AppException(e.getMessage()+"危险!");
}
}finally{
closeConnection();
checkInfoDAO=null;
}
return flag;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -