📄 scheduledao.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 + -