From a4cf63fb3ffa54450ebac8e3207dd521d73849d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E9=B9=8F?= Date: Thu, 21 May 2026 20:29:14 +0800 Subject: [PATCH] Add front workbench database schema --- RuoYi-Vue/sql/db.sql | 141 ++++++++++++++++++++++++++++++ RuoYi-Vue/sql/front_workbench.sql | 140 +++++++++++++++++++++++++++++ 2 files changed, 281 insertions(+) create mode 100644 RuoYi-Vue/sql/front_workbench.sql diff --git a/RuoYi-Vue/sql/db.sql b/RuoYi-Vue/sql/db.sql index a409a26..cc5b6a3 100644 --- a/RuoYi-Vue/sql/db.sql +++ b/RuoYi-Vue/sql/db.sql @@ -1237,4 +1237,145 @@ insert into sys_project_structure (node_id, parent_id, node_name, node_type, mod (6, 1, 'pom.xml', 'file', '依赖管理', null, null, 'xml', 2, '0', 'admin', sysdate(), '', null), (7, 1, 'README.md', 'file', '说明文档', null, null, 'markdown', 3, '0', 'admin', sysdate(), '', null); +-- ================================================= +-- EasyCode front workbench tables +-- Import after sql/db.sql, or use the copy appended to sql/db.sql +-- ================================================= + +drop table if exists front_project_file; +drop table if exists front_project_generation; +drop table if exists front_project_column; +drop table if exists front_project_table; +drop table if exists front_project; +drop table if exists front_user; + +create table front_user ( + user_id bigint(20) not null auto_increment comment '前台用户ID', + username varchar(50) not null comment '用户名', + password varchar(100) not null comment '密码', + nickname varchar(50) default '' comment '昵称', + email varchar(100) default '' comment '邮箱', + phone varchar(20) default '' comment '手机号', + status char(1) default '0' comment '状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0存在 2删除)', + last_login_time datetime default null comment '最后登录时间', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (user_id), + unique key uk_front_user_username (username), + key idx_front_user_email (email), + key idx_front_user_phone (phone) +) engine=innodb auto_increment=100 comment='前台用户表'; + +create table front_project ( + project_id bigint(20) not null auto_increment comment '前台项目ID', + user_id bigint(20) not null comment '前台用户ID', + project_name varchar(100) not null comment '项目名称', + project_file_name varchar(100) default '' comment '项目文件名', + package_name varchar(100) default 'com.easycode.generated' comment '包名', + version varchar(20) default '1.0.0' comment '版本号', + project_desc varchar(1000) default '' comment '项目描述', + industry_template varchar(50) default '' comment '行业模板', + front_framework varchar(50) default 'Vue3 + Element Plus' comment '前台框架', + back_framework varchar(50) default 'Spring Boot + MyBatis' comment '后端框架', + generate_status char(1) default '0' comment '数据库生成状态(0未生成 1生成中 2已生成 3失败)', + preview_status char(1) default '0' comment '预览状态(0未预览 1已预览 2失败)', + status char(1) default '0' comment '状态(0正常 1停用)', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (project_id), + key idx_front_project_user_id (user_id), + constraint fk_front_project_user foreign key (user_id) references front_user(user_id) +) engine=innodb auto_increment=100 comment='前台项目草稿表'; + +create table front_project_table ( + table_id bigint(20) not null auto_increment comment '表设计ID', + project_id bigint(20) not null comment '项目ID', + user_id bigint(20) not null comment '前台用户ID', + table_name varchar(200) not null comment '表名称', + table_comment varchar(500) default '' comment '表描述', + class_name varchar(100) default '' comment '实体类名称', + module_name varchar(30) default '' comment '生成模块名', + business_name varchar(30) default '' comment '生成业务名', + function_name varchar(50) default '' comment '生成功能名', + tpl_category varchar(200) default 'crud' comment '模板类型', + tpl_web_type varchar(30) default 'element-plus' comment '前端模板类型', + options varchar(1000) default '' comment '生成选项', + create_table_sql longtext comment '建表SQL', + sort int default 0 comment '排序', + status char(1) default '0' comment '状态(0正常 1停用)', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + primary key (table_id), + unique key uk_front_project_table (project_id, table_name), + key idx_front_project_table_project_id (project_id), + constraint fk_front_project_table_project foreign key (project_id) references front_project(project_id) +) engine=innodb auto_increment=100 comment='前台项目表设计'; + +create table front_project_column ( + column_id bigint(20) not null auto_increment comment '字段设计ID', + table_id bigint(20) not null comment '表设计ID', + project_id bigint(20) not null comment '项目ID', + column_name varchar(200) not null comment '字段名称', + column_comment varchar(500) default '' comment '字段描述', + column_type varchar(100) not null comment '字段类型', + java_type varchar(500) default 'String' comment 'Java类型', + java_field varchar(200) default '' comment 'Java字段名', + is_pk char(1) default '0' comment '是否主键(1是)', + is_increment char(1) default '0' comment '是否自增(1是)', + is_required char(1) default '0' comment '是否必填(1是)', + is_insert char(1) default '1' comment '是否插入字段(1是)', + is_edit char(1) default '1' comment '是否编辑字段(1是)', + is_list char(1) default '1' comment '是否列表字段(1是)', + is_query char(1) default '0' comment '是否查询字段(1是)', + query_type varchar(200) default 'EQ' comment '查询方式', + html_type varchar(200) default 'input' comment '显示类型', + dict_type varchar(200) default '' comment '字典类型', + default_value varchar(200) default null comment '默认值', + sort int default 0 comment '排序', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + primary key (column_id), + key idx_front_project_column_table_id (table_id), + key idx_front_project_column_project_id (project_id), + constraint fk_front_project_column_table foreign key (table_id) references front_project_table(table_id) +) engine=innodb auto_increment=100 comment='前台项目字段设计'; + +create table front_project_generation ( + generation_id bigint(20) not null auto_increment comment '生成记录ID', + project_id bigint(20) not null comment '项目ID', + user_id bigint(20) not null comment '前台用户ID', + generate_type varchar(50) not null comment '生成类型', + provider varchar(50) default 'deepseek' comment 'AI提供方', + prompt_summary varchar(500) default '' comment 'Prompt摘要', + request_payload longtext comment '请求内容', + response_payload longtext comment '响应内容', + success char(1) default '0' comment '是否成功(1成功 0失败)', + error_message varchar(1000) default '' comment '错误信息', + token_usage int default 0 comment 'Token用量', + elapsed_ms bigint(20) default 0 comment '耗时毫秒', + create_time datetime default null comment '创建时间', + primary key (generation_id), + key idx_front_project_generation_project_id (project_id) +) engine=innodb auto_increment=100 comment='前台项目生成记录'; + +create table front_project_file ( + file_id bigint(20) not null auto_increment comment '文件缓存ID', + project_id bigint(20) not null comment '项目ID', + template_type varchar(50) not null comment '模板类型', + node_id varchar(100) default '' comment '结构节点ID', + table_id bigint(20) default null comment '表设计ID', + file_name varchar(255) not null comment '文件名', + file_path varchar(500) default '' comment '文件路径', + file_content longtext comment '文件内容', + content_hash varchar(64) default '' comment '内容哈希', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + primary key (file_id), + key idx_front_project_file_project_id (project_id), + key idx_front_project_file_lookup (project_id, template_type, table_id) +) engine=innodb auto_increment=100 comment='前台项目预览文件缓存'; + SET FOREIGN_KEY_CHECKS = 1; diff --git a/RuoYi-Vue/sql/front_workbench.sql b/RuoYi-Vue/sql/front_workbench.sql new file mode 100644 index 0000000..8b6c90f --- /dev/null +++ b/RuoYi-Vue/sql/front_workbench.sql @@ -0,0 +1,140 @@ +-- ================================================= +-- EasyCode front workbench tables +-- Import after sql/db.sql, or use the copy appended to sql/db.sql +-- ================================================= + +drop table if exists front_project_file; +drop table if exists front_project_generation; +drop table if exists front_project_column; +drop table if exists front_project_table; +drop table if exists front_project; +drop table if exists front_user; + +create table front_user ( + user_id bigint(20) not null auto_increment comment '前台用户ID', + username varchar(50) not null comment '用户名', + password varchar(100) not null comment '密码', + nickname varchar(50) default '' comment '昵称', + email varchar(100) default '' comment '邮箱', + phone varchar(20) default '' comment '手机号', + status char(1) default '0' comment '状态(0正常 1停用)', + del_flag char(1) default '0' comment '删除标志(0存在 2删除)', + last_login_time datetime default null comment '最后登录时间', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (user_id), + unique key uk_front_user_username (username), + key idx_front_user_email (email), + key idx_front_user_phone (phone) +) engine=innodb auto_increment=100 comment='前台用户表'; + +create table front_project ( + project_id bigint(20) not null auto_increment comment '前台项目ID', + user_id bigint(20) not null comment '前台用户ID', + project_name varchar(100) not null comment '项目名称', + project_file_name varchar(100) default '' comment '项目文件名', + package_name varchar(100) default 'com.easycode.generated' comment '包名', + version varchar(20) default '1.0.0' comment '版本号', + project_desc varchar(1000) default '' comment '项目描述', + industry_template varchar(50) default '' comment '行业模板', + front_framework varchar(50) default 'Vue3 + Element Plus' comment '前台框架', + back_framework varchar(50) default 'Spring Boot + MyBatis' comment '后端框架', + generate_status char(1) default '0' comment '数据库生成状态(0未生成 1生成中 2已生成 3失败)', + preview_status char(1) default '0' comment '预览状态(0未预览 1已预览 2失败)', + status char(1) default '0' comment '状态(0正常 1停用)', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + remark varchar(500) default null comment '备注', + primary key (project_id), + key idx_front_project_user_id (user_id), + constraint fk_front_project_user foreign key (user_id) references front_user(user_id) +) engine=innodb auto_increment=100 comment='前台项目草稿表'; + +create table front_project_table ( + table_id bigint(20) not null auto_increment comment '表设计ID', + project_id bigint(20) not null comment '项目ID', + user_id bigint(20) not null comment '前台用户ID', + table_name varchar(200) not null comment '表名称', + table_comment varchar(500) default '' comment '表描述', + class_name varchar(100) default '' comment '实体类名称', + module_name varchar(30) default '' comment '生成模块名', + business_name varchar(30) default '' comment '生成业务名', + function_name varchar(50) default '' comment '生成功能名', + tpl_category varchar(200) default 'crud' comment '模板类型', + tpl_web_type varchar(30) default 'element-plus' comment '前端模板类型', + options varchar(1000) default '' comment '生成选项', + create_table_sql longtext comment '建表SQL', + sort int default 0 comment '排序', + status char(1) default '0' comment '状态(0正常 1停用)', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + primary key (table_id), + unique key uk_front_project_table (project_id, table_name), + key idx_front_project_table_project_id (project_id), + constraint fk_front_project_table_project foreign key (project_id) references front_project(project_id) +) engine=innodb auto_increment=100 comment='前台项目表设计'; + +create table front_project_column ( + column_id bigint(20) not null auto_increment comment '字段设计ID', + table_id bigint(20) not null comment '表设计ID', + project_id bigint(20) not null comment '项目ID', + column_name varchar(200) not null comment '字段名称', + column_comment varchar(500) default '' comment '字段描述', + column_type varchar(100) not null comment '字段类型', + java_type varchar(500) default 'String' comment 'Java类型', + java_field varchar(200) default '' comment 'Java字段名', + is_pk char(1) default '0' comment '是否主键(1是)', + is_increment char(1) default '0' comment '是否自增(1是)', + is_required char(1) default '0' comment '是否必填(1是)', + is_insert char(1) default '1' comment '是否插入字段(1是)', + is_edit char(1) default '1' comment '是否编辑字段(1是)', + is_list char(1) default '1' comment '是否列表字段(1是)', + is_query char(1) default '0' comment '是否查询字段(1是)', + query_type varchar(200) default 'EQ' comment '查询方式', + html_type varchar(200) default 'input' comment '显示类型', + dict_type varchar(200) default '' comment '字典类型', + default_value varchar(200) default null comment '默认值', + sort int default 0 comment '排序', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + primary key (column_id), + key idx_front_project_column_table_id (table_id), + key idx_front_project_column_project_id (project_id), + constraint fk_front_project_column_table foreign key (table_id) references front_project_table(table_id) +) engine=innodb auto_increment=100 comment='前台项目字段设计'; + +create table front_project_generation ( + generation_id bigint(20) not null auto_increment comment '生成记录ID', + project_id bigint(20) not null comment '项目ID', + user_id bigint(20) not null comment '前台用户ID', + generate_type varchar(50) not null comment '生成类型', + provider varchar(50) default 'deepseek' comment 'AI提供方', + prompt_summary varchar(500) default '' comment 'Prompt摘要', + request_payload longtext comment '请求内容', + response_payload longtext comment '响应内容', + success char(1) default '0' comment '是否成功(1成功 0失败)', + error_message varchar(1000) default '' comment '错误信息', + token_usage int default 0 comment 'Token用量', + elapsed_ms bigint(20) default 0 comment '耗时毫秒', + create_time datetime default null comment '创建时间', + primary key (generation_id), + key idx_front_project_generation_project_id (project_id) +) engine=innodb auto_increment=100 comment='前台项目生成记录'; + +create table front_project_file ( + file_id bigint(20) not null auto_increment comment '文件缓存ID', + project_id bigint(20) not null comment '项目ID', + template_type varchar(50) not null comment '模板类型', + node_id varchar(100) default '' comment '结构节点ID', + table_id bigint(20) default null comment '表设计ID', + file_name varchar(255) not null comment '文件名', + file_path varchar(500) default '' comment '文件路径', + file_content longtext comment '文件内容', + content_hash varchar(64) default '' comment '内容哈希', + create_time datetime default null comment '创建时间', + update_time datetime default null comment '更新时间', + primary key (file_id), + key idx_front_project_file_project_id (project_id), + key idx_front_project_file_lookup (project_id, template_type, table_id) +) engine=innodb auto_increment=100 comment='前台项目预览文件缓存';