xyc
6 小时以前 1c9505d00bd076898cdc5a7d916106e175a91119
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- Configurable city-level track mileage source rules.
-- A matching enabled rule forces the configured city to use CITY_THIRD_PARTY rows
-- from effective_from_period through effective_to_period (inclusive). A NULL end
-- period means the rule remains effective.
CREATE TABLE IF NOT EXISTS track_mileage_city_source_rule (
    id BIGINT AUTO_INCREMENT PRIMARY KEY,
    city_name VARCHAR(50) NOT NULL COMMENT 'Normalized city name',
    effective_from_period VARCHAR(7) NOT NULL COMMENT 'First effective report period yyyy-MM',
    effective_to_period VARCHAR(7) NULL COMMENT 'Last effective report period; NULL means open-ended',
    enabled TINYINT NOT NULL DEFAULT 1 COMMENT '1 enabled, 0 disabled',
    remark VARCHAR(255) NULL,
    created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    UNIQUE KEY uk_track_mileage_city_source_rule (city_name, effective_from_period),
    KEY idx_track_mileage_city_source_rule_period
        (enabled, effective_from_period, effective_to_period)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='City track mileage source rules';
 
INSERT IGNORE INTO track_mileage_city_source_rule
    (city_name, effective_from_period, effective_to_period, enabled, remark)
VALUES
    ('孝感市', '2026-11', NULL, 1,
     'From 2026-11, Xiaogan above-scale enterprises use Xiaogan third-party track mileage');