feat: 实现分类管理功能,包括数据模型、仓库层、服务层和数据库初始化脚本
This commit is contained in:
@@ -88,6 +88,7 @@ CREATE TABLE IF NOT EXISTS `categories` (
|
||||
`user_id` bigint(20) unsigned NOT NULL,
|
||||
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`icon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`color` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`parent_id` bigint(20) unsigned DEFAULT NULL,
|
||||
`sort_order` bigint(20) DEFAULT '0',
|
||||
@@ -98,6 +99,7 @@ CREATE TABLE IF NOT EXISTS `categories` (
|
||||
CONSTRAINT `fk_categories_parent` FOREIGN KEY (`parent_id`) REFERENCES `categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
|
||||
-- Tags table
|
||||
CREATE TABLE IF NOT EXISTS `tags` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
@@ -221,6 +223,25 @@ CREATE TABLE IF NOT EXISTS `system_categories` (
|
||||
UNIQUE KEY `idx_system_categories_code` (`code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Default Categories Template table (for new user initialization)
|
||||
-- This table stores category templates that will be copied to new users
|
||||
CREATE TABLE IF NOT EXISTS `default_categories` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`icon` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`color` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`parent_id` bigint(20) unsigned DEFAULT NULL,
|
||||
`sort_order` bigint(20) DEFAULT '0',
|
||||
`is_active` tinyint(1) DEFAULT '1',
|
||||
`created_at` datetime(3) DEFAULT NULL,
|
||||
`updated_at` datetime(3) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `idx_default_categories_parent_id` (`parent_id`),
|
||||
KEY `idx_default_categories_type` (`type`),
|
||||
CONSTRAINT `fk_default_categories_parent` FOREIGN KEY (`parent_id`) REFERENCES `default_categories` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- Budgets table
|
||||
CREATE TABLE IF NOT EXISTS `budgets` (
|
||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
||||
Reference in New Issue
Block a user