|
|
@ -2,7 +2,6 @@ package dao;
|
|
|
|
|
|
|
|
|
|
|
|
import java.sql.*;
|
|
|
|
import java.sql.*;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
import java.util.Map;
|
|
|
|
import error.GExcptSQL;
|
|
|
|
import error.GExcptSQL;
|
|
|
@ -56,36 +55,49 @@ public class DBManagement {
|
|
|
|
"phone_number"
|
|
|
|
"phone_number"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
//<table1.x_id,table2.x_status>
|
|
|
|
//<table1.x_id,table2.x_status>
|
|
|
|
public static Map<String,String> graduationDesignStudentTables = new HashMap<>(){
|
|
|
|
public static String[][] graduationDesignStudentTables ={
|
|
|
|
{
|
|
|
|
{"graduation_design.student_id","graduation_design.student_choose_teacher_status"},
|
|
|
|
put("graduation_design.student_id","graduation_design.student_chooser_teacher_status");
|
|
|
|
{"graduation_design.student_id","graduation_design_information.student_fill_graduation_design_information_status"},
|
|
|
|
put("graduation_design.student_id","graduation_design_information.student_fill_graduation_design_information_status");
|
|
|
|
{"graduation_design.student_id","graduation_design_opening_report.opening_report_status"},
|
|
|
|
put("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"},
|
|
|
|
put("opening_report_secretary_team.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"},
|
|
|
|
put("opening_report_secretary_team.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"},
|
|
|
|
put("opening_report_secretary_team.student2_id","graduation_design_opening_report_opinion_record.opening_report_secretary_record_status");
|
|
|
|
{"graduation_design.student_id","graduation_design_finished_product.finished_product_status"},
|
|
|
|
put("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"},
|
|
|
|
put("reply_secretary_team.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"},
|
|
|
|
put("reply_secretary_team.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"}
|
|
|
|
put("reply_secretary_team.teacher2_id","graduation_design_reply_opinion_record_score.reply_ secretary_record_status");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
public static Map<String,String> graduationDesignTeacherTables = new HashMap<>(){
|
|
|
|
public static String[][] graduationDesignTeacherTables = {
|
|
|
|
{
|
|
|
|
{"graduation_design.teacher_id","graduation_design.teacher_choose_student_status"},
|
|
|
|
put("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"},
|
|
|
|
put("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"},
|
|
|
|
put("opening_report_teacher_team.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"},
|
|
|
|
put("opening_report_teacher_team.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"},
|
|
|
|
put("opening_report_teacher_team.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"},
|
|
|
|
put("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"},
|
|
|
|
put("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"},
|
|
|
|
put("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"},
|
|
|
|
put("reply_teacher_team.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"},
|
|
|
|
put("reply_teacher_team. 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"},
|
|
|
|
put("reply_teacher_team. 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"},
|
|
|
|
put("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"}
|
|
|
|
put("graduation_design_reply_opinion_record_score.reply_school_teacher_id","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";
|
|
|
|
public static String driverClassName="org.mariadb.jdbc.Driver";
|
|
|
|
|
|
|
|
|
|
|
@ -118,7 +130,7 @@ public class DBManagement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public static Map<String,String> getUserStatusTables(String userType){
|
|
|
|
public static String[][] getUserStatusTables(String userType){
|
|
|
|
if(userType.equals("student")){
|
|
|
|
if(userType.equals("student")){
|
|
|
|
return graduationDesignStudentTables;
|
|
|
|
return graduationDesignStudentTables;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -159,6 +171,11 @@ public class DBManagement {
|
|
|
|
String sql = update.getSQL();
|
|
|
|
String sql = update.getSQL();
|
|
|
|
update(sql);
|
|
|
|
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 {
|
|
|
|
public static List<String[]> query(String sql) throws Exception {
|
|
|
|
if(!ifInit) return null;
|
|
|
|
if(!ifInit) return null;
|
|
|
|
List<String[]> ls;
|
|
|
|
List<String[]> ls;
|
|
|
@ -178,7 +195,7 @@ public class DBManagement {
|
|
|
|
ls.add(s);
|
|
|
|
ls.add(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new GExcptSQL("Connect Failure");
|
|
|
|
throw new GExcptSQL("Connect Failure\n"+sql);
|
|
|
|
}finally {
|
|
|
|
}finally {
|
|
|
|
if(con!=null) {
|
|
|
|
if(con!=null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -198,7 +215,7 @@ public class DBManagement {
|
|
|
|
Statement stmt = con.createStatement();
|
|
|
|
Statement stmt = con.createStatement();
|
|
|
|
stmt.executeUpdate(sql);
|
|
|
|
stmt.executeUpdate(sql);
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
throw new GExcptSQL("Connect Failure");
|
|
|
|
throw new GExcptSQL("Connect Failure\n"+sql);
|
|
|
|
}finally {
|
|
|
|
}finally {
|
|
|
|
if(con!=null) {
|
|
|
|
if(con!=null) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
@ -209,4 +226,6 @@ public class DBManagement {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|