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

📄 user_jouhou_002dataaccess.java

📁 jsp考勤
💻 JAVA
字号:
/*
 *	Copyright (C) 2000, TOA-System Co.  All rights reserved.
 */
package dbcommon;

import java.util.*;
import java.sql.*;
import entity.*;
import util.*;
import exce.*;

/**
 *	偙偺僋儔僗偼丄幮堳忣曬傊傾僋僙僗偡傞偨傔偺僋儔僗偱偡丅<br>
 *	@version 2.00
 *	@author  TOA
 *	
 *	峏怴棜楌
 *	<ul>
 *		<li>僐儊儞僩傪捛壛
 *	</ul>
 */
public class User_Jouhou_002DataAccess extends DataAccess{
	ChangeField cf = new ChangeField();
	Status st = new Status();
	public User_Jouhou_002DataAccess() {}


public void lockUser_Jouhou_002(Connection con, String whe) {
		ResultSet rs = null;
		try {
			// 偙偺儊僜僢僪偱幚峴偡傞SQL暥偱偡丅
			String sql = "SELECT * FROM USER_JOUHOU_002 " + whe + " FOR UPDATE NOWAIT";

			pstmt = this.sqlSet(con,sql);
			rs = this.exeQuery(pstmt);
			int size = 0;
			while (rs.next()) {
				size = size + 1;
			}
			if ( size == 0 ) {
				throw new MissingFindException("幮堳忣曬");			//Oracle梡偱張棟
			}

		} catch (MissingFindException misse) {
			
			throw new MissingFindException("幮堳忣曬");
		} catch (Exception e) {
			
			throw new OriginalException(e);
		} finally {
			// Statemet偼丆昁偢close()偟傑偡丅
			try {
				if (rs != null) rs.close();
				if (pstmt != null) pstmt.close();
			} catch (Exception ex) { }
		}
	}


	/**
	 *	幮堳忣曬偺捛壛(Insert)
	 *	@param	con		DB僪儔僀僶偺URL側偳
	 *			jme		User_Jouhou_002Entity僆僽僕僃僋僩 
	 */
	public void createUser_Jouhou_002(Connection con, User_Jouhou_002Entity ee) {
		ResultSet rs = null;
		
		try {
			// 偙偺儊僜僢僪偱幚峴偡傞SQL暥偱偡
			String sql = "INSERT INTO USER_JOUHOU_002 (" 	+
				                "USER_CD,"+
				                "USER_NM,"+
								"BUMON_CD,"+
								"BUMON_NM,"+
								"KENGEN_KUBUN,"+
								"SEX,"+
								"NENREI,"+
								"PASSWORD,"+
								"UPDATE_USER,"+
								"UPDATE_TIME,"+
				                "OLUPDATE_USER,"+
								"OLUPDATE_TIME"+") values (" +
								
							 	"?,"					+		
								"?,"					+		
								"?,"					+		
								"?,"					+		
								"?,"					+		
								"?,"					+		
								"?,"					+		
								"?,"					+		
								"?,"					+		
								"SYSDATE,"				+		
								"?,"					+		
								"SYSDATE)";						

			pstmt = this.sqlSet(con,sql);

			pstmt.setString(1,ee._user_cd);					
			pstmt.setString(2,ee._user_nm);
			pstmt.setString(3,ee._bumon_cd);
			pstmt.setString(4,ee._bumon_nm);
			pstmt.setString(5,ee._kengen_kubun);					
			pstmt.setString(6,ee._sex);			
			pstmt.setInt(7,ee._nenrei);			
			pstmt.setString(8,ee._password);			
			pstmt.setString(9,ee._update_user);
			pstmt.setString(10,ee._olupdate_user);
			
			int i = this.exeUpdate(pstmt);

		} catch (MissingFindException misse) {
			
			throw new MissingFindException("幮堳忣曬");
		} catch (OracleException orae) {
			st = orae.getStatus();
			throw new OracleException(st);
		} catch (SQLException sqle) {
			
			throw new OracleException(sqle);
		} catch (Exception e) {
			
			throw new OriginalException(e);
		} finally {
			// Statemet偼丆昁偢close()偟傑偡丅
			try {
				if (rs != null) rs.close();
				if (pstmt != null) pstmt.close();
			} catch (Exception ex) { }
		}
	}


	public User_Jouhou_002Entity[] findUser_Jouhou_002(Connection con,String whe) {
		ResultSet rs 			= null;
		try {
			// 偙偺儊僜僢僪偱幚峴偡傞SQL暥偱偡丅
			String sql = "SELECT DISTINCT USER_CD,USER_NM,BUMON_CD,BUMON_NM,KENGEN_KUBUN,SEX,NENREI,PASSWORD,UPDATE_USER,UPDATE_TIME,OLUPDATE_USER,OLUPDATE_TIME FROM USER_JOUHOU_002 ";
			if(whe!=null&&!(whe.equals(""))){
				sql+=whe;
			}
			pstmt = this.sqlSet(con,sql);

			rs = this.exeQuery(pstmt);			

			Vector v = new Vector();			
			while (rs.next()) {
				// Entity僆僽僕僃僋僩傪侾偮偮偔傝丆偙傟偵抣傪奿擺偟傑偡丅
				User_Jouhou_002Entity ee 	= new User_Jouhou_002Entity();
				ee._user_cd                 =rs.getString("USER_CD");          //幮堳僐乕僪              
				ee._user_nm                 =rs.getString("USER_NM");          //幮堳柤		
				ee._bumon_cd			    =rs.getString("BUMON_CD");         //晹栧僐乕僪
				ee._bumon_nm			    =rs.getString("BUMON_NM");         //晹栧柤
				ee._kengen_kubun            =rs.getString("KENGEN_KUBUN");     //尃尷嬫暘
				ee._sex                     =rs.getString("SEX");              //惈暿     
				ee._nenrei                  =rs.getInt("NENREI");        	   //擭楊
				ee._password			    =rs.getString("PASSWORD");         //埫崋
				ee._update_user			    =rs.getString("UPDATE_USER");      //峏怴幰
				ee._update_time             =rs.getDate("UPDATE_TIME");        //峏怴擔帪
				ee._olupdate_user           =rs.getString("OLUPDATE_USER");    //僆儞儔僀儞嵟廔峏怴幰               
				ee._olupdate_time           =rs.getDate("OLUPDATE_TIME");      //僆儞儔僀儞嵟廔峏怴擔帪  		
				
				v.addElement(ee);
			}
			// Vector 偐傜 Entity僆僽僕僃僋僩偺攝楍傊堏偟懼偊傑偡丅
			int size = v.size();
			User_Jouhou_002Entity[] ees = new User_Jouhou_002Entity[size];
			ees = (User_Jouhou_002Entity[])v.toArray(ees);
		
			return ees;			
			
		} catch (MissingFindException misse) {
			
			throw new MissingFindException("幮堳忣曬昞");
		} catch (OracleException orae) {
			st = orae.getStatus();
			throw new OracleException(st);
		} catch (SQLException sqle) {
			
			throw new OracleException(sqle);
		} catch (Exception e) {
			
			throw new OriginalException(e);
		} finally {
			// Statemet偼丆昁偢close()偟傑偡丅
			try {
				if (rs != null) rs.close();
				if (pstmt != null) pstmt.close();
			} catch (Exception ex) { }
		}
	
	}

	public void updateUser_Jouhou_002(Connection con, User_Jouhou_002Entity ee) {
		ResultSet rs 			= null;
		
		try {
			// 懠偺抂枛偱儘僢僋傪偟偰偄側偄偐偳偆偐傪妋偐傔傑偡丅
			// 僔儞僌儖僐乕僩偑擖傞偙偲偼偁傝摼側偄乮愝掕僥乕僽儖)
		String whe = "WHERE USER_CD = '" + ee._user_cd + "' AND BUMON_CD = '" + ee._bumon_cd+"'";
			this.lockUser_Jouhou_002(con, whe);

			// 偙偺儊僜僢僪偱幚峴偡傞SQL暥偱偡丅
			String sql = "UPDATE USER_JOUHOU_002 SET "  				+   //幮堳僐乕僪
					 					                                    
					" USER_CD 	= ?, " 						            +	//幮堳柤						
					" USER_NM 	 		= ?,"						    +	//晹栧僐乕僪
					" BUMON_CD    			= ?, " 				        +	//晹栧柤
                    " BUMON_NM               =?, "                      +   //尃尷嬫暘
					" KENGEN_KUBUN=?, "                                 +   //惈暿
					" SEX=?, "                                          +   //擭楊
					" NENREI=?, "                                       +   //埫崋
					" PASSWORD=?, "                                     +   //峏怴幰
					" UPDATE_USER=?, "                                  +   //峏怴擔帪
					" UPDATE_TIME=SYSDATE, "                            +   //僆儞儔僀儞嵟廔峏怴幰
					" OLUPDATE_USER=?, "                                +   //僆儞儔僀儞嵟廔峏怴擔帪
					" OLUPDATE_TIME=SYSDATE "+whe;	

			pstmt = this.sqlSet(con,sql);
			
			pstmt.setString(1,ee._user_cd);					
			pstmt.setString(2,ee._user_nm);
			pstmt.setString(3,ee._bumon_cd);
			pstmt.setString(4,ee._bumon_nm);
			pstmt.setString(5,ee._kengen_kubun);					
			pstmt.setString(6,ee._sex);			
			pstmt.setInt(7,ee._nenrei);			
			pstmt.setString(8,ee._password);			
			pstmt.setString(9,ee._update_user);
			pstmt.setString(10,ee._olupdate_user);

			int i = this.exeUpdate(pstmt);

		} catch (MissingFindException misse) {
			
			throw new MissingFindException("幮堳忣曬");
		} catch (OracleException orae) {
			st = orae.getStatus();
			throw new OracleException(st);
		} catch (SQLException sqle) {
			
			throw new OracleException(sqle);
		} catch (Exception e) {
			
			throw new OriginalException(e);
		} finally {
			// Statemet偼丆昁偢close()偟傑偡丅
			try {
				if (rs != null) rs.close();
				if (pstmt != null) pstmt.close();
			} catch (Exception ex) { }
		}
	}


	public void deleteUser_Jouhou_002(Connection con, String whe) {
		ResultSet rs = null;
		try {
			// 懠偺抂枛偱儘僢僋傪偟偰偄側偄偐偳偆偐傪妋偐傔傑偡丅
			this.lockUser_Jouhou_002(con, whe);

			// 偙偺儊僜僢僪偱幚峴偡傞SQL暥偱偡丅
			String sql =    "DELETE USER_JOUHOU_002 " + whe;

			pstmt = this.sqlSet(con,sql);

			int i = this.exeUpdate(pstmt);

		} catch (MissingFindException misse) {
			
			throw new MissingFindException("幮堳忣曬");
		} catch (Exception e) {
			
			throw new OriginalException(e);
		} finally {
			// Statemet偼丆昁偢close()偟傑偡丅
			try {
				if (rs != null) rs.close();
				if (pstmt != null) pstmt.close();
			} catch (Exception ex) { }
		}
	}


}


⌨️ 快捷键说明

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