lrj
6 天以前 7ba080d35812e6db7bd5aa8f88161c02653eb6c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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;
 
@SpringBootTest
@ActiveProfiles("test")
public class SetupActivityJudgeTest {
 
    @Autowired
    private JdbcTemplate jdbcTemplate;
 
    @Test
    public void setupActivityJudge() {
        // 为评委ID为21的评委添加活动ID为1的关联记录
        String insertSql = "INSERT INTO t_activity_judge (activity_id, stage_id, judge_id, state) VALUES (1, 1, 21, 1)";
        int insertedRows = jdbcTemplate.update(insertSql);
        
        System.out.println("插入了 " + insertedRows + " 条活动评委关联记录");
        
        // 验证插入结果
        String verifySql = "SELECT * FROM t_activity_judge WHERE activity_id = 1 AND judge_id = 21";
        jdbcTemplate.queryForList(verifySql).forEach(row -> {
            System.out.println("活动ID: " + row.get("activity_id") + 
                             ", 评委ID: " + row.get("judge_id") + 
                             ", 阶段ID: " + row.get("stage_id") + 
                             ", 状态: " + row.get("state"));
        });
    }
}