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

📄 boarddao.java

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

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

import edu.yinhe.mis.dto.BoardDTO;
import edu.yinhe.mis.vo.BoardVO;
import edu.yinhe.system.model.BaseDAO;
import edu.yinhe.system.model.IBaseDAO;

/**
 * 
 * @author 黄强
 * 
 */
public class BoardDAO extends BaseDAO {

	/**
	 * 删除模板
	 */
	public Object delete(Object arg0) throws SQLException {

		boolean flage = false;
		String SQL = null;
		PreparedStatement pstat = null;

		try {
			SQL = "DELETE FROM board WHERE ID=?";

			pstat = conn.prepareStatement(SQL);
			pstat.executeUpdate();

			flage = true;
			if (pstat != null) {
				pstat.close();
			}
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flage;
	}

	public Object find() throws SQLException {

		// TODO Auto-generated method stub
		return null;
	}

	public Object find(Object arg0) throws SQLException {

		// TODO Auto-generated method stub
		return null;
	}

	public Object findAll() throws SQLException {

		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 查询模板
	 */
	public Object findAll(Object obj) throws SQLException {

		boolean flage = false;
		PreparedStatement pstat = null;
		ResultSet rst = null;
		ArrayList list = new ArrayList();
		try {
			BoardDTO dto = (BoardDTO) obj;
			BoardVO vo = null;
			String SQL = null;
			SQL = "SELECT * FROM board";
			while (rst.next()) {
				vo = new BoardVO();
				vo.setID(rst.getInt("id"));
				vo.setBOARD_NO(rst.getString("BOARD_NO"));
				vo.setSUPER_BOARD(rst.getString("SUPER_BOARD"));
				vo.setMANAGER(rst.getString("MANAGER"));
				vo.setLEVEL(rst.getString("LEVEL"));

				list.add(vo);

			}
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		finally {
			if (pstat != null) {
				pstat.close();
			}
		}

		return list;
	}

	public Object findById(Object arg0) throws SQLException {

		// TODO Auto-generated method stub
		return null;
	}

	public Object findByObject(Object arg0) throws SQLException {

		// TODO Auto-generated method stub
		return null;
	}

	public int getCount(Object arg0) throws SQLException {

		// TODO Auto-generated method stub
		return 0;
	}

	public Object getMaxId(Object arg0) throws SQLException {

		// TODO Auto-generated method stub
		return null;
	}

	/**
	 * 增加模板
	 */
	public Object insert(Object obj) throws SQLException {

		boolean flag = false;
		PreparedStatement pstat = null;
		String SQL = null;

		try {
			BoardDTO dto = (BoardDTO) obj;
			SQL = "INSERT INTO Board(BOARD_NO,BOARD_NAME,SUPER_BOARD,MANAGER,LEVEL)VALUES(?,?,?,?,?)";
			pstat = conn.prepareStatement(SQL);
			pstat.setString(1, dto.getBOARD_NO());
			pstat.setString(2, dto.getBOARD_NAME());
			pstat.setString(3, dto.getSUPER_BOARD());
			pstat.setString(4, dto.getMANAGER());
			pstat.setString(5, dto.getLEVEL());
			pstat.executeUpdate();
			flag = true;
			if (pstat != null) {
				pstat.close();
			}
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;

	}

	/**
	 * 修改模块
	 */
	public Object update(Object obj) throws SQLException {

		boolean flage = false;
		PreparedStatement pstat = null;
		String SQL = null;
		try {
			BoardDTO dto = (BoardDTO) obj;
			SQL = "UPDATE board BOARD_NO='?',BOARD_NAME='?' WHERE ID =?";

			pstat = conn.prepareStatement(SQL);
			pstat.setString(1, dto.getBOARD_NO());
			pstat.setString(2, dto.getBOARD_NAME());
			pstat.setInt(3, dto.getID());

			pstat.executeUpdate();
			if (pstat != null) {
				pstat.close();

			}
		} catch (RuntimeException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return flage;
	}

}

⌨️ 快捷键说明

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