-- Dashboard Service 数据库初始化脚本
-- 版本: 1.0.0
-- 描述: 初始化Dashboard相关表结构和基础数据

-- ============================================
-- 系统配置表初始化数据
-- ============================================

-- 租户配额配置
INSERT INTO system_configs (`group`, `key`, `value`, type, description, sort, status, created_at, updated_at) 
VALUES ('tenant_quota', 'monthly_order_limit', '1000', 'number', '月度订单限额', 1, 1, NOW(), NOW())
ON DUPLICATE KEY UPDATE value = VALUES(value), updated_at = NOW();

INSERT INTO system_configs (`group`, `key`, `value`, type, description, sort, status, created_at, updated_at) 
VALUES ('tenant_quota', 'daily_api_limit', '5000', 'number', '每日API调用限额', 2, 1, NOW(), NOW())
ON DUPLICATE KEY UPDATE value = VALUES(value), updated_at = NOW();

-- 库存预警配置
INSERT INTO system_configs (`group`, `key`, `value`, type, description, sort, status, created_at, updated_at) 
VALUES ('stock_alert_settings', 'global_threshold', '10', 'number', '全局库存预警阈值', 1, 1, NOW(), NOW())
ON DUPLICATE KEY UPDATE value = VALUES(value), updated_at = NOW();
