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

📄 roesdao.java

📁 oa rar it is the jsp
💻 JAVA
字号:
package com.accp.oa.dao.imple;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;

import com.accp.oa.bean.Roes;
import com.accp.oa.common.Constants;
import com.accp.oa.common.DbUtil;
import com.accp.oa.dao.inface.*;


/*
 * 此类是用于对表
 * 角色表进行操作
 * 的DAO类
 */
public class RoesDAO implements BaseDAO{

	
	/*
	 * 此方法用于添加角色名
	 * @see com.accp.oa.dao.inface.BaseDAO#add(java.lang.Object)
	 */
	public boolean add(Object roes) {
		Roes myroes = (Roes)roes;
		boolean success = false;
		Connection con = null;
		PreparedStatement stmt = null;
		try{
			con = DbUtil.connectToDB();
			stmt = con.prepareStatement(Constants.ADD_ROESNAME);
			stmt.setString(1,myroes.getRoesName());
			if(stmt.executeUpdate() > 0){
				success = true;
			}
		}catch(Exception ex){
			return false;
		}finally{
			try{
				stmt.close();
				con.close();
			}catch(Exception ex){
				
			}
		}
		return success;
	}

	public boolean delete(Object obj) {
		
		return false;
	}

	/*
	 * 此方法用于删除角色名
	 * @see com.accp.oa.dao.inface.BaseDAO#delete(int)
	 */
	public boolean delete(int roesId) {
		boolean success = false;
		Connection con = null;
		PreparedStatement stmt = null;
		try{
			con = DbUtil.connectToDB();
			stmt = con.prepareStatement(Constants.DELETE_ROESNAME);
			stmt.setInt(1, roesId);
			if(stmt.executeUpdate() > 0){
				success = true;
			}
		}catch(Exception ex){
			return false;
		}finally{
			try{
				stmt.close();
				con.close();
			}catch(Exception ex){
				
			}
		}
		return success;
	}

	public boolean delete(String ag0) {
		
		return false;
	}

	public Object search(Object obj) {
		
		return null;
	}

	public int search(String ag0, String ag1) {
		
		return 0;
	}

	public Object search(int id) {
		
		return null;
	}

	public ArrayList search(String age0) {
		
		return null;
	}

	public ArrayList search(int ag0, int age1) {
		
		return null;
	}

	/*
	 * 此方法查询出
	 * 所有的角色
	 */
	public ArrayList search() {
		ArrayList roess = new ArrayList();
		Connection con = null;
		PreparedStatement stmt = null;
		ResultSet rs = null;
		try{
			con = DbUtil.connectToDB();
			stmt = con.prepareStatement(Constants.SEARCH_ALL_ROES);
			rs = stmt.executeQuery();
			while(rs.next()){
				Roes roes = new Roes() ;
				roes.setId(rs.getInt("Id"));
				roes.setRoesName(rs.getString("RoesName"));
				roess.add(roes);
			}
		}catch(Exception ex){
			return null;
		}finally{
			try{
				rs.close();
				stmt.close();
				con.close();
			}catch(Exception ex){
				
			}
		}
		return roess;
	}

	public boolean update(Object obj) {
	
		return false;
	}

}

⌨️ 快捷键说明

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