📄 questionservice.java
字号:
package edu.yinhe.mis.services;
import java.sql.SQLException;
import java.util.ArrayList;
import javax.sql.DataSource;
import edu.yinhe.mis.dto.DictionaryDTO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.mis.vo.QuestionVO;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.model.IBaseDAO;
import edu.yinhe.system.services.IService;
import edu.yinhe.system.services.Service;
/**
*
* @author 石小军
* 试题服务
* @since 2008-04-30
*
*/
public class QuestionService extends Service {
private IBaseDAO questionDAO = null;
public Object alllist() throws AppException {
return null;
}
public Object alllist(Object obj) throws AppException {
return null;
}
/**
* @author 石小军
* 创建试题
* @since 2008-04-30
*
*/
public Object create(Object obj) throws AppException {
Integer m = 0;
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
m = (Integer) questionDAO.insert(obj);
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return m;
}
/**
* @author 石小军
* @param 查询所有科目
* @since 2008-05-04
*
*/
public Object findAll() throws AppException {
ArrayList list = new ArrayList();
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
list = (ArrayList)questionDAO.findAll();
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return list;
}
/**
* @author 石小军
* @param 查询所有试题
* @since 2008-05-04
*
*/
public Object findAll(Object obj) throws AppException {
Object[] objq = new Object[2];
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
objq = (Object[])questionDAO.findAll(obj);
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return objq;
}
/**
* @author 石小军
* 根据ID查询试题
* @since 2008-04-30
*
*/
public Object findById(Object obj) throws AppException {
QuestionVO questionVO = new QuestionVO();
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
questionVO = (QuestionVO) questionDAO.findById(obj);
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return questionVO;
}
public Object findByObject(Object obj) throws AppException {
return null;
}
public int getcount() throws AppException {
return 0;
}
public int getcount(Object obj) throws AppException {
return 0;
}
/**
* @author 石小军
* 查询难度等级表中所有的信息
* @return list(封装了所有的试题)
*
*/
public Object list() throws AppException {
ArrayList list = new ArrayList();
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
list = (ArrayList) questionDAO.find();
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return list;
}
public Object list(Object obj) throws AppException {
return null;
}
public Object load(Object obj) throws AppException {
return null;
}
/**
* @author 石小军
* 修改试题
* @since 2008-04-30
*
*/
public Object modify(Object obj) throws AppException {
Integer m = 0 ;
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
m = (Integer)questionDAO.update(obj);
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return m;
}
/**
* @author 石小军
* 删除试题
* @since 2008-04-30
*
*/
public Object remove(Object obj) throws AppException {
Integer m = 0;
try {
questionDAO = DAOFactory.getQuestionDAO(conn);
m = (Integer)questionDAO.delete(obj);
} catch (SQLException e) {
e.printStackTrace();
}finally{
closeConnection();
questionDAO = null;
}
return m;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -