?? determine.java
字號:
package com.course;
import java.sql.*;
public class determine{
//根據教師ID查詢班級和課程信息
public ResultSet getClass(String tea_id){
String sql="select classes.id,course.name "+
"from classes,course "+
"where course.id=classes.cour_id "+
"and classes.tea_id='"+tea_id+"' ";
sqlBean sqlbean = new sqlBean();
ResultSet rs = sqlbean.executeQuery(sql);
return rs;
}
//根據班級ID查詢學生的具體信息
public ResultSet getStudents(String class_id){
String sql="select student.id,name ,department,sex,mark,e_mail,tel "+
"from student,enrol,classes "+
"where student.id=enrol.stu_id "+
"and enrol.accept='0' "+
"and classes.id=enrol.class_id "+
"and classes.id='"+class_id+"' ";
sqlBean sqlbean = new sqlBean();
ResultSet rs = sqlbean.executeQuery(sql);
return rs;
}
public ResultSet getStudents2(String class_id){
String sql="select student.id,name ,department,sex,mark,e_mail,tel "+
"from student,enrol,classes "+
"where student.id=enrol.stu_id "+
"and enrol.accept='1' "+
"and enrol.score='0' "+
"and classes.id=enrol.class_id "+
"and classes.id='"+class_id+"' ";
sqlBean sqlbean = new sqlBean();
ResultSet rs = sqlbean.executeQuery(sql);
return rs;
}
//根據學生ID和班級ID,進行數據庫更新操作,用來更改標識位,表示學生選課成功
public int enrol(String stu_id,String class_id){
int num=0;
String sql="update enrol set accept=1 "+
"where stu_id='"+stu_id+"' "+
"and class_id='"+class_id+"' ";
sqlBean db = new sqlBean();
num=db.executeInsert(sql);
return num;
}
//給選課的學生打分
public int marking(String stu_id,String class_id,String score){
int num=0;
String sql="update enrol "+
"set score='"+score+"' "+
"where stu_id='"+stu_id+"' "+
"and class_id='"+class_id+"' ";
sqlBean db = new sqlBean();
num=db.executeInsert(sql);
return num;
}
//修改學生成績
public int addMark(String stu_id,String class_id){
int num=0;
String sql="update student "+
"set student.mark=student.mark+course.mark "+
"from student,course,classes "+
"where student.id='"+stu_id+"' "+
"and course.id=classes.cour_id "+
"and classes.id='"+class_id+"' ";
sqlBean db = new sqlBean();
num=db.executeInsert(sql);
return num;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -