📄 doworkinfo.java~41~
字号:
package work.info;
import java.sql.*;
import java.util.*;
import work.tools.*;
public class DoWorkInfo {
private int dId;
private int wid;
private String content;
private String dTime;
private int stuNo;
private int score;
private String status;
private ConnectBean cb;
private PreparedStatement ps;
private String tId;
private String title;
private String stuName;
public DoWorkInfo() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void setDId(int dId) {
this.dId = dId;
}
public void setWid(int wid) {
this.wid = wid;
}
public void setContent(String content) {
this.content = content;
}
public void setdTime(String dTime) {
this.dTime = dTime;
}
public void setStuNo(int stuNo) {
this.stuNo = stuNo;
}
public void setScore(int score) {
this.score = score;
}
public void setStatus(String status) {
this.status = status;
}
public void setTId(String tId) {
this.tId = tId;
}
public void setTitle(String title) {
this.title = title;
}
public void setStuName(String stuName) {
this.stuName = stuName;
}
public int getWid() {
return wid;
}
public String getContent() {
return content;
}
public String getdTime() {
return dTime;
}
public int getStuNo() {
return stuNo;
}
public int getScore() {
return score;
}
public String getStatus() {
return status;
}
public int getDId() {
return dId;
}
public String getTId() {
return tId;
}
public String getTitle() {
return title;
}
public String getStuName() {
return stuName;
}
public String getSubScore(){
int score1=0;
String score;
cb = new ConnectBean();
try {
cb.openConnection();
String query = " ";
cb.createPreparedStatement(query);
cb.executeQuery();
while (cb.next()) {
}
} catch (Exception se) {
status = "写入数据发生错误!!!" + se;
} finally {
try {
cb.close();
} catch (Exception es) {
status = "后台发生错误" + es;
}
}
return score;
}
public boolean giveScore(){
boolean bl = false;
cb = new ConnectBean();
try {
cb.openConnection();
String query = "UPDATE dowork SET score=? where wid="+wid+"&&stuno="+stuNo;
System.out.println(query);
ps = cb.createPreparedStatement(query);
ps.setInt(1, score);
ps.executeUpdate();
bl = true;
} catch (Exception se) {
status = "写入数据发生错误!!!" + se;
} finally {
try {
cb.close();
} catch (Exception es) {
status = "后台发生错误" + es;
}
}
return bl;
}
public boolean addDoWork(){
boolean bl = false;
status = "添加失败";
cb = new ConnectBean();
cb.openConnection();
try {
ps = cb.createPreparedStatement(
"insert into dowork values(null,?,?,?,?,0)");
ps.setInt(1, this.wid);
ps.setString(2, this.content);
ps.setString(3, this.dTime);
ps.setInt(4, this.stuNo);
// System.out.println("ddssasasddfsffffffffffffffffffffff"+this.wid+this.content+this.dTime+this.stuNo);
ps.executeUpdate();
bl = true;
status = "回复添加成功";
} catch (Exception se) {
status = "写入数据发生错误!!!" + se;
} finally {
try {
cb.close();
} catch (Exception es) {
status = "后台发生错误" + es;
}
}
return bl;
}
public boolean isWorkExit(){
boolean b1=false;
cb = new ConnectBean();
try {
cb.openConnection();
String query = "select content from dowork where wid=" + this.wid+"&&stuno="+this.stuNo;
System.out.println(query);
cb.createPreparedStatement(query);
cb.executeQuery();
if (cb.next()) {
return b1=true;
}
} catch (Exception se) {
status = "写入数据发生错误!!!" + se;
} finally {
try {
cb.close();
} catch (Exception es) {
status = "后台发生错误" + es;
}
}
return b1;
}
public ArrayList amend(){
ArrayList oneTeacherWork=null;
cb = new ConnectBean();
try {
cb.openConnection();
String query = "SELECT dowork.*,work.title,stumessage.stuname FROM dowork,work,stumessage where work.wid="+wid+"&&work.wid=dowork.wid&&stumessage.stuno=dowork.stuno ";
cb.createPreparedStatement(query);
cb.executeQuery();
oneTeacherWork = new ArrayList();
while (cb.next()) {
DoWorkInfo newWork = new DoWorkInfo();
newWork.dId=cb.getIntData(1);
newWork.wid = cb.getIntData(2);
newWork.content=cb.getData(3);
newWork.dTime = cb.getData(4);
newWork.stuNo=cb.getIntData(5);
newWork.score=cb.getIntData(6);
newWork.title = cb.getData(7);
newWork.stuName=cb.getData(8);
oneTeacherWork.add(newWork);
}
} catch (Exception se) {
status = "写入数据发生错误!!!" + se;
} finally {
try {
cb.close();
} catch (Exception es) {
status = "后台发生错误" + es;
}
}
return oneTeacherWork;
}
private void jbInit() throws Exception {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -