From 8638c26db1c052b89c9ba789a9a10ee5ef3982c8 Mon Sep 17 00:00:00 2001 From: Wu Clan Date: Fri, 20 Jun 2025 20:31:44 +0800 Subject: [PATCH] Add the snowflake ID sql script (#675) --- backend/sql/mysql/create_tables.sql | 435 --------- .../sql/mysql/init_snowflake_test_data.sql | 109 +++ backend/sql/postgresql/create_tables.sql | 908 ------------------ .../postgresql/init_snowflake_test_data.sql | 109 +++ 4 files changed, 218 insertions(+), 1343 deletions(-) delete mode 100644 backend/sql/mysql/create_tables.sql create mode 100644 backend/sql/mysql/init_snowflake_test_data.sql delete mode 100644 backend/sql/postgresql/create_tables.sql create mode 100644 backend/sql/postgresql/init_snowflake_test_data.sql diff --git a/backend/sql/mysql/create_tables.sql b/backend/sql/mysql/create_tables.sql deleted file mode 100644 index 16d5d3d7..00000000 --- a/backend/sql/mysql/create_tables.sql +++ /dev/null @@ -1,435 +0,0 @@ -create table gen_business -( - id bigint auto_increment comment '主键 ID' - primary key, - app_name varchar(50) not null comment '应用名称(英文)', - table_name varchar(255) not null comment '表名称(英文)', - doc_comment varchar(255) not null comment '文档注释(用于函数/参数文档)', - table_comment varchar(255) null comment '表描述', - class_name varchar(50) null comment '基础类名(默认为英文表名称)', - schema_name varchar(50) null comment 'Schema 名称 (默认为英文表名称)', - filename varchar(50) null comment '基础文件名(默认为英文表名称)', - default_datetime_column tinyint(1) not null comment '是否存在默认时间列', - api_version varchar(20) not null comment '代码生成 api 版本,默认为 v1', - gen_path varchar(255) null comment '代码生成路径(默认为 app 根路径)', - remark longtext null comment '备注', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_gen_business_id - unique (id), - constraint table_name - unique (table_name) -) - comment '代码生成业务表'; - -create table gen_column -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(50) not null comment '列名称', - comment varchar(255) null comment '列描述', - type varchar(20) not null comment 'SQLA 模型列类型', - pd_type varchar(20) not null comment '列类型对应的 pydantic 类型', - `default` longtext null comment '列默认值', - sort int null comment '列排序', - length int not null comment '列长度', - is_pk tinyint(1) not null comment '是否主键', - is_nullable tinyint(1) not null comment '是否可为空', - gen_business_id bigint not null comment '代码生成业务ID', - constraint ix_gen_column_id - unique (id), - constraint gen_column_ibfk_1 - foreign key (gen_business_id) references gen_business (id) - on delete cascade -) - comment '代码生成模型列表'; - -create index gen_business_id - on gen_column (gen_business_id); - -create table sys_config -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(20) not null comment '名称', - type varchar(20) null comment '类型', - `key` varchar(50) not null comment '键名', - value longtext not null comment '键值', - is_frontend tinyint(1) not null comment '是否前端', - remark longtext null comment '备注', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_config_id - unique (id), - constraint `key` - unique (`key`) -) - comment '参数配置表'; - -create table sys_data_rule -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(500) not null comment '名称', - model varchar(50) not null comment 'SQLA 模型名,对应 DATA_PERMISSION_MODELS 键名', - `column` varchar(20) not null comment '模型字段名', - operator int not null comment '运算符(0:and、1:or)', - expression int not null comment '表达式(0:==、1:!=、2:>、3:>=、4:<、5:<=、6:in、7:not_in)', - value varchar(255) not null comment '规则值', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_data_rule_id - unique (id), - constraint name - unique (name) -) - comment '数据规则表'; - -create table sys_data_scope -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(50) not null comment '名称', - status int not null comment '状态(0停用 1正常)', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_data_scope_id - unique (id), - constraint name - unique (name) -) - comment '数据范围表'; - -create table sys_data_scope_rule -( - id bigint auto_increment comment '主键ID', - data_scope_id bigint not null comment '数据范围 ID', - data_rule_id bigint not null comment '数据规则 ID', - primary key (id, data_scope_id, data_rule_id), - constraint ix_sys_data_scope_rule_id - unique (id), - constraint sys_data_scope_rule_ibfk_1 - foreign key (data_scope_id) references sys_data_scope (id) - on delete cascade, - constraint sys_data_scope_rule_ibfk_2 - foreign key (data_rule_id) references sys_data_rule (id) - on delete cascade -); - -create index data_rule_id - on sys_data_scope_rule (data_rule_id); - -create index data_scope_id - on sys_data_scope_rule (data_scope_id); - -create table sys_dept -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(50) not null comment '部门名称', - sort int not null comment '排序', - leader varchar(20) null comment '负责人', - phone varchar(11) null comment '手机', - email varchar(50) null comment '邮箱', - status int not null comment '部门状态(0停用 1正常)', - del_flag tinyint(1) not null comment '删除标志(0删除 1存在)', - parent_id bigint null comment '父部门ID', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_dept_id - unique (id), - constraint sys_dept_ibfk_1 - foreign key (parent_id) references sys_dept (id) - on delete set null -) - comment '部门表'; - -create index ix_sys_dept_parent_id - on sys_dept (parent_id); - -create table sys_dict_type -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(32) not null comment '字典类型名称', - code varchar(32) not null comment '字典类型编码', - status int not null comment '状态(0停用 1正常)', - remark longtext null comment '备注', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint code - unique (code), - constraint ix_sys_dict_type_id - unique (id) -) - comment '字典类型表'; - -create table sys_dict_data -( - id bigint auto_increment comment '主键 ID' - primary key, - label varchar(32) not null comment '字典标签', - value varchar(32) not null comment '字典值', - sort int not null comment '排序', - status int not null comment '状态(0停用 1正常)', - remark longtext null comment '备注', - type_id bigint not null comment '字典类型关联ID', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_dict_data_id - unique (id), - constraint label - unique (label), - constraint sys_dict_data_ibfk_1 - foreign key (type_id) references sys_dict_type (id) - on delete cascade -) - comment '字典数据表'; - -create index type_id - on sys_dict_data (type_id); - -create table sys_login_log -( - id bigint not null comment '雪花算法主键 ID' - primary key, - user_uuid varchar(50) not null comment '用户UUID', - username varchar(20) not null comment '用户名', - status int not null comment '登录状态(0失败 1成功)', - ip varchar(50) not null comment '登录IP地址', - country varchar(50) null comment '国家', - region varchar(50) null comment '地区', - city varchar(50) null comment '城市', - user_agent varchar(255) not null comment '请求头', - os varchar(50) null comment '操作系统', - browser varchar(50) null comment '浏览器', - device varchar(50) null comment '设备', - msg longtext not null comment '提示消息', - login_time datetime not null comment '登录时间', - created_time datetime not null comment '创建时间', - constraint ix_sys_login_log_id - unique (id) -) - comment '登录日志表'; - -create table sys_menu -( - id bigint auto_increment comment '主键 ID' - primary key, - title varchar(50) not null comment '菜单标题', - name varchar(50) not null comment '菜单名称', - path varchar(200) null comment '路由地址', - sort int not null comment '排序', - icon varchar(100) null comment '菜单图标', - type int not null comment '菜单类型(0目录 1菜单 2按钮 3内嵌 4外链)', - component varchar(255) null comment '组件路径', - perms varchar(100) null comment '权限标识', - status int not null comment '菜单状态(0停用 1正常)', - display int not null comment '是否显示(0否 1是)', - cache int not null comment '是否缓存(0否 1是)', - link longtext null comment '外链地址', - remark longtext null comment '备注', - parent_id bigint null comment '父菜单ID', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_menu_id - unique (id), - constraint sys_menu_ibfk_1 - foreign key (parent_id) references sys_menu (id) - on delete set null -) - comment '菜单表'; - -create index ix_sys_menu_parent_id - on sys_menu (parent_id); - -create table sys_notice -( - id bigint auto_increment comment '主键 ID' - primary key, - title varchar(50) not null comment '标题', - type int not null comment '类型(0:通知、1:公告)', - author varchar(16) not null comment '作者', - source varchar(50) not null comment '信息来源', - status int not null comment '状态(0:隐藏、1:显示)', - content longtext not null comment '内容', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_notice_id - unique (id) -) - comment '系统通知公告表'; - -create table sys_opera_log -( - id bigint auto_increment comment '主键 ID' - primary key, - trace_id varchar(32) not null comment '请求跟踪 ID', - username varchar(20) null comment '用户名', - method varchar(20) not null comment '请求类型', - title varchar(255) not null comment '操作模块', - path varchar(500) not null comment '请求路径', - ip varchar(50) not null comment 'IP地址', - country varchar(50) null comment '国家', - region varchar(50) null comment '地区', - city varchar(50) null comment '城市', - user_agent varchar(255) not null comment '请求头', - os varchar(50) null comment '操作系统', - browser varchar(50) null comment '浏览器', - device varchar(50) null comment '设备', - args json null comment '请求参数', - status int not null comment '操作状态(0异常 1正常)', - code varchar(20) not null comment '操作状态码', - msg longtext null comment '提示消息', - cost_time float not null comment '请求耗时(ms)', - opera_time datetime not null comment '操作时间', - created_time datetime not null comment '创建时间', - constraint ix_sys_opera_log_id - unique (id) -) - comment '操作日志表'; - -create table sys_role -( - id bigint auto_increment comment '主键 ID' - primary key, - name varchar(20) not null comment '角色名称', - status int not null comment '角色状态(0停用 1正常)', - is_filter_scopes tinyint(1) not null comment '过滤数据权限(0否 1是)', - remark longtext null comment '备注', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_role_id - unique (id), - constraint name - unique (name) -) - comment '角色表'; - -create table sys_role_data_scope -( - id bigint auto_increment comment '主键 ID', - role_id bigint not null comment '角色 ID', - data_scope_id bigint not null comment '数据范围 ID', - primary key (id, role_id, data_scope_id), - constraint ix_sys_role_data_scope_id - unique (id), - constraint sys_role_data_scope_ibfk_1 - foreign key (role_id) references sys_role (id) - on delete cascade, - constraint sys_role_data_scope_ibfk_2 - foreign key (data_scope_id) references sys_data_scope (id) - on delete cascade -); - -create index data_scope_id - on sys_role_data_scope (data_scope_id); - -create index role_id - on sys_role_data_scope (role_id); - -create table sys_role_menu -( - id bigint auto_increment comment '主键ID', - role_id bigint not null comment '角色ID', - menu_id bigint not null comment '菜单ID', - primary key (id, role_id, menu_id), - constraint ix_sys_role_menu_id - unique (id), - constraint sys_role_menu_ibfk_1 - foreign key (role_id) references sys_role (id) - on delete cascade, - constraint sys_role_menu_ibfk_2 - foreign key (menu_id) references sys_menu (id) - on delete cascade -); - -create index menu_id - on sys_role_menu (menu_id); - -create index role_id - on sys_role_menu (role_id); - -create table sys_user -( - id bigint auto_increment comment '主键 ID' - primary key, - uuid varchar(50) not null, - username varchar(20) not null comment '用户名', - nickname varchar(20) not null comment '昵称', - password varchar(255) not null comment '密码', - salt varbinary(255) not null comment '加密盐', - email varchar(50) null comment '邮箱', - phone varchar(11) null comment '手机号', - avatar varchar(255) null comment '头像', - status int not null comment '用户账号状态(0停用 1正常)', - is_superuser tinyint(1) not null comment '超级权限(0否 1是)', - is_staff tinyint(1) not null comment '后台管理登陆(0否 1是)', - is_multi_login tinyint(1) not null comment '是否重复登陆(0否 1是)', - join_time datetime not null comment '注册时间', - last_login_time datetime null comment '上次登录', - dept_id bigint null comment '部门关联ID', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_user_email - unique (email), - constraint ix_sys_user_id - unique (id), - constraint ix_sys_user_username - unique (username), - constraint uuid - unique (uuid), - constraint sys_user_ibfk_1 - foreign key (dept_id) references sys_dept (id) - on delete set null -) - comment '用户表'; - -create index dept_id - on sys_user (dept_id); - -create index ix_sys_user_status - on sys_user (status); - -create table sys_user_role -( - id bigint auto_increment comment '主键ID', - user_id bigint not null comment '用户ID', - role_id bigint not null comment '角色ID', - primary key (id, user_id, role_id), - constraint ix_sys_user_role_id - unique (id), - constraint sys_user_role_ibfk_1 - foreign key (user_id) references sys_user (id) - on delete cascade, - constraint sys_user_role_ibfk_2 - foreign key (role_id) references sys_role (id) - on delete cascade -); - -create index role_id - on sys_user_role (role_id); - -create index user_id - on sys_user_role (user_id); - -create table sys_user_social -( - id bigint auto_increment comment '主键 ID' - primary key, - sid varchar(20) not null comment '第三方用户 ID', - source varchar(20) not null comment '第三方用户来源', - user_id bigint not null comment '用户关联ID', - created_time datetime not null comment '创建时间', - updated_time datetime null comment '更新时间', - constraint ix_sys_user_social_id - unique (id), - constraint sys_user_social_ibfk_1 - foreign key (user_id) references sys_user (id) - on delete cascade -) - comment '用户社交表(OAuth2)'; - -create index user_id - on sys_user_social (user_id); - diff --git a/backend/sql/mysql/init_snowflake_test_data.sql b/backend/sql/mysql/init_snowflake_test_data.sql new file mode 100644 index 00000000..c9615348 --- /dev/null +++ b/backend/sql/mysql/init_snowflake_test_data.sql @@ -0,0 +1,109 @@ +insert into sys_dept (id, name, sort, leader, phone, email, status, del_flag, parent_id, created_time, updated_time) +values (2047437108473364480, '测试', 0, null, null, null, 1, 0, null, '2025-05-26 17:13:45', null); + +insert into sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time) +values (2047437108502724608, '概览', 'Dashboard', 'dashboard', 0, 'ant-design:dashboard-outlined', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:26:18', null), + (2047437108569833472, '系统管理', 'System', 'system', 1, 'eos-icons:admin', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:30:01', null), + (2047437108632748032, '系统自动化', 'Automation', 'automation', 2, 'material-symbols:automation', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:31:41', null), + (2047437108699856896, '日志管理', 'Log', 'log', 3, 'carbon:cloud-logging', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:32:34', null), + (2047437108766965760, '系统监控', 'Monitor', 'monitor', 4, 'mdi:monitor-eye', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:33:29', null), + (2047437108834074624, '项目', 'Project', 'fba', 5, 'https://wu-clan.github.io/picx-images-hosting/logo/fba.png', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:35:41', null), + (2047437108901183488, '分析页', 'Analytics', 'analytics', 0, 'lucide:area-chart', 1, '/dashboard/analytics/index', null, 1, 1, 1, '', null, 2047437108502724608, '2025-06-09 17:54:29', null), + (2047437108968292352, '工作台', 'Workspace', 'workspace', 1, 'carbon:workspace', 1, '/dashboard/workspace/index', null, 1, 1, 1, '', null, 2047437108502724608, '2025-06-09 17:57:09', null), + (2047437109035401216, '文档', 'Document', 'document', 1, 'lucide:book-open-text', 4, '/_core/fallback/iframe.vue', null, 1, 1, 1, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs', null, 2047437108834074624, '2025-06-09 17:59:44', null), + (2047437109102510080, 'Github', 'Github', 'github', 2, 'ant-design:github-filled', 4, '/_core/fallback/iframe.vue', null, 1, 1, 1, 'https://github.com/fastapi-practices/fastapi_best_architecture', null, 2047437108834074624, '2025-06-09 18:00:50', null), + (2047437109169618944, 'Apifox', 'Apifox', 'apifox', 3, 'simple-icons:apifox', 3, '/_core/fallback/iframe.vue', null, 1, 1, 1, 'https://apifox.com/apidoc/shared-28a93f02-730b-4f33-bb5e-4dad92058cc0', null, 2047437108834074624, '2025-06-09 18:01:39', null), + (2047437109236727808, '部门管理', 'SysDept', 'sys-dept', 1, 'mingcute:department-line', 1, '/system/dept/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:03:17', null), + (2047437109303836672, '用户管理', 'SysUser', 'sys-user', 2, 'ant-design:user-outlined', 1, '/system/user/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:03:54', null), + (2047437109366751232, '角色管理', 'SysRole', 'sys-role', 3, 'carbon:user-role', 1, '/system/role/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:04:47', null), + (2047437109429665792, '菜单管理', 'SysMenu', 'sys-menu', 4, 'ant-design:menu-outlined', 1, '/system/menu/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:05:31', null), + (2047437109496774656, '数据权限', 'SysDataPermission', 'sys-data-permission', 5, 'icon-park-outline:permissions', 0, null, null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:07:04', null), + (2047437109563883520, '数据范围', 'SysDataScope', 'sys-data-scope', 6, 'cuida:scope-outline', 1, '/system/data-permission/scope/index', null, 1, 1, 1, '', null, 2047437109496774656, '2025-06-09 18:07:46', null), + (2047437109630992384, '数据规则', 'SysDataRule', 'sys-data-rule', 7, 'material-symbols:rule', 1, '/system/data-permission/rule/index', null, 1, 1, 1, '', null, 2047437109496774656, '2025-06-09 18:08:22', null), + (2047437109698101248, '插件管理', 'SysPlugin', 'sys-plugin', 8, 'clarity:plugin-line', 1, '/system/plugin/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:09:12', null), + (2047437109761015808, '参数管理', 'SysConfig', 'sys-config', 9, 'codicon:symbol-parameter', 1, '/system/config/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:10:20', null), + (2047437109828124672, '字典管理', 'SysDict', 'sys-dict', 10, 'fluent-mdl2:dictionary', 1, '/system/dict/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:11:10', null), + (2047437109891039232, '通知公告', 'SysNotice', 'sys-notice', 11, 'fe:notice-push', 1, '/system/notice/index', null, 1, 1, 1, '', null, 2047437108569833472, '2025-06-09 18:11:38', null), + (2047437109958148096, '代码生成', 'CodeGenerator', 'code-generator', 1, 'tabler:code', 1, '/automation/code-generator/index', null, 1, 1, 1, '', null, 2047437108632748032, '2025-06-09 18:12:38', null), + (2047437110025256960, '任务调度', 'Scheduler', 'scheduler', 2, 'ix:scheduler', 1, '/automation/scheduler/index', null, 1, 1, 1, '', null, 2047437108632748032, '2025-06-09 18:13:19', null), + (2047437110092365824, '登录日志', 'LoginLog', 'login', 1, 'mdi:login', 1, '/log/login/index', null, 1, 1, 1, '', null, 2047437108699856896, '2025-06-09 18:14:35', null), + (2047437110159474688, '操作日志', 'OperaLog', 'opera', 2, 'carbon:operations-record', 1, '/log/opera/index', null, 1, 1, 1, '', null, 2047437108699856896, '2025-06-09 18:15:26', null), + (2047437110226583552, '在线用户', 'Online', 'online', 1, 'wpf:online', 1, '/monitor/online/index', null, 1, 1, 1, '', null, 2047437108766965760, '2025-06-09 18:17:12', null), + (2047437110293692416, 'Redis', 'Redis', 'redis', 2, 'devicon:redis', 1, '/monitor/redis/index', null, 1, 1, 1, '', null, 2047437108766965760, '2025-06-09 18:17:42', null), + (2047437110360801280, 'Server', 'Server', 'server', 3, 'mdi:server-outline', 1, '/monitor/server/index', null, 1, 1, 1, '', null, 2047437108766965760, '2025-06-09 18:18:12', null), + (2047437110427910144, '个人中心', 'Profile', 'profile', 6, 'ant-design:profile-outlined', 1, '/_core/profile/index', null, 1, 0, 1, '', null, null, '2025-06-09 18:18:12', null), + (2047437110495019008, '新增', 'AddSysDept', null, 0, null, 2, null, 'sys:dept:add', 1, 0, 1, '', null, 2047437109236727808, '2025-06-09 18:21:17', null), + (2047437110562127872, '修改', 'EditSysDept', null, 0, null, 2, null, 'sys:dept:edit', 1, 0, 1, '', null, 2047437109236727808, '2025-06-09 18:22:01', null), + (2047437110629236736, '删除', 'DeleteSysDept', null, 0, null, 2, null, 'sys:dept:del', 1, 0, 1, '', null, 2047437109236727808, '2025-06-09 18:22:39', null), + (2047437110696345600, '删除', 'DeleteSysUser', null, 0, null, 2, null, 'sys:user:del', 1, 0, 1, '', null, 2047437109303836672, '2025-06-09 18:24:09', null), + (2047437110759260160, '新增', 'AddSysRole', null, 0, null, 2, null, 'sys:role:add', 1, 0, 1, '', null, 2047437109366751232, '2025-06-09 18:25:08', null), + (2047437110822174720, '修改', 'EditSysRole', null, 0, null, 2, null, 'sys:role:edit', 1, 0, 1, '', null, 2047437109366751232, '2025-06-09 18:26:30', null), + (2047437110889283584, '修改角色菜单', 'EditSysRoleMenu', null, 0, null, 2, null, 'sys:role:menu:edit', 1, 0, 1, '', null, 2047437109366751232, '2025-06-09 18:27:24', null), + (2047437110956392448, '修改角色数据范围', 'EditSysRoleScope', null, 0, null, 2, null, 'sys:role:scope:edit', 1, 0, 1, '', null, 2047437109366751232, '2025-06-09 18:28:25', null), + (2047437111023501312, '删除', 'DeleteSysRole', null, 0, null, 2, null, 'sys:role:del', 1, 0, 1, '', null, 2047437109366751232, '2025-06-09 18:28:55', null), + (2047437111090610176, '新增', 'AddSysMenu', null, 0, null, 2, null, 'sys:menu:add', 1, 0, 1, '', null, 2047437109429665792, '2025-06-09 18:29:51', null), + (2047437111157719040, '修改', 'EditSysMenu', null, 0, null, 2, null, 'sys:menu:edit', 1, 0, 1, '', null, 2047437109429665792, '2025-06-09 18:30:13', null), + (2047437111220633600, '删除', 'DeleteSysMenu', null, 0, null, 2, null, 'sys:menu:del', 1, 0, 1, '', null, 2047437109429665792, '2025-06-09 18:30:37', null), + (2047437111287742464, '新增', 'AddSysDataScope', null, 0, null, 2, null, 'data:scope:add', 1, 0, 1, '', null, 2047437109563883520, '2025-06-09 18:31:11', null), + (2047437111350657024, '修改', 'EditSysDataScope', null, 0, null, 2, null, 'data:scope:edit', 1, 0, 1, '', null, 2047437109563883520, '2025-06-09 18:31:42', null), + (2047437111417765888, '修改数据范围规则', 'EditDataScopeRule', null, 0, null, 2, null, 'data:scope:rule:edit', 1, 0, 1, '', null, 2047437109563883520, '2025-06-09 18:32:36', null), + (2047437111484874752, '删除', 'DeleteSysDataScope', null, 0, null, 2, null, 'data:scope:del', 1, 0, 1, '', null, 2047437109563883520, '2025-06-09 18:33:09', null), + (2047437111551983616, '新增', 'AddSysDataRule', null, 0, null, 2, null, 'data:rule:add', 1, 0, 1, '', null, 2047437109630992384, '2025-06-09 18:35:54', null), + (2047437111614898176, '修改', 'EditSysDataRule', null, 0, null, 2, null, 'data:rule:edit', 1, 0, 1, '', null, 2047437109630992384, '2025-06-09 18:36:19', null), + (2047437111682007040, '删除', 'DeleteSysDataRule', null, 0, null, 2, null, 'data:rule:del', 1, 0, 1, '', null, 2047437109630992384, '2025-06-09 18:36:44', null), + (2047437111749115904, '安装插件', 'InstallSysPlugin', null, 0, null, 2, null, 'sys:plugin:install', 1, 0, 1, '', null, 2047437109698101248, '2025-06-09 18:38:14', null), + (2047437111816224768, '卸载', 'UninstallSysPlugin', null, 0, null, 2, null, 'sys:plugin:uninstall', 1, 0, 1, '', null, 2047437109698101248, '2025-06-09 18:39:08', null), + (2047437111883333632, '修改', 'EditSysPlugin', null, 0, null, 2, null, 'sys:plugin:edit', 1, 0, 1, '', null, 2047437109698101248, '2025-06-09 18:39:47', null), + (2047437111950442496, '新增', 'AddSysConfig', null, 0, null, 2, null, 'sys:config:add', 1, 0, 1, '', null, 2047437109761015808, '2025-06-09 18:45:52', null), + (2047437112017551360, '修改', 'EditSysConfig', null, 0, null, 2, null, 'sys:config:edit', 1, 0, 1, '', null, 2047437109761015808, '2025-06-09 18:46:13', null), + (2047437112084660224, '删除', 'DeleteSysConfig', null, 0, null, 2, null, 'sys:config:del', 1, 0, 1, '', null, 2047437109761015808, '2025-06-09 18:46:36', null), + (2047437112151769088, '新增类型', 'AddSysDictType', null, 0, null, 2, null, 'dict:type:add', 1, 0, 1, '', null, 2047437109828124672, '2025-06-09 18:48:17', null), + (2047437112218877952, '修改类型', 'EditSysDictType', null, 0, null, 2, null, 'dict:type:edit', 1, 0, 1, '', null, 2047437109828124672, '2025-06-09 18:48:49', null), + (2047437112285986816, '删除类型', 'DeleteSysDictType', null, 0, null, 2, null, 'dict:type:del', 1, 0, 1, '', null, 2047437109828124672, '2025-06-09 18:49:23', null), + (2047437112353095680, '新增', 'AddSysDictData', null, 0, null, 2, null, 'dict:data:add', 1, 0, 1, '', null, 2047437109828124672, '2025-06-09 18:50:01', null), + (2047437112416010240, '修改', 'EditSysDictData', null, 0, null, 2, null, 'dict:data:edit', 1, 0, 1, '', null, 2047437109828124672, '2025-06-09 18:50:26', null), + (2047437112483119104, '删除', 'DeleteSysDictData', null, 0, null, 2, null, 'dict:data:del', 1, 0, 1, '', null, 2047437109828124672, '2025-06-09 18:50:48', null), + (2047437112550227968, '新增', 'AddSysNotice', null, 0, null, 2, null, 'sys:notice:add', 1, 0, 1, '', null, 2047437109891039232, '2025-06-09 18:51:22', null), + (2047437112617336832, '修改', 'EditSysNotice', null, 0, null, 2, null, 'sys:notice:edit', 1, 0, 1, '', null, 2047437109891039232, '2025-06-09 18:51:45', null), + (2047437112684445696, '删除', 'DeleteSysNotice', null, 0, null, 2, null, 'sys:notice:del', 1, 0, 1, '', null, 2047437109891039232, '2025-06-09 18:52:10', null), + (2047437112751554560, '新增业务', 'AddSysGenCodeBusiness', null, 0, null, 2, null, 'codegen:business:add', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:53:07', null), + (2047437112822857728, '修改业务', 'EditGenCodeBusiness', null, 0, null, 2, null, 'codegen:business:edit', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:53:45', null), + (2047437112889966592, '删除业务', 'DeleteGenCodeBusiness', null, 0, null, 2, null, 'codegen:business:del', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:54:11', null), + (2047437112957075456, '新增模型', 'AddGenCodeModel', null, 0, null, 2, null, 'codegen:model:add', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:54:45', null), + (2047437113024184320, '修改模型', 'EditGenCodeModel', null, 0, null, 2, null, 'codegen:model:edit', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:55:08', null), + (2047437113091293184, '删除模型', 'DeleteGenCodeModel', null, 0, null, 2, null, 'codegen:model:del', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:55:35', null), + (2047437113154207744, '导入', 'ImportGenCode', null, 0, null, 2, null, 'codegen:table:import', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 18:58:16', null), + (2047437113221316608, '写入', 'WriteGenCode', null, 0, null, 2, null, 'codegen:local:write', 1, 0, 1, '', null, 2047437109958148096, '2025-06-09 19:01:22', null), + (2047437113284231168, '删除', 'DeleteSysLoginLog', null, 0, null, 2, null, 'log:login:del', 1, 0, 1, '', null, 2047437110092365824, '2025-06-09 19:02:21', null), + (2047437113351340032, '清空', 'EmptyLoginLog', null, 0, null, 2, null, 'log:login:clear', 1, 0, 1, '', null, 2047437110092365824, '2025-06-09 19:02:50', null), + (2047437113418448896, '删除', 'DeleteOperaLog', null, 0, null, 2, null, 'log:opera:del', 1, 0, 1, '', null, 2047437110159474688, '2025-06-09 19:03:13', null), + (2047437113485557760, '清空', 'EmptyOperaLog', null, 0, null, 2, null, 'log:opera:clear', 1, 0, 1, '', null, 2047437110159474688, '2025-06-09 19:03:40', null), + (2047437113552666624, '下线', 'KickSysToken', null, 0, null, 2, null, 'sys:session:delete', 1, 0, 1, '', null, 2047437110226583552, '2025-06-09 19:04:52', null); + +insert into sys_role (id, name, status, is_filter_scopes, remark, created_time, updated_time) +values (2047437113619775488, '测试', 1, 1, null, '2025-05-26 17:13:45', null); + +insert into sys_role_menu (id, role_id, menu_id) +values (2047437113686884352, 2047437113619775488, 2047437108502724608), + (2047437113753993216, 2047437113619775488, 2047437108569833472), + (2047437113821102080, 2047437113619775488, 2047437108632748032), + (2047437113888210944, 2047437113619775488, 2047437108699856896); + +insert into sys_user (id, uuid, username, nickname, password, salt, email, is_superuser, is_staff, status, is_multi_login, avatar, phone, join_time, last_login_time, dept_id, created_time, updated_time) +values (2047437113955319808, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b$12$8y2eNucX19VjmZ3tYhBLcOsBwy9w1IjBQE4SSqwMDL5bGQVp2wqS.', 0x24326224313224387932654E7563583139566A6D5A33745968424C634F, 'admin@example.com', 1, 1, 1, 1, null, null, '2023-06-26 17:13:45', '2024-11-18 13:53:57', 2047437108473364480, '2023-06-26 17:13:45', '2024-11-18 13:53:57'); + +insert into sys_user_role (id, user_id, role_id) +values (2047437114022428672, 2047437113955319808, 2047437113619775488); + +insert into sys_data_scope (id, name, status, created_time, updated_time) +values (2047437114085343232, '测试部门数据权限', 1, '2025-06-09 16:53:29', null), + (2047437114152452096, '测试部门及以下数据权限', 1, '2025-06-09 16:53:40', null); + +insert into sys_data_rule (id, name, model, `column`, operator, expression, `value`, created_time, updated_time) +values (2047437114219560960, '部门名称等于测试', '部门', 'name', 1, 0, '测试', '2025-06-09 16:56:06', null), + (2047437114286669824, '父部门 ID 等于 1', '部门', 'parent_id', 0, 0, '1', '2025-06-09 17:16:14', null); + +insert into sys_data_scope_rule (id, data_scope_id, data_rule_id) +values (2047437114353778688, 2047437114085343232, 2047437114219560960), + (2047437114420887552, 2047437114152452096, 2047437114219560960), + (2047437114487996416, 2047437114152452096, 2047437114286669824); diff --git a/backend/sql/postgresql/create_tables.sql b/backend/sql/postgresql/create_tables.sql deleted file mode 100644 index ebe1dc42..00000000 --- a/backend/sql/postgresql/create_tables.sql +++ /dev/null @@ -1,908 +0,0 @@ -create table sys_data_rule -( - id bigserial, - name varchar(500) not null, - model varchar(50) not null, - "column" varchar(20) not null, - operator integer not null, - expression integer not null, - value varchar(255) not null, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_data_rule is '数据规则表'; - -comment on column sys_data_rule.id is '主键 ID'; - -comment on column sys_data_rule.name is '名称'; - -comment on column sys_data_rule.model is 'SQLA 模型名,对应 DATA_PERMISSION_MODELS 键名'; - -comment on column sys_data_rule."column" is '模型字段名'; - -comment on column sys_data_rule.operator is '运算符(0:and、1:or)'; - -comment on column sys_data_rule.expression is '表达式(0:==、1:!=、2:>、3:>=、4:<、5:<=、6:in、7:not_in)'; - -comment on column sys_data_rule.value is '规则值'; - -comment on column sys_data_rule.created_time is '创建时间'; - -comment on column sys_data_rule.updated_time is '更新时间'; - -alter table sys_data_rule - owner to postgres; - -create unique index sys_data_rule_pkey - on sys_data_rule (id); - -create unique index sys_data_rule_name_key - on sys_data_rule (name); - -create unique index ix_sys_data_rule_id - on sys_data_rule (id); - -create table sys_data_scope -( - id bigserial, - name varchar(50) not null, - status integer not null, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_data_scope is '数据范围表'; - -comment on column sys_data_scope.id is '主键 ID'; - -comment on column sys_data_scope.name is '名称'; - -comment on column sys_data_scope.status is '状态(0停用 1正常)'; - -comment on column sys_data_scope.created_time is '创建时间'; - -comment on column sys_data_scope.updated_time is '更新时间'; - -alter table sys_data_scope - owner to postgres; - -create unique index sys_data_scope_pkey - on sys_data_scope (id); - -create unique index sys_data_scope_name_key - on sys_data_scope (name); - -create unique index ix_sys_data_scope_id - on sys_data_scope (id); - -create table sys_dept -( - id bigserial, - name varchar(50) not null, - sort integer not null, - leader varchar(20), - phone varchar(11), - email varchar(50), - status integer not null, - del_flag integer not null, - parent_id bigint - references ??? () - on delete set null, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key () -); - -comment on table sys_dept is '部门表'; - -comment on column sys_dept.id is '主键 ID'; - -comment on column sys_dept.name is '部门名称'; - -comment on column sys_dept.sort is '排序'; - -comment on column sys_dept.leader is '负责人'; - -comment on column sys_dept.phone is '手机'; - -comment on column sys_dept.email is '邮箱'; - -comment on column sys_dept.status is '部门状态(0停用 1正常)'; - -comment on column sys_dept.del_flag is '删除标志(0删除 1存在)'; - -comment on column sys_dept.parent_id is '父部门ID'; - -comment on column sys_dept.created_time is '创建时间'; - -comment on column sys_dept.updated_time is '更新时间'; - -alter table sys_dept - owner to postgres; - -create unique index sys_dept_pkey - on sys_dept (id); - -create unique index ix_sys_dept_id - on sys_dept (id); - -create index ix_sys_dept_parent_id - on sys_dept (parent_id); - -create table sys_login_log -( - id bigint not null, - user_uuid varchar(50) not null, - username varchar(20) not null, - status integer not null, - ip varchar(50) not null, - country varchar(50), - region varchar(50), - city varchar(50), - user_agent varchar(255) not null, - os varchar(50), - browser varchar(50), - device varchar(50), - msg text not null, - login_time timestamp with time zone not null, - created_time timestamp with time zone not null, - primary key () -); - -comment on table sys_login_log is '登录日志表'; - -comment on column sys_login_log.id is '雪花算法主键 ID'; - -comment on column sys_login_log.user_uuid is '用户UUID'; - -comment on column sys_login_log.username is '用户名'; - -comment on column sys_login_log.status is '登录状态(0失败 1成功)'; - -comment on column sys_login_log.ip is '登录IP地址'; - -comment on column sys_login_log.country is '国家'; - -comment on column sys_login_log.region is '地区'; - -comment on column sys_login_log.city is '城市'; - -comment on column sys_login_log.user_agent is '请求头'; - -comment on column sys_login_log.os is '操作系统'; - -comment on column sys_login_log.browser is '浏览器'; - -comment on column sys_login_log.device is '设备'; - -comment on column sys_login_log.msg is '提示消息'; - -comment on column sys_login_log.login_time is '登录时间'; - -comment on column sys_login_log.created_time is '创建时间'; - -alter table sys_login_log - owner to postgres; - -create unique index sys_login_log_pkey - on sys_login_log (id); - -create unique index ix_sys_login_log_id - on sys_login_log (id); - -create table sys_menu -( - id bigserial, - title varchar(50) not null, - name varchar(50) not null, - path varchar(200), - sort integer not null, - icon varchar(100), - type integer not null, - component varchar(255), - perms varchar(100), - status integer not null, - display integer not null, - cache integer not null, - link text, - remark text, - parent_id bigint - references ??? () - on delete set null, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key () -); - -comment on table sys_menu is '菜单表'; - -comment on column sys_menu.id is '主键 ID'; - -comment on column sys_menu.title is '菜单标题'; - -comment on column sys_menu.name is '菜单名称'; - -comment on column sys_menu.path is '路由地址'; - -comment on column sys_menu.sort is '排序'; - -comment on column sys_menu.icon is '菜单图标'; - -comment on column sys_menu.type is '菜单类型(0目录 1菜单 2按钮 3内嵌 4外链)'; - -comment on column sys_menu.component is '组件路径'; - -comment on column sys_menu.perms is '权限标识'; - -comment on column sys_menu.status is '菜单状态(0停用 1正常)'; - -comment on column sys_menu.display is '是否显示(0否 1是)'; - -comment on column sys_menu.cache is '是否缓存(0否 1是)'; - -comment on column sys_menu.link is '外链地址'; - -comment on column sys_menu.remark is '备注'; - -comment on column sys_menu.parent_id is '父菜单ID'; - -comment on column sys_menu.created_time is '创建时间'; - -comment on column sys_menu.updated_time is '更新时间'; - -alter table sys_menu - owner to postgres; - -create unique index sys_menu_pkey - on sys_menu (id); - -create index ix_sys_menu_parent_id - on sys_menu (parent_id); - -create unique index ix_sys_menu_id - on sys_menu (id); - -create table sys_opera_log -( - id bigserial, - trace_id varchar(32) not null, - username varchar(20), - method varchar(20) not null, - title varchar(255) not null, - path varchar(500) not null, - ip varchar(50) not null, - country varchar(50), - region varchar(50), - city varchar(50), - user_agent varchar(255) not null, - os varchar(50), - browser varchar(50), - device varchar(50), - args json, - status integer not null, - code varchar(20) not null, - msg text, - cost_time double precision not null, - opera_time timestamp with time zone not null, - created_time timestamp with time zone not null, - primary key () -); - -comment on table sys_opera_log is '操作日志表'; - -comment on column sys_opera_log.id is '主键 ID'; - -comment on column sys_opera_log.trace_id is '请求跟踪 ID'; - -comment on column sys_opera_log.username is '用户名'; - -comment on column sys_opera_log.method is '请求类型'; - -comment on column sys_opera_log.title is '操作模块'; - -comment on column sys_opera_log.path is '请求路径'; - -comment on column sys_opera_log.ip is 'IP地址'; - -comment on column sys_opera_log.country is '国家'; - -comment on column sys_opera_log.region is '地区'; - -comment on column sys_opera_log.city is '城市'; - -comment on column sys_opera_log.user_agent is '请求头'; - -comment on column sys_opera_log.os is '操作系统'; - -comment on column sys_opera_log.browser is '浏览器'; - -comment on column sys_opera_log.device is '设备'; - -comment on column sys_opera_log.args is '请求参数'; - -comment on column sys_opera_log.status is '操作状态(0异常 1正常)'; - -comment on column sys_opera_log.code is '操作状态码'; - -comment on column sys_opera_log.msg is '提示消息'; - -comment on column sys_opera_log.cost_time is '请求耗时(ms)'; - -comment on column sys_opera_log.opera_time is '操作时间'; - -comment on column sys_opera_log.created_time is '创建时间'; - -alter table sys_opera_log - owner to postgres; - -create unique index sys_opera_log_pkey - on sys_opera_log (id); - -create unique index ix_sys_opera_log_id - on sys_opera_log (id); - -create table sys_role -( - id bigserial, - name varchar(20) not null, - status integer not null, - is_filter_scopes integer not null, - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_role is '角色表'; - -comment on column sys_role.id is '主键 ID'; - -comment on column sys_role.name is '角色名称'; - -comment on column sys_role.status is '角色状态(0停用 1正常)'; - -comment on column sys_role.is_filter_scopes is '过滤数据权限(0否 1是)'; - -comment on column sys_role.remark is '备注'; - -comment on column sys_role.created_time is '创建时间'; - -comment on column sys_role.updated_time is '更新时间'; - -alter table sys_role - owner to postgres; - -create unique index sys_role_pkey - on sys_role (id); - -create unique index sys_role_name_key - on sys_role (name); - -create unique index ix_sys_role_id - on sys_role (id); - -create table sys_config -( - id bigserial, - name varchar(20) not null, - type varchar(20), - key varchar(50) not null, - value text not null, - is_frontend integer not null, - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_config is '参数配置表'; - -comment on column sys_config.id is '主键 ID'; - -comment on column sys_config.name is '名称'; - -comment on column sys_config.type is '类型'; - -comment on column sys_config.key is '键名'; - -comment on column sys_config.value is '键值'; - -comment on column sys_config.is_frontend is '是否前端'; - -comment on column sys_config.remark is '备注'; - -comment on column sys_config.created_time is '创建时间'; - -comment on column sys_config.updated_time is '更新时间'; - -alter table sys_config - owner to postgres; - -create unique index sys_config_pkey - on sys_config (id); - -create unique index sys_config_key_key - on sys_config (key); - -create unique index ix_sys_config_id - on sys_config (id); - -create table sys_dict_type -( - id bigserial, - name varchar(32) not null, - code varchar(32) not null, - status integer not null, - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_dict_type is '字典类型表'; - -comment on column sys_dict_type.id is '主键 ID'; - -comment on column sys_dict_type.name is '字典类型名称'; - -comment on column sys_dict_type.code is '字典类型编码'; - -comment on column sys_dict_type.status is '状态(0停用 1正常)'; - -comment on column sys_dict_type.remark is '备注'; - -comment on column sys_dict_type.created_time is '创建时间'; - -comment on column sys_dict_type.updated_time is '更新时间'; - -alter table sys_dict_type - owner to postgres; - -create unique index sys_dict_type_pkey - on sys_dict_type (id); - -create unique index sys_dict_type_code_key - on sys_dict_type (code); - -create unique index ix_sys_dict_type_id - on sys_dict_type (id); - -create table sys_notice -( - id bigserial, - title varchar(50) not null, - type integer not null, - author varchar(16) not null, - source varchar(50) not null, - status integer not null, - content text not null, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key () -); - -comment on table sys_notice is '系统通知公告表'; - -comment on column sys_notice.id is '主键 ID'; - -comment on column sys_notice.title is '标题'; - -comment on column sys_notice.type is '类型(0:通知、1:公告)'; - -comment on column sys_notice.author is '作者'; - -comment on column sys_notice.source is '信息来源'; - -comment on column sys_notice.status is '状态(0:隐藏、1:显示)'; - -comment on column sys_notice.content is '内容'; - -comment on column sys_notice.created_time is '创建时间'; - -comment on column sys_notice.updated_time is '更新时间'; - -alter table sys_notice - owner to postgres; - -create unique index sys_notice_pkey - on sys_notice (id); - -create unique index ix_sys_notice_id - on sys_notice (id); - -create table gen_business -( - id bigserial, - app_name varchar(50) not null, - table_name varchar(255) not null, - doc_comment varchar(255) not null, - table_comment varchar(255), - class_name varchar(50), - schema_name varchar(50), - filename varchar(50), - default_datetime_column boolean not null, - api_version varchar(20) not null, - gen_path varchar(255), - remark text, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table gen_business is '代码生成业务表'; - -comment on column gen_business.id is '主键 ID'; - -comment on column gen_business.app_name is '应用名称(英文)'; - -comment on column gen_business.table_name is '表名称(英文)'; - -comment on column gen_business.doc_comment is '文档注释(用于函数/参数文档)'; - -comment on column gen_business.table_comment is '表描述'; - -comment on column gen_business.class_name is '基础类名(默认为英文表名称)'; - -comment on column gen_business.schema_name is 'Schema 名称 (默认为英文表名称)'; - -comment on column gen_business.filename is '基础文件名(默认为英文表名称)'; - -comment on column gen_business.default_datetime_column is '是否存在默认时间列'; - -comment on column gen_business.api_version is '代码生成 api 版本,默认为 v1'; - -comment on column gen_business.gen_path is '代码生成路径(默认为 app 根路径)'; - -comment on column gen_business.remark is '备注'; - -comment on column gen_business.created_time is '创建时间'; - -comment on column gen_business.updated_time is '更新时间'; - -alter table gen_business - owner to postgres; - -create unique index gen_business_pkey - on gen_business (id); - -create unique index gen_business_table_name_key - on gen_business (table_name); - -create unique index ix_gen_business_id - on gen_business (id); - -create table sys_role_menu -( - id bigserial, - role_id bigint not null - references ??? () - on delete cascade, - menu_id bigint not null - references ??? () - on delete cascade, - primary key () -); - -comment on column sys_role_menu.id is '主键ID'; - -comment on column sys_role_menu.role_id is '角色ID'; - -comment on column sys_role_menu.menu_id is '菜单ID'; - -alter table sys_role_menu - owner to postgres; - -create unique index sys_role_menu_pkey - on sys_role_menu (id, role_id, menu_id); - -create unique index ix_sys_role_menu_id - on sys_role_menu (id); - -create table sys_role_data_scope -( - id bigserial, - role_id bigint not null - references ??? () - on delete cascade, - data_scope_id bigint not null - references ??? () - on delete cascade, - primary key () -); - -comment on column sys_role_data_scope.id is '主键 ID'; - -comment on column sys_role_data_scope.role_id is '角色 ID'; - -comment on column sys_role_data_scope.data_scope_id is '数据范围 ID'; - -alter table sys_role_data_scope - owner to postgres; - -create unique index sys_role_data_scope_pkey - on sys_role_data_scope (id, role_id, data_scope_id); - -create unique index ix_sys_role_data_scope_id - on sys_role_data_scope (id); - -create table sys_data_scope_rule -( - id bigserial, - data_scope_id bigint not null - references ??? () - on delete cascade, - data_rule_id bigint not null - references ??? () - on delete cascade, - primary key () -); - -comment on column sys_data_scope_rule.id is '主键ID'; - -comment on column sys_data_scope_rule.data_scope_id is '数据范围 ID'; - -comment on column sys_data_scope_rule.data_rule_id is '数据规则 ID'; - -alter table sys_data_scope_rule - owner to postgres; - -create unique index sys_data_scope_rule_pkey - on sys_data_scope_rule (id, data_scope_id, data_rule_id); - -create unique index ix_sys_data_scope_rule_id - on sys_data_scope_rule (id); - -create table sys_user -( - id bigserial, - uuid varchar(50) not null, - username varchar(20) not null, - nickname varchar(20) not null, - password varchar(255) not null, - salt bytea not null, - email varchar(50), - phone varchar(11), - avatar varchar(255), - status integer not null, - is_superuser integer not null, - is_staff integer not null, - is_multi_login integer not null, - join_time timestamp with time zone not null, - last_login_time timestamp with time zone, - dept_id bigint - references ??? () - on delete set null, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_user is '用户表'; - -comment on column sys_user.id is '主键 ID'; - -comment on column sys_user.username is '用户名'; - -comment on column sys_user.nickname is '昵称'; - -comment on column sys_user.password is '密码'; - -comment on column sys_user.salt is '加密盐'; - -comment on column sys_user.email is '邮箱'; - -comment on column sys_user.phone is '手机号'; - -comment on column sys_user.avatar is '头像'; - -comment on column sys_user.status is '用户账号状态(0停用 1正常)'; - -comment on column sys_user.is_superuser is '超级权限(0否 1是)'; - -comment on column sys_user.is_staff is '后台管理登陆(0否 1是)'; - -comment on column sys_user.is_multi_login is '是否重复登陆(0否 1是)'; - -comment on column sys_user.join_time is '注册时间'; - -comment on column sys_user.last_login_time is '上次登录'; - -comment on column sys_user.dept_id is '部门关联ID'; - -comment on column sys_user.created_time is '创建时间'; - -comment on column sys_user.updated_time is '更新时间'; - -alter table sys_user - owner to postgres; - -create unique index sys_user_pkey - on sys_user (id); - -create unique index sys_user_uuid_key - on sys_user (uuid); - -create unique index ix_sys_user_email - on sys_user (email); - -create unique index ix_sys_user_username - on sys_user (username); - -create unique index ix_sys_user_id - on sys_user (id); - -create index ix_sys_user_status - on sys_user (status); - -create table sys_dict_data -( - id bigserial, - label varchar(32) not null, - value varchar(32) not null, - sort integer not null, - status integer not null, - remark text, - type_id bigint not null - references ??? () - on delete cascade, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key (), - unique () -); - -comment on table sys_dict_data is '字典数据表'; - -comment on column sys_dict_data.id is '主键 ID'; - -comment on column sys_dict_data.label is '字典标签'; - -comment on column sys_dict_data.value is '字典值'; - -comment on column sys_dict_data.sort is '排序'; - -comment on column sys_dict_data.status is '状态(0停用 1正常)'; - -comment on column sys_dict_data.remark is '备注'; - -comment on column sys_dict_data.type_id is '字典类型关联ID'; - -comment on column sys_dict_data.created_time is '创建时间'; - -comment on column sys_dict_data.updated_time is '更新时间'; - -alter table sys_dict_data - owner to postgres; - -create unique index sys_dict_data_pkey - on sys_dict_data (id); - -create unique index sys_dict_data_label_key - on sys_dict_data (label); - -create unique index ix_sys_dict_data_id - on sys_dict_data (id); - -create table gen_column -( - id bigserial, - name varchar(50) not null, - comment varchar(255), - type varchar(20) not null, - pd_type varchar(20) not null, - "default" text, - sort integer, - length integer not null, - is_pk boolean not null, - is_nullable boolean not null, - gen_business_id bigint not null - references ??? () - on delete cascade, - primary key () -); - -comment on table gen_column is '代码生成模型列表'; - -comment on column gen_column.id is '主键 ID'; - -comment on column gen_column.name is '列名称'; - -comment on column gen_column.comment is '列描述'; - -comment on column gen_column.type is 'SQLA 模型列类型'; - -comment on column gen_column.pd_type is '列类型对应的 pydantic 类型'; - -comment on column gen_column."default" is '列默认值'; - -comment on column gen_column.sort is '列排序'; - -comment on column gen_column.length is '列长度'; - -comment on column gen_column.is_pk is '是否主键'; - -comment on column gen_column.is_nullable is '是否可为空'; - -comment on column gen_column.gen_business_id is '代码生成业务ID'; - -alter table gen_column - owner to postgres; - -create unique index gen_column_pkey - on gen_column (id); - -create unique index ix_gen_column_id - on gen_column (id); - -create table sys_user_role -( - id bigserial, - user_id bigint not null - references ??? () - on delete cascade, - role_id bigint not null - references ??? () - on delete cascade, - primary key () -); - -comment on column sys_user_role.id is '主键ID'; - -comment on column sys_user_role.user_id is '用户ID'; - -comment on column sys_user_role.role_id is '角色ID'; - -alter table sys_user_role - owner to postgres; - -create unique index sys_user_role_pkey - on sys_user_role (id, user_id, role_id); - -create unique index ix_sys_user_role_id - on sys_user_role (id); - -create table sys_user_social -( - id bigserial, - sid varchar(20) not null, - source varchar(20) not null, - user_id bigint not null - references ??? () - on delete cascade, - created_time timestamp with time zone not null, - updated_time timestamp with time zone, - primary key () -); - -comment on table sys_user_social is '用户社交表(OAuth2)'; - -comment on column sys_user_social.id is '主键 ID'; - -comment on column sys_user_social.sid is '第三方用户 ID'; - -comment on column sys_user_social.source is '第三方用户来源'; - -comment on column sys_user_social.user_id is '用户关联ID'; - -comment on column sys_user_social.created_time is '创建时间'; - -comment on column sys_user_social.updated_time is '更新时间'; - -alter table sys_user_social - owner to postgres; - -create unique index sys_user_social_pkey - on sys_user_social (id); - -create unique index ix_sys_user_social_id - on sys_user_social (id); diff --git a/backend/sql/postgresql/init_snowflake_test_data.sql b/backend/sql/postgresql/init_snowflake_test_data.sql new file mode 100644 index 00000000..ef6d2d30 --- /dev/null +++ b/backend/sql/postgresql/init_snowflake_test_data.sql @@ -0,0 +1,109 @@ +insert into sys_dept (id, name, sort, leader, phone, email, status, del_flag, parent_id, created_time, updated_time) +values (2047437114580271104, '测试', 0, null, null, null, 1, 0, null, '2025-05-26 17:13:45', null); + +insert into sys_menu (id, title, name, path, sort, icon, type, component, perms, status, display, cache, link, remark, parent_id, created_time, updated_time) +values (2047437114622214144, '概览', 'Dashboard', 'dashboard', 0, 'ant-design:dashboard-outlined', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:26:18', null), + (2047437114689323008, '系统管理', 'System', 'system', 1, 'eos-icons:admin', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:30:01', null), + (2047437114756431872, '系统自动化', 'Automation', 'automation', 2, 'material-symbols:automation', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:31:41', null), + (2047437114819346432, '日志管理', 'Log', 'log', 3, 'carbon:cloud-logging', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:32:34', null), + (2047437114886455296, '系统监控', 'Monitor', 'monitor', 4, 'mdi:monitor-eye', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:33:29', null), + (2047437114949369856, '项目', 'Project', 'fba', 5, 'https://wu-clan.github.io/picx-images-hosting/logo/fba.png', 0, null, null, 1, 1, 1, '', null, null, '2025-06-09 17:35:41', null), + (2047437115016478720, '分析页', 'Analytics', 'analytics', 0, 'lucide:area-chart', 1, '/dashboard/analytics/index', null, 1, 1, 1, '', null, 2047437114622214144, '2025-06-09 17:54:29', null), + (2047437115083587584, '工作台', 'Workspace', 'workspace', 1, 'carbon:workspace', 1, '/dashboard/workspace/index', null, 1, 1, 1, '', null, 2047437114622214144, '2025-06-09 17:57:09', null), + (2047437115150696448, '文档', 'Document', 'document', 1, 'lucide:book-open-text', 4, '/_core/fallback/iframe.vue', null, 1, 1, 1, 'https://fastapi-practices.github.io/fastapi_best_architecture_docs', null, 2047437114949369856, '2025-06-09 17:59:44', null), + (2047437115217805312, 'Github', 'Github', 'github', 2, 'ant-design:github-filled', 4, '/_core/fallback/iframe.vue', null, 1, 1, 1, 'https://github.com/fastapi-practices/fastapi_best_architecture', null, 2047437114949369856, '2025-06-09 18:00:50', null), + (2047437115284914176, 'Apifox', 'Apifox', 'apifox', 3, 'simple-icons:apifox', 3, '/_core/fallback/iframe.vue', null, 1, 1, 1, 'https://apifox.com/apidoc/shared-28a93f02-730b-4f33-bb5e-4dad92058cc0', null, 2047437114949369856, '2025-06-09 18:01:39', null), + (2047437115352023040, '部门管理', 'SysDept', 'sys-dept', 1, 'mingcute:department-line', 1, '/system/dept/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:03:17', null), + (2047437115414937600, '用户管理', 'SysUser', 'sys-user', 2, 'ant-design:user-outlined', 1, '/system/user/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:03:54', null), + (2047437115477852160, '角色管理', 'SysRole', 'sys-role', 3, 'carbon:user-role', 1, '/system/role/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:04:47', null), + (2047437115540766720, '菜单管理', 'SysMenu', 'sys-menu', 4, 'ant-design:menu-outlined', 1, '/system/menu/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:05:31', null), + (2047437115607875584, '数据权限', 'SysDataPermission', 'sys-data-permission', 5, 'icon-park-outline:permissions', 0, null, null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:07:04', null), + (2047437115674984448, '数据范围', 'SysDataScope', 'sys-data-scope', 6, 'cuida:scope-outline', 1, '/system/data-permission/scope/index', null, 1, 1, 1, '', null, 2047437115607875584, '2025-06-09 18:07:46', null), + (2047437115742093312, '数据规则', 'SysDataRule', 'sys-data-rule', 7, 'material-symbols:rule', 1, '/system/data-permission/rule/index', null, 1, 1, 1, '', null, 2047437115607875584, '2025-06-09 18:08:22', null), + (2047437115809202176, '插件管理', 'SysPlugin', 'sys-plugin', 8, 'clarity:plugin-line', 1, '/system/plugin/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:09:12', null), + (2047437115876311040, '参数管理', 'SysConfig', 'sys-config', 9, 'codicon:symbol-parameter', 1, '/system/config/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:10:20', null), + (2047437115943419904, '字典管理', 'SysDict', 'sys-dict', 10, 'fluent-mdl2:dictionary', 1, '/system/dict/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:11:10', null), + (2047437116010528768, '通知公告', 'SysNotice', 'sys-notice', 11, 'fe:notice-push', 1, '/system/notice/index', null, 1, 1, 1, '', null, 2047437114689323008, '2025-06-09 18:11:38', null), + (2047437116077637632, '代码生成', 'CodeGenerator', 'code-generator', 1, 'tabler:code', 1, '/automation/code-generator/index', null, 1, 1, 1, '', null, 2047437114756431872, '2025-06-09 18:12:38', null), + (2047437116144746496, '任务调度', 'Scheduler', 'scheduler', 2, 'ix:scheduler', 1, '/automation/scheduler/index', null, 1, 1, 1, '', null, 2047437114756431872, '2025-06-09 18:13:19', null), + (2047437116211855360, '登录日志', 'LoginLog', 'login', 1, 'mdi:login', 1, '/log/login/index', null, 1, 1, 1, '', null, 2047437114819346432, '2025-06-09 18:14:35', null), + (2047437116274769920, '操作日志', 'OperaLog', 'opera', 2, 'carbon:operations-record', 1, '/log/opera/index', null, 1, 1, 1, '', null, 2047437114819346432, '2025-06-09 18:15:26', null), + (2047437116341878784, '在线用户', 'Online', 'online', 1, 'wpf:online', 1, '/monitor/online/index', null, 1, 1, 1, '', null, 2047437114886455296, '2025-06-09 18:17:12', null), + (2047437116408987648, 'Redis', 'Redis', 'redis', 2, 'devicon:redis', 1, '/monitor/redis/index', null, 1, 1, 1, '', null, 2047437114886455296, '2025-06-09 18:17:42', null), + (2047437116476096512, 'Server', 'Server', 'server', 3, 'mdi:server-outline', 1, '/monitor/server/index', null, 1, 1, 1, '', null, 2047437114886455296, '2025-06-09 18:18:12', null), + (2047437116543205376, '个人中心', 'Profile', 'profile', 6, 'ant-design:profile-outlined', 1, '/_core/profile/index', null, 1, 0, 1, '', null, null, '2025-06-09 18:18:12', null), + (2047437116610314240, '新增', 'AddSysDept', null, 0, null, 2, null, 'sys:dept:add', 1, 0, 1, '', null, 2047437115352023040, '2025-06-09 18:21:17', null), + (2047437116677423104, '修改', 'EditSysDept', null, 0, null, 2, null, 'sys:dept:edit', 1, 0, 1, '', null, 2047437115352023040, '2025-06-09 18:22:01', null), + (2047437116744531968, '删除', 'DeleteSysDept', null, 0, null, 2, null, 'sys:dept:del', 1, 0, 1, '', null, 2047437115352023040, '2025-06-09 18:22:39', null), + (2047437116807446528, '删除', 'DeleteSysUser', null, 0, null, 2, null, 'sys:user:del', 1, 0, 1, '', null, 2047437115414937600, '2025-06-09 18:24:09', null), + (2047437116870361088, '新增', 'AddSysRole', null, 0, null, 2, null, 'sys:role:add', 1, 0, 1, '', null, 2047437115477852160, '2025-06-09 18:25:08', null), + (2047437116937469952, '修改', 'EditSysRole', null, 0, null, 2, null, 'sys:role:edit', 1, 0, 1, '', null, 2047437115477852160, '2025-06-09 18:26:30', null), + (2047437117004578816, '修改角色菜单', 'EditSysRoleMenu', null, 0, null, 2, null, 'sys:role:menu:edit', 1, 0, 1, '', null, 2047437115477852160, '2025-06-09 18:27:24', null), + (2047437117067493376, '修改角色数据范围', 'EditSysRoleScope', null, 0, null, 2, null, 'sys:role:scope:edit', 1, 0, 1, '', null, 2047437115477852160, '2025-06-09 18:28:25', null), + (2047437117134602240, '删除', 'DeleteSysRole', null, 0, null, 2, null, 'sys:role:del', 1, 0, 1, '', null, 2047437115477852160, '2025-06-09 18:28:55', null), + (2047437117201711104, '新增', 'AddSysMenu', null, 0, null, 2, null, 'sys:menu:add', 1, 0, 1, '', null, 2047437115540766720, '2025-06-09 18:29:51', null), + (2047437117268819968, '修改', 'EditSysMenu', null, 0, null, 2, null, 'sys:menu:edit', 1, 0, 1, '', null, 2047437115540766720, '2025-06-09 18:30:13', null), + (2047437117335928832, '删除', 'DeleteSysMenu', null, 0, null, 2, null, 'sys:menu:del', 1, 0, 1, '', null, 2047437115540766720, '2025-06-09 18:30:37', null), + (2047437117403037696, '新增', 'AddSysDataScope', null, 0, null, 2, null, 'data:scope:add', 1, 0, 1, '', null, 2047437115674984448, '2025-06-09 18:31:11', null), + (2047437117470146560, '修改', 'EditSysDataScope', null, 0, null, 2, null, 'data:scope:edit', 1, 0, 1, '', null, 2047437115674984448, '2025-06-09 18:31:42', null), + (2047437117537255424, '修改数据范围规则', 'EditDataScopeRule', null, 0, null, 2, null, 'data:scope:rule:edit', 1, 0, 1, '', null, 2047437115674984448, '2025-06-09 18:32:36', null), + (2047437117600169984, '删除', 'DeleteSysDataScope', null, 0, null, 2, null, 'data:scope:del', 1, 0, 1, '', null, 2047437115674984448, '2025-06-09 18:33:09', null), + (2047437117663084544, '新增', 'AddSysDataRule', null, 0, null, 2, null, 'data:rule:add', 1, 0, 1, '', null, 2047437115742093312, '2025-06-09 18:35:54', null), + (2047437117730193408, '修改', 'EditSysDataRule', null, 0, null, 2, null, 'data:rule:edit', 1, 0, 1, '', null, 2047437115742093312, '2025-06-09 18:36:19', null), + (2047437117793107968, '删除', 'DeleteSysDataRule', null, 0, null, 2, null, 'data:rule:del', 1, 0, 1, '', null, 2047437115742093312, '2025-06-09 18:36:44', null), + (2047437117860216832, '安装插件', 'InstallSysPlugin', null, 0, null, 2, null, 'sys:plugin:install', 1, 0, 1, '', null, 2047437115809202176, '2025-06-09 18:38:14', null), + (2047437117927325696, '卸载', 'UninstallSysPlugin', null, 0, null, 2, null, 'sys:plugin:uninstall', 1, 0, 1, '', null, 2047437115809202176, '2025-06-09 18:39:08', null), + (2047437117994434560, '修改', 'EditSysPlugin', null, 0, null, 2, null, 'sys:plugin:edit', 1, 0, 1, '', null, 2047437115809202176, '2025-06-09 18:39:47', null), + (2047437118061543424, '新增', 'AddSysConfig', null, 0, null, 2, null, 'sys:config:add', 1, 0, 1, '', null, 2047437115876311040, '2025-06-09 18:45:52', null), + (2047437118128652288, '修改', 'EditSysConfig', null, 0, null, 2, null, 'sys:config:edit', 1, 0, 1, '', null, 2047437115876311040, '2025-06-09 18:46:13', null), + (2047437118195761152, '删除', 'DeleteSysConfig', null, 0, null, 2, null, 'sys:config:del', 1, 0, 1, '', null, 2047437115876311040, '2025-06-09 18:46:36', null), + (2047437118262870016, '新增类型', 'AddSysDictType', null, 0, null, 2, null, 'dict:type:add', 1, 0, 1, '', null, 2047437115943419904, '2025-06-09 18:48:17', null), + (2047437118325784576, '修改类型', 'EditSysDictType', null, 0, null, 2, null, 'dict:type:edit', 1, 0, 1, '', null, 2047437115943419904, '2025-06-09 18:48:49', null), + (2047437118392893440, '删除类型', 'DeleteSysDictType', null, 0, null, 2, null, 'dict:type:del', 1, 0, 1, '', null, 2047437115943419904, '2025-06-09 18:49:23', null), + (2047437118460002304, '新增', 'AddSysDictData', null, 0, null, 2, null, 'dict:data:add', 1, 0, 1, '', null, 2047437115943419904, '2025-06-09 18:50:01', null), + (2047437118527111168, '修改', 'EditSysDictData', null, 0, null, 2, null, 'dict:data:edit', 1, 0, 1, '', null, 2047437115943419904, '2025-06-09 18:50:26', null), + (2047437118594220032, '删除', 'DeleteSysDictData', null, 0, null, 2, null, 'dict:data:del', 1, 0, 1, '', null, 2047437115943419904, '2025-06-09 18:50:48', null), + (2047437118661328896, '新增', 'AddSysNotice', null, 0, null, 2, null, 'sys:notice:add', 1, 0, 1, '', null, 2047437116010528768, '2025-06-09 18:51:22', null), + (2047437118728437760, '修改', 'EditSysNotice', null, 0, null, 2, null, 'sys:notice:edit', 1, 0, 1, '', null, 2047437116010528768, '2025-06-09 18:51:45', null), + (2047437118791352320, '删除', 'DeleteSysNotice', null, 0, null, 2, null, 'sys:notice:del', 1, 0, 1, '', null, 2047437116010528768, '2025-06-09 18:52:10', null), + (2047437118858461184, '新增业务', 'AddSysGenCodeBusiness', null, 0, null, 2, null, 'codegen:business:add', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:53:07', null), + (2047437118921375744, '修改业务', 'EditGenCodeBusiness', null, 0, null, 2, null, 'codegen:business:edit', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:53:45', null), + (2047437118988484608, '删除业务', 'DeleteGenCodeBusiness', null, 0, null, 2, null, 'codegen:business:del', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:54:11', null), + (2047437119055593472, '新增模型', 'AddGenCodeModel', null, 0, null, 2, null, 'codegen:model:add', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:54:45', null), + (2047437119118508032, '修改模型', 'EditGenCodeModel', null, 0, null, 2, null, 'codegen:model:edit', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:55:08', null), + (2047437119185616896, '删除模型', 'DeleteGenCodeModel', null, 0, null, 2, null, 'codegen:model:del', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:55:35', null), + (2047437119252725760, '导入', 'ImportGenCode', null, 0, null, 2, null, 'codegen:table:import', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 18:58:16', null), + (2047437119319834624, '写入', 'WriteGenCode', null, 0, null, 2, null, 'codegen:local:write', 1, 0, 1, '', null, 2047437116077637632, '2025-06-09 19:01:22', null), + (2047437119386943488, '删除', 'DeleteSysLoginLog', null, 0, null, 2, null, 'log:login:del', 1, 0, 1, '', null, 2047437116211855360, '2025-06-09 19:02:21', null), + (2047437119454052352, '清空', 'EmptyLoginLog', null, 0, null, 2, null, 'log:login:clear', 1, 0, 1, '', null, 2047437116211855360, '2025-06-09 19:02:50', null), + (2047437119521161216, '删除', 'DeleteOperaLog', null, 0, null, 2, null, 'log:opera:del', 1, 0, 1, '', null, 2047437116274769920, '2025-06-09 19:03:13', null), + (2047437119584075776, '清空', 'EmptyOperaLog', null, 0, null, 2, null, 'log:opera:clear', 1, 0, 1, '', null, 2047437116274769920, '2025-06-09 19:03:40', null), + (2047437119651184640, '下线', 'KickSysToken', null, 0, null, 2, null, 'sys:session:delete', 1, 0, 1, '', null, 2047437116341878784, '2025-06-09 19:04:52', null); + +insert into sys_role (id, name, status, is_filter_scopes, remark, created_time, updated_time) +values (2047437119714099200, '测试', 1, 1, null, '2025-05-26 17:13:45', null); + +insert into sys_role_menu (id, role_id, menu_id) +values (2047437119781208064, 2047437119714099200, 2047437114622214144), + (2047437119844122624, 2047437119714099200, 2047437114689323008), + (2047437119911231488, 2047437119714099200, 2047437114756431872), + (2047437119974146048, 2047437119714099200, 2047437114819346432); + +insert into sys_user (id, uuid, username, nickname, password, salt, email, is_superuser, is_staff, status, is_multi_login, avatar, phone, join_time, last_login_time, dept_id, created_time, updated_time) +values (2047437120041254912, 'af4c804f-3966-4949-ace2-3bb7416ea926', 'admin', '用户88888', '$2b$12$8y2eNucX19VjmZ3tYhBLcOsBwy9w1IjBQE4SSqwMDL5bGQVp2wqS.', '0x24326224313224387932654E7563583139566A6D5A33745968424C634F', 'admin@example.com', 1, 1, 1, 1, null, null, '2023-06-26 17:13:45', '2024-11-18 13:53:57', 2047437114580271104, '2023-06-26 17:13:45', '2024-11-18 13:53:57'); + +insert into sys_user_role (id, user_id, role_id) +values (2047437120108363776, 2047437120041254912, 2047437119714099200); + +insert into sys_data_scope (id, name, status, created_time, updated_time) +values (2047437120175472640, '测试部门数据权限', 1, '2025-06-09 16:53:29', null), + (2047437120242581504, '测试部门及以下数据权限', 1, '2025-06-09 16:53:40', null); + +insert into sys_data_rule (id, name, model, "column", operator, expression, "value", created_time, updated_time) +values (2047437120309690368, '部门名称等于测试', '部门', 'name', 1, 0, '测试', '2025-06-09 16:56:06', null), + (2047437120376799232, '父部门 ID 等于 1', '部门', 'parent_id', 0, 0, '1', '2025-06-09 17:16:14', null); + +insert into sys_data_scope_rule (id, data_scope_id, data_rule_id) +values (2047437120443908096, 2047437120175472640, 2047437120309690368), + (2047437120511016960, 2047437120242581504, 2047437120309690368), + (2047437120578125824, 2047437120242581504, 2047437120376799232);