📄 checkservice.java
字号:
package edu.yinhe.mis.services;
/**
*
* @author 谢攀
*
*/
import java.sql.SQLException;
import java.util.ArrayList;
import javax.sql.DataSource;
import edu.yinhe.mis.dto.CheckDTO;
import edu.yinhe.mis.model.CheckDAO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.model.IBaseDAO;
import edu.yinhe.system.services.IService;
import edu.yinhe.system.services.Service;
public class CheckService extends Service{
private IBaseDAO DemoDAO=null;
/**
* 调用CheckDAO里的findAll(Object arg0)和getCount(Object arg0)查询方法,
* 得到check表中所有的记录和记录数;
* @throws SQLException
* @return list,count 查询完成,返回Object数组。
*/
public Object alllist(Object arg0) throws AppException {
// TODO Auto-generated method stub
CheckDAO dao=null;
Object list=null;
Object[] obj=new Object[2];
try {
dao=(CheckDAO) DAOFactory.getCheckDAO(conn);
list=dao.findAll(arg0);
Integer count=dao.getCount(arg0);
obj[0]=list;
obj[1]=count;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
closeConnection();
dao=null;
}
return obj;
}
public Object create(Object arg0) throws AppException {
// TODO Auto-generated method stub
return false;
}
/**
* 根据学生姓名查询check表后student表中中相对应的记录,
* @throws SQLException
* @return boolean 查询完成,返回boolean;
*/
public Object list(Object arg0) throws AppException {
CheckDAO dao=null;
ArrayList list=null;
try {
dao=(CheckDAO) DAOFactory.getCheckDAO(conn);
list=(ArrayList) dao.findById(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
this.closeConnection();
dao=null;
}
return list;
}
/**
* 根据班级编号查询该班级指定的信息;
* @throws SQLException
* @return boolean
*/
public Object load(Object arg0) throws AppException {
// TODO Auto-generated method stub
boolean flag=false;
CheckDAO dao=null;
try {
dao=(CheckDAO) DAOFactory.getCheckDAO(conn);
flag=(Boolean) dao.update(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
this.closeConnection();
dao=null;
}
return flag;
}
/**
* 增加check表和student表中指定的信息;
* @throws SQLException
* @return boolean
*/
public Object modify(Object arg0) throws AppException {
CheckDAO dao=null;
boolean flag1=false;
boolean flag=false;
try {
dao=(CheckDAO) DAOFactory.getCheckDAO(conn);
flag1=(Boolean) dao.insert(arg0);
if(flag1=true){
flag=(Boolean) dao.findByObject(arg0);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
this.closeConnection();
dao=null;
}
return flag;
}
/**
*根据学生姓名删除check表后student表中指定的信息;
* @throws SQLException
* @return boolean 查询完成,返回boolean。
*/
public Object remove(Object arg0) throws AppException {
// TODO Auto-generated method stub
CheckDAO dao=null;
Boolean flag=false;
try {
dao=(CheckDAO) DAOFactory.getCheckDAO(conn);
flag=(Boolean) dao.delete(arg0);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
this.closeConnection();
dao=null;
}
return flag;
}
/**
* 查询class表的所有班级
* @throws SQLException
* @return boolean
*/
public Object findAll() throws AppException {
// TODO Auto-generated method stub
ArrayList list=new ArrayList();
CheckDAO dao=null;
dao=(CheckDAO) DAOFactory.getCheckDAO(conn);
try {
list=(ArrayList) dao.find();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
this.closeConnection();
dao=null;
}
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -