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 CheckJudgeDataTest {
|
|
@Autowired
|
private JdbcTemplate jdbcTemplate;
|
|
@Test
|
public void checkJudgeData() {
|
// 检查评委表结构
|
String describeTableSql = "DESCRIBE t_judge";
|
List<Map<String, Object>> tableStructure = jdbcTemplate.queryForList(describeTableSql);
|
|
System.out.println("=== t_judge 表结构 ===");
|
for (Map<String, Object> column : tableStructure) {
|
System.out.println("字段: " + column.get("Field") +
|
", 类型: " + column.get("Type") +
|
", 是否为空: " + column.get("Null") +
|
", 键: " + column.get("Key") +
|
", 默认值: " + column.get("Default"));
|
}
|
|
// 检查评委数据
|
String countSql = "SELECT COUNT(*) as count FROM t_judge";
|
Map<String, Object> countResult = jdbcTemplate.queryForMap(countSql);
|
System.out.println("\n=== 评委数据统计 ===");
|
System.out.println("评委总数: " + countResult.get("count"));
|
|
// 查看前5条评委数据
|
String dataSql = "SELECT * FROM t_judge LIMIT 5";
|
List<Map<String, Object>> judgeData = jdbcTemplate.queryForList(dataSql);
|
System.out.println("\n=== 前5条评委数据 ===");
|
for (Map<String, Object> judge : judgeData) {
|
System.out.println("ID: " + judge.get("id") +
|
", 姓名: " + judge.get("name") +
|
", 用户ID: " + judge.get("user_id") +
|
", 状态: " + judge.get("state"));
|
}
|
}
|
}
|