-- ----------------------------
|
-- 公司优惠设置表(公司管理-优惠设置)
|
-- 创建日期: 2026-09-28
|
-- 库: charging_pile_other
|
-- 说明: 一个公司一条优惠设置,保存时覆盖;本次仅提供配置存储与读写接口,
|
-- 实际优惠计算/扣费链路改造不在本脚本范围内。
|
-- Mycat 环境可直接执行(无存储过程、无 SET 变量)。
|
-- ----------------------------
|
USE `charging_pile_other`;
|
|
CREATE TABLE IF NOT EXISTS `t_company_preferential` (
|
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
`company_id` int NOT NULL COMMENT '配置所属公司ID(关联t_group_company.id,一个公司一条配置)',
|
`preferential_type` tinyint NOT NULL DEFAULT 1 COMMENT '优惠方式(1=不优惠,2=按比例优惠,3=按优惠单价收费)',
|
`service_discount_rate` decimal(5,2) NULL DEFAULT NULL COMMENT '服务费优惠比例(%,仅按比例优惠时使用,其他方式存NULL)',
|
`billing_template_id` int NULL DEFAULT NULL COMMENT '计费模板ID(t_billing_template.id,仅按优惠单价收费时使用,其他方式存NULL)',
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
`del_flag` int NULL DEFAULT 0 COMMENT '删除(0=否,1=是)',
|
PRIMARY KEY (`id`),
|
UNIQUE KEY `uk_company_id` (`company_id`) USING BTREE
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='公司优惠设置';
|