package com.rongyichuang;
|
|
import org.junit.jupiter.api.Test;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.test.context.ActiveProfiles;
|
|
import java.util.List;
|
import java.util.Map;
|
|
@SpringBootTest
|
@ActiveProfiles("test")
|
public class CheckJudgeTableTest {
|
|
@Autowired
|
private JdbcTemplate jdbcTemplate;
|
|
@Test
|
public void checkJudgeTableStructure() {
|
System.out.println("=== 检查t_judge表结构 ===");
|
|
try {
|
// 查看表结构
|
String describeTableSql = "DESCRIBE t_judge";
|
List<Map<String, Object>> columns = jdbcTemplate.queryForList(describeTableSql);
|
|
System.out.println("t_judge表字段:");
|
for (Map<String, Object> column : columns) {
|
System.out.println(" 字段名: " + column.get("Field") +
|
", 类型: " + column.get("Type") +
|
", 是否为空: " + column.get("Null") +
|
", 默认值: " + column.get("Default"));
|
}
|
|
// 查看现有的评委记录
|
String selectJudgesSql = "SELECT * FROM t_judge LIMIT 3";
|
List<Map<String, Object>> judges = jdbcTemplate.queryForList(selectJudgesSql);
|
|
System.out.println("\n现有评委记录示例:");
|
for (Map<String, Object> judge : judges) {
|
System.out.println(" " + judge);
|
}
|
|
} catch (Exception e) {
|
System.out.println("检查表结构时发生异常: " + e.getMessage());
|
e.printStackTrace();
|
}
|
}
|
}
|