|
|
|
@ -2,7 +2,6 @@ package dao;
|
|
|
|
|
|
|
|
|
|
import java.sql.*;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import error.GExcptSQL;
|
|
|
|
@ -28,7 +27,6 @@ public class DBManagement {
|
|
|
|
|
"graduation_design_opening_report_opinion_record",
|
|
|
|
|
"graduation_design_reply",
|
|
|
|
|
"graduation_design_reply_opinion_record_score"
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
public static String[] studentInfo = {
|
|
|
|
|
"id",
|
|
|
|
@ -57,55 +55,49 @@ public class DBManagement {
|
|
|
|
|
"phone_number"
|
|
|
|
|
};
|
|
|
|
|
//<table1.x_id,table2.x_status>
|
|
|
|
|
public static Map<String,String> graduationDesignStudentTables = new HashMap<>(){
|
|
|
|
|
{
|
|
|
|
|
put("graduation_design.student_id","graduation_design.student_chooser_teacher_status");
|
|
|
|
|
put("graduation_design.student_id","graduation_design_information.student_fill_graduation_design_information_status");
|
|
|
|
|
put("graduation_design.student_id","graduation_design_opening_report.opening_report_status");
|
|
|
|
|
put("opening_report_secretary_team.leader_student_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status");
|
|
|
|
|
put("opening_report_secretary_team.student1_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status");
|
|
|
|
|
put("opening_report_secretary_team.student2_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status");
|
|
|
|
|
put("graduation_design.student_id","graduation_design_finished_product.finished_product_status");
|
|
|
|
|
put("reply_secretary_team.leader_student_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status");
|
|
|
|
|
put("reply_secretary_team.teacher1_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status");
|
|
|
|
|
put("reply_secretary_team.teacher2_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status");
|
|
|
|
|
}
|
|
|
|
|
public static String[][] graduationDesignStudentTables ={
|
|
|
|
|
{"graduation_design.student_id","graduation_design.student_choose_teacher_status"},
|
|
|
|
|
{"graduation_design.student_id","graduation_design_information.student_fill_graduation_design_information_status"},
|
|
|
|
|
{"graduation_design.student_id","graduation_design_opening_report.opening_report_status"},
|
|
|
|
|
{"graduation_design_opening_report_view.leader_student_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status"},
|
|
|
|
|
{"graduation_design_opening_report_view.student1_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status"},
|
|
|
|
|
{"graduation_design_opening_report_view.student2_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status"},
|
|
|
|
|
{"graduation_design.student_id","graduation_design_finished_product.finished_product_status"},
|
|
|
|
|
{"graduation_design_reply_view.leader_student_id","graduation_design_reply_opinion_record_score.reply_secretary_record_status"},
|
|
|
|
|
{"graduation_design_reply_view.teacher1_id","graduation_design_reply_opinion_record_score.reply_secretary_record_status"},
|
|
|
|
|
{"graduation_design_reply_view.teacher2_id","graduation_design_reply_opinion_record_score.reply_secretary_record_status"}
|
|
|
|
|
};
|
|
|
|
|
public static Map<String,String> graduationDesignTeacherTables = new HashMap<>(){
|
|
|
|
|
{
|
|
|
|
|
put("graduation_design.teacher_id","graduation_design.teacher_choose_student_status");
|
|
|
|
|
put("graduation_design.teacher_id","graduation_design_opening_report_opinion_record.opening_report_mentor_opinion_status");
|
|
|
|
|
put("opening_report_teacher_team.leader_teacher_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status");
|
|
|
|
|
put("opening_report_teacher_team.teacher1_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status");
|
|
|
|
|
put("opening_report_teacher_team.teacher2_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status");
|
|
|
|
|
put("graduation_design_opening_report_opinion_record.opening_report_college_teacher_id","graduation_design_opening_report_opinion_record.opening_report_college_opinion_status");
|
|
|
|
|
put("graduation_design.teacher_id","graduation_design_finished_product_mentor_score.finished_product_mentor_score_status");
|
|
|
|
|
put("graduation_design_finished_product_reviewer_score.reviewer_teacher_id","graduation_design_finished_product_reviewer_score.finished_product_reviewer_score_status");
|
|
|
|
|
put("reply_teacher_team.leader_teacher_id","graduation_design_reply_opinion_record_score.reply_ teacher_team_score_status");
|
|
|
|
|
put("reply_teacher_team. teacher1_id","graduation_design_reply_opinion_record_score.reply_ teacher_team_score_status");
|
|
|
|
|
put("reply_teacher_team. teacher2_id","graduation_design_reply_opinion_record_score.reply_ teacher_team_score_status");
|
|
|
|
|
put("graduation_design_reply_opinion_record_score.reply_college_teacher_id","graduation_design_reply_opinion_record_score.reply_college_score_status");
|
|
|
|
|
put("graduation_design_reply_opinion_record_score.reply_school_teacher_id","graduation_design_reply_opinion_record_score.reply_school_score_status");
|
|
|
|
|
}
|
|
|
|
|
public static String[][] graduationDesignTeacherTables = {
|
|
|
|
|
{"graduation_design.teacher_id","graduation_design.teacher_choose_student_status"},
|
|
|
|
|
{"graduation_design.teacher_id","graduation_design_opening_report_opinion_record.opening_report_mentor_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_view.leader_teacher_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_view.teacher1_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_view.teacher2_id","graduation_design_opening_report_opinion_record.opening_report_teacher_team_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_opinion_record.opening_report_college_teacher_id","graduation_design_opening_report_opinion_record.opening_report_college_opinion_status"},
|
|
|
|
|
{"graduation_design.teacher_id","graduation_design_finished_product_mentor_score.finished_product_mentor_score_status"},
|
|
|
|
|
{"graduation_design_finished_product_reviewer_score.reviewer_teacher_id","graduation_design_finished_product_reviewer_score.finished_product_reviewer_score_status"},
|
|
|
|
|
{"graduation_design_reply_view.leader_teacher_id","graduation_design_reply_opinion_record_score.reply_teacher_team_score_status"},
|
|
|
|
|
{"graduation_design_reply_view.teacher1_id","graduation_design_reply_opinion_record_score.reply_teacher_team_score_status"},
|
|
|
|
|
{"graduation_design_reply_view.teacher2_id","graduation_design_reply_opinion_record_score.reply_teacher_team_score_status"},
|
|
|
|
|
{"graduation_design_reply_opinion_record_score.reply_college_teacher_id","graduation_design_reply_opinion_record_score.reply_college_score_status"},
|
|
|
|
|
{"graduation_design_reply_opinion_record_score.reply_school_teacher_id","graduation_design_reply_opinion_record_score.reply_school_score_status"}
|
|
|
|
|
};
|
|
|
|
|
public static Map<String,String> allStatus = new HashMap<>(){
|
|
|
|
|
{
|
|
|
|
|
put("graduation_design","teacher_choose_student_status");
|
|
|
|
|
put("graduation_design","student_choose_teacher_status");
|
|
|
|
|
put("graduation_design_information","student_fill_graduation_design_information_status");
|
|
|
|
|
put("graduation_design_opening_report","opening_report_status");
|
|
|
|
|
put("graduation_design_opening_report_opinion_record","opening_report_mentor_opinion_status");
|
|
|
|
|
put("graduation_design_opening_report_opinion_record","opening_report_teacher_team_opinion_status");
|
|
|
|
|
put("graduation_design_opening_report_opinion_record","opening_report_college_opinion_status");
|
|
|
|
|
put("graduation_design_opening_report_opinion_record","opening_report_secretary_record_status");
|
|
|
|
|
put("graduation_design_finished_product","finished_product_status");
|
|
|
|
|
put("graduation_design_finished_product_mentor_score","finished_product_mentor_score_status");
|
|
|
|
|
put("graduation_design_finished_product_reviewer_score","finished_product_reviewer_score_status");
|
|
|
|
|
put("graduation_design_reply_opinion_record_score","reply_ secretary_record_status");
|
|
|
|
|
put("graduation_design_reply_opinion_record_score","reply_ teacher_team_score_status");
|
|
|
|
|
put("graduation_design_reply_opinion_record_score","reply_college_score_status");
|
|
|
|
|
put("graduation_design_reply_opinion_record_score","reply_school_score_status");
|
|
|
|
|
}
|
|
|
|
|
public static String[][] allStatus = {
|
|
|
|
|
{"graduation_design","teacher_choose_student_status"},
|
|
|
|
|
{"graduation_design","student_choose_teacher_status"},
|
|
|
|
|
{"graduation_design_information","student_fill_graduation_design_information_status"},
|
|
|
|
|
{"graduation_design_opening_report","opening_report_status"},
|
|
|
|
|
{"graduation_design_opening_report_opinion_record","opening_report_mentor_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_opinion_record","opening_report_teacher_team_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_opinion_record","opening_report_college_opinion_status"},
|
|
|
|
|
{"graduation_design_opening_report_opinion_record","opening_report_secretary_record_status"},
|
|
|
|
|
{"graduation_design_finished_product","finished_product_status"},
|
|
|
|
|
{"graduation_design_finished_product_mentor_score","finished_product_mentor_score_status"},
|
|
|
|
|
{"graduation_design_finished_product_reviewer_score","finished_product_reviewer_score_status"},
|
|
|
|
|
{"graduation_design_reply_opinion_record_score","reply_secretary_record_status"},
|
|
|
|
|
{"graduation_design_reply_opinion_record_score","reply_teacher_team_score_status"},
|
|
|
|
|
{"graduation_design_reply_opinion_record_score","reply_college_score_status"},
|
|
|
|
|
{"graduation_design_reply_opinion_record_score","reply_school_score_status"}
|
|
|
|
|
};
|
|
|
|
|
public static String driverClassName="org.mariadb.jdbc.Driver";
|
|
|
|
|
|
|
|
|
@ -138,7 +130,7 @@ public class DBManagement {
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
public static Map<String,String> getUserStatusTables(String userType){
|
|
|
|
|
public static String[][] getUserStatusTables(String userType){
|
|
|
|
|
if(userType.equals("student")){
|
|
|
|
|
return graduationDesignStudentTables;
|
|
|
|
|
}
|
|
|
|
@ -179,6 +171,11 @@ public class DBManagement {
|
|
|
|
|
String sql = update.getSQL();
|
|
|
|
|
update(sql);
|
|
|
|
|
}
|
|
|
|
|
public static void updateAll(String table, List<String> fields, String increment) throws GExcptSQL {
|
|
|
|
|
UpdateAll updateAll = new UpdateAll(table,fields,increment);
|
|
|
|
|
String sql = updateAll.getSQL();
|
|
|
|
|
update(sql);
|
|
|
|
|
}
|
|
|
|
|
public static List<String[]> query(String sql) throws Exception {
|
|
|
|
|
if(!ifInit) return null;
|
|
|
|
|
List<String[]> ls;
|
|
|
|
@ -198,7 +195,7 @@ public class DBManagement {
|
|
|
|
|
ls.add(s);
|
|
|
|
|
}
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GExcptSQL("Connect Failure");
|
|
|
|
|
throw new GExcptSQL("Connect Failure\n"+sql);
|
|
|
|
|
}finally {
|
|
|
|
|
if(con!=null) {
|
|
|
|
|
try {
|
|
|
|
@ -218,7 +215,7 @@ public class DBManagement {
|
|
|
|
|
Statement stmt = con.createStatement();
|
|
|
|
|
stmt.executeUpdate(sql);
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
throw new GExcptSQL("Connect Failure");
|
|
|
|
|
throw new GExcptSQL("Connect Failure\n"+sql);
|
|
|
|
|
}finally {
|
|
|
|
|
if(con!=null) {
|
|
|
|
|
try {
|
|
|
|
@ -229,4 +226,6 @@ public class DBManagement {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|