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

📄 ripirsiddao.java

📁 J2ee开发的 人事管理系统 使用oracle数据库 myeclips平台开发
💻 JAVA
字号:
package com.galaxy.dao;

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

import com.galaxy.base.DaoInterface;
import com.galaxy.db.ConnectDB;
import com.galaxy.vo.PowerInfoVO;
import com.galaxy.vo.RiPiRsIdVO;
import com.galaxy.vo.RoleInfoVO;

public class RiPiRsIdDAO extends ConnectDB implements DaoInterface{

	public int addObject(Object ob) {
		int i = 0;
		RiPiRsIdVO rpvo = new RiPiRsIdVO();
		rpvo = (RiPiRsIdVO)ob;
		super.openDBConnection();
		String sql = "insert into ri_pi_rs values(?,?,?)";
		try {
			PreparedStatement pst = super.dbConnection.prepareStatement(sql);
			
			/**
			 * debug
			 */
			Long riid = rpvo.getRoleInfo().getRiId();
			Long piid = rpvo.getPowerInfo().getPiId();
			////////////////////////
			
			pst.setLong(1, rpvo.getRoleInfo().getRiId());
			pst.setLong(2, rpvo.getPowerInfo().getPiId());
			pst.setString(3, "");
			i = pst.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		super.closeDBConnection();
		return 0;
	}

	public int deleteObject(Object cond) {
		int result = 0;
		String sql ="delete from ri_pi_rs where ri_id in ("+(String)cond+")";
		super.openDBConnection();
		try {
			result = super.dbStatement.executeUpdate(sql);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		super.closeDBConnection();
		return result;
	}

	public List queryByCondition(Object cond) {
		List rplist = new ArrayList();
		String sql="select * from role_info r, power_info p, ri_pi_rs  ri " +
				"where r.ri_id=ri.ri_id and ri.pi_id=p.pi_id" + (String)cond;
		super.openDBConnection();
		try {
			super.dbResultSet = super.dbStatement.executeQuery(sql);
			
			while(super.dbResultSet.next())
			{
				RiPiRsIdVO rpvo = new RiPiRsIdVO();
				RoleInfoVO rolevo = new RoleInfoVO();
				PowerInfoVO powervo = new PowerInfoVO();
				rolevo.setRiId(super.dbResultSet.getLong("ri_id"));
				rolevo.setRiName(super.dbResultSet.getString("ri_name"));
				rolevo.setRiTag(super.dbResultSet.getString("ri_tag"));
				powervo.setPiId(super.dbResultSet.getLong("pi_id"));
				powervo.setPiName(super.dbResultSet.getString("pi_name"));
				powervo.setPiUp(super.dbResultSet.getString("pi_up"));
				powervo.setPiPage(super.dbResultSet.getString("pi_page"));
				rpvo.setRoleInfo(rolevo);
				rpvo.setPowerInfo(powervo);
				rplist.add(rpvo);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		super.closeDBConnection();
		
		return rplist;
	}

	public Object readObject(Object cond) {
		// TODO Auto-generated method stub
		return null;
	}

	public int updateObject(Object ob) {
		// TODO Auto-generated method stub
		return 0;
	}

}

⌨️ 快捷键说明

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