⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardservice.java

📁 中应用程序的访问权限对Java Web Console 中应用程序的访问权限 成功登录 Web 控制台后,可能无法自动访问在该控制台中注册的所有应用程序。通常,必须安装应用程序,才能让所有的用户在控制
💻 JAVA
字号:
package edu.yinhe.mis.services;

import java.sql.SQLException;
import java.util.ArrayList;

import edu.yinhe.mis.dto.CardDTO;
import edu.yinhe.mis.dto.RevertDTO;
import edu.yinhe.mis.model.CardDAO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.mis.vo.CardVO;
import edu.yinhe.mis.vo.LeaveWordVO;
import edu.yinhe.system.common.AppException;
import edu.yinhe.system.model.IBaseDAO;
import edu.yinhe.system.services.Service;

public class CardService extends Service {
	private IBaseDAO cardDAO =null;
	private IBaseDAO revertDAO =null;
	public Object alllist() throws AppException {
		// TODO Auto-generated method stub
		return null;
	}

	public Object alllist(Object arg0) throws AppException {
		// TODO Auto-generated method stub
		return null;
	}
	/**
	 * @author 熊航航 <p>
	 * 根据条件查询card表中的相应信息
	 * @param obj 传入CardDTO对象
	 *@throws AppException
	 * @return 返回DTO类型;			
	 */
	public Object create(Object obj) throws AppException {
		CardDTO dto = (CardDTO) obj;
		boolean isOk = false;
		try {
			cardDAO =DAOFactory.getCardDAO(conn);
			isOk = (Boolean) cardDAO.insert(dto);
			
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			cardDAO = null;
			closeConnection();
		}
		
		return isOk;
	}

	public Object findAll() throws AppException {
		// TODO Auto-generated method stub
		return null;
	}
	/**
	 * @author 熊航航 <p>
	 *@throws AppException
	 * @return 返回list类型;			
	 */
	public Object findAll(Object obj) throws AppException {
		CardVO vo = null;
		CardDTO dto =null;
		//ArrayList list = null;
		Object[] objs=null;
		try {
			dto=(CardDTO)obj;
			cardDAO =DAOFactory.getCardDAO(conn);
			objs = (Object[]) cardDAO.findAll(dto);
/*			for(int i=0;i<list.size();i++){
				vo = (CardVO)list.get(i);
				System.out.println(vo.getID()+"GGGGGGGG");
			}*/
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			cardDAO=null;
			closeConnection();
		}
		return objs;
	}

	public Object findById(Object obj) throws AppException {
		Integer id = (Integer) obj;
		CardDTO cdto = new CardDTO();
		cdto.setID(id);
		RevertDTO rdto = new RevertDTO();
		rdto.setCARD_ID(id);
		Object[] objs = new Object[2];
		try {
			cardDAO =DAOFactory.getCardDAO(conn);
			revertDAO =DAOFactory.getRevertDAO(conn);
			CardVO cardvo =  (CardVO) cardDAO.findById(cdto);
			objs[0] = cardvo;
			objs[1] =  revertDAO.findAll(rdto);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			closeConnection();
		}
		return objs;
	}

	public Object findByObject(Object arg0) throws AppException {
		// TODO Auto-generated method stub
		return null;
	}

	public int getcount() throws AppException {
		// TODO Auto-generated method stub
		return 0;
	}

	public int getcount(Object arg0) throws AppException {
		// TODO Auto-generated method stub
		return 0;
	}

	public Object list() throws AppException {
		// TODO Auto-generated method stub
		return null;
	}

	public Object list(Object obj) throws AppException {
		int totals = 0;
		CardDTO dto=null;
			try {
				dto=(CardDTO)obj;
				cardDAO = (CardDAO) DAOFactory.getCardDAO(conn);
				totals=cardDAO.getCount(obj);
			} catch (SQLException e) {
				e.printStackTrace();
			}
		
		return totals;
	}

	public Object load(Object arg0) throws AppException {
		// TODO Auto-generated method stub
		return null;
	}
	
	/**
	 * @author 熊航航 <p>
	 * 根据条件删除card表中的相应信息
	 * @param obj 传入CardDTO对象
	 *@throws AppException
	 * @return 返回dto类型;			
	 */
	public Object modify(Object obj) throws AppException {
		boolean flag = false;
		CardDTO dto =(CardDTO) obj;
		try {
			cardDAO =  DAOFactory.getCardDAO(conn);
			flag = (Boolean) cardDAO.update(dto);
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			 cardDAO=null;
			 closeConnection();
		}
		return flag;
	}
	
	
	/**
	 * @author 熊航航 <p>
	 * 根据条件删除card表中的相应信息
	 * @param obj 传入CardDTO对象
	 *@throws AppException
	 * @return 返回DTO类型;			
	 */
	public Object remove(Object obj) throws AppException {
		boolean flag =false;
		cardDAO = DAOFactory.getCardDAO(conn);
		try {
			flag =  (Boolean) cardDAO.delete(obj);
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
		 cardDAO=null;
		 closeConnection();
		}
		return flag;
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -