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

📄 scheduledao.java

📁 accp s1毕业项目 考试管理系统
💻 JAVA
字号:
package com.exam.db.dao;

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

import com.exam.db.bean.Schedule;
import com.yutang.dboption.DBOption;
import com.yutang.dboption.IPreparedStatementSetter;

public class ScheduleDao {
	List<Schedule> list = new ArrayList<Schedule>();
	DBOption<Schedule> db = new DBOption<Schedule>();
	
	public int insertSchedule(final Schedule schedule){
		int result = 0;
		db.setCon(MyConnection.getConnection(ScheduleDao.class));
		String sql = "insert into Schedule values (?,?,?)";
		result = db.save(sql,new IPreparedStatementSetter(){
			public PreparedStatement setValues(PreparedStatement pst)
					throws SQLException {
				pst.setString(1,schedule.getBanJiID());
				pst.setInt(2,schedule.getCouID());
				pst.setString(3,schedule.getTeaID());
				return pst;
			}			
		});
		return result;
	}
	
	public List<Schedule> selectAllByBanJiID(final Schedule schedule){		
		db.setCon(MyConnection.getConnection(ScheduleDao.class));
		String sql = "select * from Schedule where BanJiID = ?";
		list = db.queryAll(sql, schedule, new IPreparedStatementSetter(){
			public PreparedStatement setValues(PreparedStatement pst)
					throws SQLException {
				pst.setString(1, schedule.getBanJiID());
				return pst;
			}
			
		});
		return list;
	}
}

⌨️ 快捷键说明

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