| | |
| | | // 主管理逻辑 |
| | | private static void manageTables() { |
| | | try { |
| | | // 0. 创建当天的表(如果不存在) |
| | | createTodayTableIfNotExists(); |
| | | |
| | | // 1. 创建未来3天的表 |
| | | createFutureTables(); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // 创建当天的表(如果不存在) |
| | | private static void createTodayTableIfNotExists() throws SQLException { |
| | | String today = LocalDate.now().format(DATE_FORMATTER); |
| | | String tableName = TABLE_PREFIX + today; |
| | | if (!tableExists(tableName)) { |
| | | DBConnector.executeUpdate(getcreateSQL(tableName)); |
| | | } |
| | | } |
| | | |
| | | // 创建未来3天的表(包括明天、后天和大后天) |
| | | private static void createFutureTables() throws SQLException { |
| | | for (int i = 1; i <= 3; i++) { |