feat:钱包的流水增加"备注字段"
fix:合并设备管理的统计模块
This commit is contained in:
1 parent
d1cd86dfa4
commit
9d2a0ee1ab
49 files changed
+1943
-424
No files matched your search
@@ -31,8 +31,8 @@ CREATE TABLE IF NOT EXISTS `third_payment_task`
|
||||
`del_flag` char(1) NOT NULL DEFAULT '0' COMMENT '逻辑删除标记',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_third_payment_task_tenant_key` (`tenant_id`, `task_key`),
|
||||
KEY `idx_third_payment_task_due` (`status`, `next_run_time`, `priority`, `id`),
|
||||
KEY `idx_third_payment_task_lease` (`status`, `lease_expire_time`),
|
||||
KEY `idx_third_payment_task_due` (`task_type`, `status`, `next_run_time`, `priority`, `id`),
|
||||
KEY `idx_third_payment_task_lease` (`task_type`, `status`, `lease_expire_time`),
|
||||
KEY `idx_third_payment_task_pay_no` (`tenant_id`, `pay_no`),
|
||||
KEY `idx_third_payment_task_fz_no` (`tenant_id`, `fz_no`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '第三方支付任务事实';
|
||||
@@ -57,3 +57,97 @@ CREATE TABLE IF NOT EXISTS `third_payment_task_attempt`
|
||||
KEY `idx_third_payment_attempt_task` (`task_id`, `attempt_no`),
|
||||
KEY `idx_third_payment_attempt_tenant_time` (`tenant_id`, `started_time`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '第三方支付任务执行尝试';
|
||||
|
||||
-- Quartz 会按业务事实持续物化任务。百万级订单量下,如果业务表只有主键,每个固定触发器都会退化为全表扫描。
|
||||
-- 以下索引只覆盖实际扫描谓词和租户内业务号关联;使用 information_schema 判断保证迁移可以重复执行。
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_pay_order' AND index_name = 'idx_third_pay_order_task_scan'),
|
||||
'SELECT ''idx_third_pay_order_task_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_pay_order` ADD INDEX `idx_third_pay_order_task_scan` (`status`, `del_flag`, `pay_platform_type`, `update_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_pay_order' AND index_name = 'idx_third_pay_order_fz_scan'),
|
||||
'SELECT ''idx_third_pay_order_fz_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_pay_order` ADD INDEX `idx_third_pay_order_fz_scan` (`status`, `enable_fz`, `del_flag`, `pay_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_pay_order' AND index_name = 'idx_third_pay_order_callback_scan'),
|
||||
'SELECT ''idx_third_pay_order_callback_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_pay_order` ADD INDEX `idx_third_pay_order_callback_scan` (`status`, `is_biz_callback`, `del_flag`, `update_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_pay_order' AND index_name = 'idx_third_pay_order_close_scan'),
|
||||
'SELECT ''idx_third_pay_order_close_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_pay_order` ADD INDEX `idx_third_pay_order_close_scan` (`status`, `biz_type`, `del_flag`, `create_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_pay_order' AND index_name = 'idx_third_pay_order_tenant_pay_no'),
|
||||
'SELECT ''idx_third_pay_order_tenant_pay_no already exists'' AS message',
|
||||
'ALTER TABLE `third_pay_order` ADD INDEX `idx_third_pay_order_tenant_pay_no` (`tenant_id`, `pay_no`, `del_flag`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_fz_order' AND index_name = 'idx_third_fz_order_task_scan'),
|
||||
'SELECT ''idx_third_fz_order_task_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_fz_order` ADD INDEX `idx_third_fz_order_task_scan` (`status`, `del_flag`, `update_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_fz_order' AND index_name = 'idx_third_fz_order_tenant_pay_no'),
|
||||
'SELECT ''idx_third_fz_order_tenant_pay_no already exists'' AS message',
|
||||
'ALTER TABLE `third_fz_order` ADD INDEX `idx_third_fz_order_tenant_pay_no` (`tenant_id`, `pay_no`, `del_flag`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_aggregate_pay_session' AND index_name = 'idx_third_aggregate_task_scan'),
|
||||
'SELECT ''idx_third_aggregate_task_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_aggregate_pay_session` ADD INDEX `idx_third_aggregate_task_scan` (`status`, `del_flag`, `update_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
SET @index_ddl = IF(
|
||||
EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema = DATABASE()
|
||||
AND table_name = 'third_aggregate_pay_session' AND index_name = 'idx_third_aggregate_close_scan'),
|
||||
'SELECT ''idx_third_aggregate_close_scan already exists'' AS message',
|
||||
'ALTER TABLE `third_aggregate_pay_session` ADD INDEX `idx_third_aggregate_close_scan` (`status`, `del_flag`, `create_time`, `id`)'
|
||||
);
|
||||
PREPARE index_stmt FROM @index_ddl;
|
||||
EXECUTE index_stmt;
|
||||
DEALLOCATE PREPARE index_stmt;
|
||||
|
||||
-- 生产执行建议:低峰期使用在线 DDL 能力建索引,完成后 ANALYZE TABLE 并用真实状态分布执行 EXPLAIN ANALYZE。
|
||||
Reference in new issue
Block a user