表名修改

This commit is contained in:
luojiaquan
2026-09-24 09:25:47 +08:00
parent f834dd785b
commit cef55c517e
34 changed files with 184 additions and 152 deletions
@@ -1,29 +1,29 @@
-- =============================================================
-- 角色额度池 + 客户信用额度有效期 改造
-- 1. customer_account 新增信用额度生效/失效日期(与临时额度口径一致,到期次日自动清零)
-- 2. customer_credit_apply 新增 approve_role_id,记录审批占用的额度池角色
-- 3. customer_credit_flow 新增 role_id,流水留痕额度池归属角色
-- 1. ctr_customer_account 新增信用额度生效/失效日期(与临时额度口径一致,到期次日自动清零)
-- 2. ctr_customer_credit_apply 新增 approve_role_id,记录审批占用的额度池角色
-- 3. ctr_customer_credit_flow 新增 role_id,流水留痕额度池归属角色
-- 4. 新表 sys_role_credit_quota:管理员为角色设置的可分配额度总额(额度池)
-- 5. 新表 customer_credit_grant:审批增量额度的占用台账(池余额=该表remaining求和)
-- 5. 新表 ctr_customer_credit_grant:审批增量额度的占用台账(池余额=该表remaining求和)
-- 2026-09-20
-- 说明:ALTER 语句非自动幂等,若字段/表已存在,对应语句会报 Duplicate/already exists,忽略即可
-- =============================================================
SET NAMES utf8mb4;
-- -------------------------------------------------------------
-- 1. customer_account:信用额度有效期
-- 1. ctr_customer_account:信用额度有效期
-- -------------------------------------------------------------
ALTER TABLE `customer_account`
ALTER TABLE `ctr_customer_account`
ADD COLUMN `credit_effective_date` DATE DEFAULT NULL COMMENT '信用额度生效日期' AFTER `total_credit`,
ADD COLUMN `credit_expire_date` DATE DEFAULT NULL COMMENT '信用额度失效日期(空=长期;到期次日清零)' AFTER `credit_effective_date`;
-- -------------------------------------------------------------
-- 2. customer_credit_apply / customer_credit_flow:额度池归属
-- 2. ctr_customer_credit_apply / ctr_customer_credit_flow:额度池归属
-- -------------------------------------------------------------
ALTER TABLE `customer_credit_apply`
ALTER TABLE `ctr_customer_credit_apply`
ADD COLUMN `approve_role_id` BIGINT(20) DEFAULT NULL COMMENT '审批占用的额度池角色ID(NULL=超管审批不占池)' AFTER `approve_user_id`;
ALTER TABLE `customer_credit_flow`
ALTER TABLE `ctr_customer_credit_flow`
ADD COLUMN `role_id` BIGINT(20) DEFAULT NULL COMMENT '额度池角色ID(审批调整流水留痕;NULL=超管/系统)' AFTER `operator_id`;
-- -------------------------------------------------------------
@@ -48,7 +48,7 @@ CREATE TABLE IF NOT EXISTS `sys_role_credit_quota` (
-- 角色池已用 = SUM(remaining WHERE role_id=? AND status='0')
-- role_id 为 NULL 表示超管审批(不占池)或历史/建档直配额度。
-- -------------------------------------------------------------
CREATE TABLE IF NOT EXISTS `customer_credit_grant` (
CREATE TABLE IF NOT EXISTS `ctr_customer_credit_grant` (
`grant_id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT '台账ID',
`customer_id` BIGINT(20) NOT NULL COMMENT '客户ID',
`account_id` BIGINT(20) NOT NULL COMMENT '客户账户ID',