【修改】表名判断
This commit is contained in:
@@ -195,6 +195,7 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
|
||||
boolean tableExists = false;
|
||||
//学生语句
|
||||
String stuSQL = null;
|
||||
String yuju=null;
|
||||
try (Connection connstu = DriverManager.getConnection(stuDbUrl, user, password);
|
||||
Statement stmtstu = connstu.createStatement()) {
|
||||
try (ResultSet rsstu = stmtstu.executeQuery(sql2)) {
|
||||
@@ -219,10 +220,11 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
|
||||
column.put("EXTRA", rsstu.getString("EXTRA"));
|
||||
table2Columns.add(column);
|
||||
} while (rsstu.next());
|
||||
|
||||
yuju = compareTables(table1Columns, table2Columns, stuDataName, tableName, tableName, judgementStr);
|
||||
} else {
|
||||
// 表不存在时的处理逻辑
|
||||
System.out.println("表 " + tableName + " 在学生数据库中不存在");
|
||||
yuju = compareTables(table1Columns, table2Columns, stuDataName, tableName, null, judgementStr);
|
||||
|
||||
|
||||
}
|
||||
@@ -231,7 +233,6 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
|
||||
}
|
||||
}
|
||||
|
||||
String yuju = compareTables(table1Columns, table2Columns, stuDataName, tableName, tableName, judgementStr);
|
||||
judgementStr = yuju;
|
||||
|
||||
|
||||
@@ -1218,8 +1219,15 @@ public class IMysqlLocalServiceImpl implements IMysqlLocalService {
|
||||
private static String compareTables(Set<Map<String, String>> standardSet, Set<Map<String, String>> studentSet, String dbTable, String tableName, String tableNameStu, String judgementStr) {
|
||||
int index = 1;
|
||||
// 判断表名是否一致
|
||||
String tableNameCheck = tableName.equalsIgnoreCase(tableNameStu) ? "✔" : "x";
|
||||
String tableNameCheckOther = tableName.equalsIgnoreCase(tableNameStu) ? "✅" : "❌";
|
||||
String tableNameCheck=null;
|
||||
String tableNameCheckOther=null;
|
||||
if (tableNameStu==null){
|
||||
tableNameCheck = "x";
|
||||
tableNameCheckOther = "❌";
|
||||
}else {
|
||||
tableNameCheck = tableName.equalsIgnoreCase(tableNameStu) ? "✔" : "x";
|
||||
tableNameCheckOther = tableName.equalsIgnoreCase(tableNameStu) ? "✅" : "❌";
|
||||
}
|
||||
// 输出
|
||||
System.out.printf("%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
|
||||
appendToFile(answerLogPath, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
|
||||
|
Reference in New Issue
Block a user