📄 checkdao.java
字号:
package com.jblack.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.jblack.model.Tpublish;
import com.jblack.tool.DBConnection;
public class CheckDAO {
protected DBConnection conn = new DBConnection();
public CheckDAO() {
}
public List<Tpublish> queryUncheck() {
List<Tpublish> list = new ArrayList<Tpublish>();
ResultSet rs = conn.executeQuery("select * from Tpublish where TP_status=0");
try {
while (rs.next()) {
list.add(new Tpublish(rs.getInt("TP_id"), rs.getInt("TC_id"),
rs.getInt("TP_winner"),rs.getString("TP_name"),
rs.getDouble("TP_initPrice"), rs.getDouble("TP_modPrice"),
rs.getString("TP_description"), rs.getDate("TP_pubDate"),
rs.getDate("TP_deadline"),rs.getDate("TP_gameDate"),
rs.getDate("TP_gameDeadline"),rs.getInt("TP_status")));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
conn.close();
}
return list;
}
public Tpublish getCheck(String name) {
Tpublish s = null;
ResultSet rs = conn.executeQuery("select * from Tpublish where TP_name = '"+name+"'");
try {
while (rs.next()) {
s = new Tpublish(rs.getInt("TP_id"), rs.getInt("TC_id"),
rs.getInt("TP_winner"),rs.getString("TP_name"),
rs.getDouble("TP_initPrice"), rs.getDouble("TP_modPrice"),
rs.getString("TP_description"), rs.getDate("TP_pubDate"),
rs.getDate("TP_deadline"),rs.getDate("TP_gameDate"),
rs.getDate("TP_gameDeadline"),rs.getInt("TP_status"));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
conn.close();
}
return s;
}
public int Update(String name, int status) {
int num = 0;
num = conn.executeUpdate("update tpublish set TP_status='" + status
+ "' where TP_name='" + name + "'");
conn.close();
return num;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -