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

📄 leaverservice.java

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

import edu.yinhe.mis.dto.LeaverDTO;
import edu.yinhe.mis.model.DAOFactory;
import edu.yinhe.mis.model.LeaverDAO;
import edu.yinhe.mis.vo.LeaverVO;
import edu.yinhe.system.common.AppException;

import edu.yinhe.system.model.IBaseDAO;
import edu.yinhe.system.services.Service;

public class LeaverService extends Service {
	private IBaseDAO dao = null;
	public Object alllist() throws AppException {
		// TODO Auto-generated method stub
		return null;
	}
    /**
     * 班级信息
     */
	public Object alllist(Object arg0) throws AppException {
		dao =DAOFactory.getLeaverDAO(conn);
		ArrayList list =null;
//		try {
//			//list = (ArrayList) dao.Permissionlist(arg0);
//		
//		} catch (SQLException e) {
//			e.printStackTrace();
//		}finally{
//			this.closeConnection();
//		}
//		
		return list;
	}
    /**
     * 添加一条
     */
	public Object create(Object arg0) throws AppException {
		boolean flag= false;
		dao=DAOFactory.getLeaverDAO(conn);
		try {
			 flag = (Boolean) dao.insert(arg0);
		    } catch (SQLException e) {
			try {
				conn.rollback();
			  } catch (SQLException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			 }
			 e.printStackTrace();
		 }finally{
			closeConnection();
		}
		return flag;
	}
	/**
	 * 修改
	 */
	public Object modify(Object arg0) throws AppException {
		Boolean istrue=false;		
			try {
				dao=DAOFactory.getLeaverDAO(conn);
				istrue=(Boolean) dao.update(arg0);
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}finally{
				this.closeConnection();
			}
		
		
		return istrue;
	}  
	 /**
     * 删除
     */
	public Object remove(Object arg0) throws AppException {
		Boolean flag=false;
		dao=DAOFactory.getLeaverDAO(conn);
		try {
			flag= (Boolean)dao.delete(arg0);
		} catch (SQLException e) {
			try {
				conn.rollback();
			} catch (SQLException e1) {
				throw new AppException(e1.getMessage());
			}
		}finally{
			this.closeConnection();
		}
		
		return flag;
	}
	 /**
	  * 查看请假记录
	  */
	public Object findAll() throws AppException {
		dao=DAOFactory.getLeaverDAO(conn);
		ArrayList list = null;
		try {
			list=(ArrayList)dao.findAll();
		} catch (SQLException e) {
			try {
				conn.rollback();
			} catch (SQLException e1) {
				throw new AppException(e1.getMessage());

			}	
			e.printStackTrace();
		}finally{
			this.closeConnection();
		}
		return list;
	}
	/**
     * 加载
     */
	public Object load(Object obj) throws AppException {
		LeaverDTO LeaverDTO=null;
		LeaverVO vo=new LeaverVO();
		LeaverDTO ldto = (LeaverDTO)obj;
		dao = DAOFactory.getLeaverDAO(conn);
		
		try {
			vo = (LeaverVO)dao.findById(ldto);
		}catch (SQLException e) {
			try {
				conn.rollback();
			} catch (SQLException e1) {
				throw new AppException(e.getMessage()+"危险!");
			}
		}finally{
			closeConnection();//注意,连接是在前面有服务层创建,本着谁创建,谁关闭的原则,所以要它关闭;			
		}
		return vo;
	}


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

	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
		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 arg0) throws AppException {
		ArrayList list =null;
		if(arg0 == null){
			dao = DAOFactory.getLeaverDAO(conn);
			LeaverVO vo = null;
			
			try {
				list = (ArrayList)dao.find();
			
			System.out.println(list.size());
			} catch (SQLException e) {
				e.printStackTrace();
			}finally{
				this.closeConnection();
			}
		}else{
			dao = DAOFactory.getLeaverDAO(conn);
			
			try {
				list = (ArrayList) dao.findAll(arg0);
			} catch (SQLException e) {
				throw new AppException(e.getMessage()); 
			}finally{
				this.closeConnection();
			}
		}
		return list;
	}	
}

⌨️ 快捷键说明

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