import java.util.Random; import java.util.Date;

public class RecordGenerator { public static void main(String[] args) { Random random = new Random();

    for (int i = 0; i < 10000; i++) {
        // 生成入账时间
        long startTime = 1627123200000L; // 2021-07-24 00:00:00
        long endTime = 1627708799000L; // 2021-07-30 23:59:59
        long randomTime = startTime + (long) (random.nextDouble() * (endTime - startTime));
        Date date = new Date(randomTime);
        
        // 生成金额
        int amount = random.nextInt(100) + 1;
        
        // 生成关联的窗口
        int windowId = random.nextInt(10) + 1;
        
        // 插入记录
        insertRecord(date, amount, windowId);
    }
}

public static void insertRecord(Date date, int amount, int windowId) {
    // 实现记录插入的逻辑
    // ...
}
java4、【15分】完成向记录表添加10000条记录详细要求: 入账时间为上一周7-24到7-30的任意时间年月日时分秒 金额从1-100随机 关联的窗口为表中的任意窗口随机

原文地址: https://www.cveoy.top/t/topic/ioQm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录