V3.3.0
date:2024-11-19 (仅授权版更新)下载地址
1、更新gf版本至2.8.0
快速安装gf-cli2.8客户端go install github.com/gogf/gf/cmd/gf/v2@latest
进入项目根目录,通过命令gf up -a
更新gf相关依赖版本
2、更新gftoken
与gfcache
版本
运行命令:go get -u github.com/tiger1103/gfast-cache@v1.0.8
与 go get -u github.com/tiger1103/gfast-token@v1.0.8
3、添加附件管理器,将文件上传、图片上传、大文件上传(支持断点续传、秒传、文件校验)合并到附件管理器
4、添加通用组件:附件选择器组件,用户选择器组件,部门选择器组件
5、优化富文本编辑器组件,附件上传组件,图片上传组件,无需使用事件方法赋值,改为v-model绑定字段赋值,更方便,如下直接表达字段绑定到v-model即可:
富文本组件:
上传组件与附件选择器组件:
6、代码生成支持附件选择器组件,用户选择器组件,部门选择器组件
7、移除旧版大文件上传
8、修复代码生成在postgres数据库中的一些细节问题
9、富文本编辑器支持选择在线文件或图片功能(附件动态自动分页)
10、腾讯云上传支持目录按日期划分
11、前端更新vite
版本至5.4.6、更新sass
、sass-loader
、element-plus
版本
12、其它细节及bug修复:菜单添加修改父级id字段错误修复,修复角色授权bug,修复数权限判断bug
13、更改了后端之前的一些模块加载方式,之前的模块加载可能会需要在cmd.go
文件手动注册,新增插件时会改到该文件,现改为在插件或模块中自动注册:
从v3.2.32升级到此版本,后端覆盖补丁文件,前端UI覆盖补丁文件或直接通过git同步更新,更新完后需要重新安装前后端依赖。
添加附件管理表及菜单数据:
mysql 登陆到数据库执行下面这段添加更新的表格及数据
#mysql执行该语句
CREATE TABLE `sys_attachment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '文件ID',
`app_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '应用ID',
`drive` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上传驱动',
`name` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件原始名',
`kind` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '上传类型',
`mime_type` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '扩展类型',
`path` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '本地路径',
`size` bigint(20) NULL DEFAULT 0 COMMENT '文件大小',
`ext` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '扩展名',
`md5` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'md5校验码',
`created_by` bigint(20) NULL DEFAULT 0 COMMENT '上传人ID',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态',
`created_at` datetime NULL DEFAULT NULL COMMENT '创建时间',
`updated_at` datetime NULL DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `md5`(`md5`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '附件管理' ROW_FORMAT = Dynamic;
INSERT INTO `sys_auth_rule` (`pid`, `name`, `title`, `icon`, `condition`, `remark`, `menu_type`, `weigh`, `is_hide`, `path`, `component`, `is_link`, `module_type`, `model_id`, `is_iframe`, `is_cached`, `redirect`, `is_affix`, `link_url`, `created_at`, `updated_at`) VALUES (35, 'api/v1/system/sysAttachment/list', '附件管理', 'ele-Folder', '', '', 1, 0, 0, '/system/sysAttachment/list', 'system/sysAttachment/list/index', 0, 'sys_admin', 0, 0, 1, '', 0, '', NULL, '2024-11-04 14:39:02');
SELECT @parentId := LAST_INSERT_ID();
INSERT INTO `sys_auth_rule` (`pid`, `name`, `title`, `icon`, `condition`, `remark`, `menu_type`, `weigh`, `is_hide`, `path`, `component`, `is_link`, `module_type`, `model_id`, `is_iframe`, `is_cached`, `redirect`, `is_affix`, `link_url`, `created_at`, `updated_at`) VALUES (@parentId, 'api/v1/system/sysAttachment/delete', '附件管理删除', '', '', '附件管理删除', 2, 0, 0, '', '', 0, 'sys_admin', 0, 0, 1, '', 0, '', NULL, NULL);
#添加字典数据
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES ('附件上传驱动', 'sys_upload_drive', 1, 31, 31, '', '2024-10-23 14:36:17', '2024-10-23 14:36:30');
INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES ('上传文件类型', 'sys_upload_file_type', 1, 31, 0, '', '2024-10-23 14:53:50', '2024-10-23 14:53:50');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '本地上传', '0', 'sys_upload_drive', '', '', 0, 1, 31, 0, '', '2024-10-23 14:37:27', '2024-10-23 14:37:27');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '腾讯云', '1', 'sys_upload_drive', '', '', 0, 1, 31, 31, '', '2024-10-23 14:37:38', '2024-10-23 14:38:05');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '七牛云', '2', 'sys_upload_drive', '', '', 0, 1, 31, 31, '', '2024-10-23 14:37:52', '2024-10-23 14:38:43');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '阿里云', '3', 'sys_upload_drive', '', '', 0, 1, 31, 31, '', '2024-10-23 14:38:11', '2024-10-23 14:38:49');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '图片', 'image', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:54:18', '2024-10-23 14:54:18');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '文档', 'doc', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:54:32', '2024-10-23 14:54:32');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '音频', 'audio', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:54:55', '2024-10-23 14:54:55');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '视频', 'video', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:55:09', '2024-10-23 14:55:09');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '压缩包', 'zip', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:55:22', '2024-10-23 14:55:22');
INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `update_by`, `remark`, `created_at`, `updated_at`) VALUES (0, '其它', 'other', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:55:40', '2024-10-23 14:55:40');
postgresql登陆到数据库执行下面这段添加更新的表格及数据
#postgresql执行该语句
#附件管理PG数据库语句
CREATE TABLE sys_attachment (
id BIGSERIAL NOT NULL PRIMARY KEY, -- 自增的文件ID
app_id VARCHAR(64) NOT NULL, -- 应用ID
drive VARCHAR(64) DEFAULT NULL, -- 上传驱动
name VARCHAR(1000) DEFAULT NULL, -- 文件原始名
kind VARCHAR(16) DEFAULT NULL, -- 上传类型
mime_type VARCHAR(128) NOT NULL DEFAULT '', -- 扩展类型
path VARCHAR(1000) DEFAULT NULL, -- 本地路径
size BIGINT DEFAULT 0, -- 文件大小
ext VARCHAR(50) DEFAULT NULL, -- 扩展名
md5 VARCHAR(32) DEFAULT NULL, -- md5校验码
created_by BIGINT DEFAULT 0, -- 上传人ID
"status" bool NOT NULL DEFAULT false, -- 状态
created_at TIMESTAMP DEFAULT NULL, -- 创建时间
updated_at TIMESTAMP DEFAULT NULL -- 修改时间
);
COMMENT ON TABLE sys_attachment IS '附件管理'; -- 添加表的注释
-- 添加列的注释
COMMENT ON COLUMN sys_attachment.id IS '文件ID';
COMMENT ON COLUMN sys_attachment.app_id IS '应用ID';
COMMENT ON COLUMN sys_attachment.drive IS '上传驱动';
COMMENT ON COLUMN sys_attachment.name IS '文件原始名';
COMMENT ON COLUMN sys_attachment.kind IS '上传类型';
COMMENT ON COLUMN sys_attachment.mime_type IS '扩展类型';
COMMENT ON COLUMN sys_attachment.path IS '本地路径';
COMMENT ON COLUMN sys_attachment.size IS '文件大小';
COMMENT ON COLUMN sys_attachment.ext IS '扩展名';
COMMENT ON COLUMN sys_attachment.md5 IS 'md5校验码';
COMMENT ON COLUMN sys_attachment.created_by IS '上传人ID';
COMMENT ON COLUMN sys_attachment.status IS '状态';
COMMENT ON COLUMN sys_attachment.created_at IS '创建时间';
COMMENT ON COLUMN sys_attachment.updated_at IS '修改时间';
CREATE INDEX md5_index ON sys_attachment (md5); -- 创建索引
DO $$
DECLARE
parent_id BIGINT; -- 假设 id 列的类型是 BIGINT
BEGIN
-- 第一个插入并获取上一次插入的自增 ID
INSERT INTO sys_auth_rule (pid, name, title, icon, condition, remark, menu_type, weigh, is_hide, path, component, is_link, module_type, model_id, is_iframe, is_cached, redirect, is_affix, link_url, created_at, updated_at)
VALUES (35, 'api/v1/system/sysAttachment/list', '附件管理', 'ele-Folder', '', '', 1, 0, 0, '/system/sysAttachment/list', 'system/sysAttachment/list/index', 0, 'sys_admin', 0, 0, 1, '', 0, '', NULL, '2024-11-04 14:39:02')
RETURNING id INTO parent_id; -- 这里获取自增 ID
-- 使用上次插入的 ID 进行第二个插入
INSERT INTO sys_auth_rule (pid, name, title, icon, condition, remark, menu_type, weigh, is_hide, path, component, is_link, module_type, model_id, is_iframe, is_cached, redirect, is_affix, link_url, created_at, updated_at)
VALUES (parent_id, 'api/v1/system/sysAttachment/delete', '附件管理删除', '', '', '附件管理删除', 2, 0, 0, '', '', 0, 'sys_admin', 0, 0, 1, '', 0, '', NULL, NULL);
END $$;
#字典数据
INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, update_by, remark, created_at, updated_at)
VALUES ('附件上传驱动', 'sys_upload_drive', 1, 31, 31, '', '2024-10-23 14:36:17', '2024-10-23 14:36:30');
INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, update_by, remark, created_at, updated_at)
VALUES ('上传文件类型', 'sys_upload_file_type', 1, 31, 0, '', '2024-10-23 14:53:50', '2024-10-23 14:53:50');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '本地上传', '0', 'sys_upload_drive', '', '', 0, 1, 31, 0, '', '2024-10-23 14:37:27', '2024-10-23 14:37:27');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '腾讯云', '1', 'sys_upload_drive', '', '', 0, 1, 31, 31, '', '2024-10-23 14:37:38', '2024-10-23 14:38:05');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '七牛云', '2', 'sys_upload_drive', '', '', 0, 1, 31, 31, '', '2024-10-23 14:37:52', '2024-10-23 14:38:43');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '阿里云', '3', 'sys_upload_drive', '', '', 0, 1, 31, 31, '', '2024-10-23 14:38:11', '2024-10-23 14:38:49');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '图片', 'image', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:54:18', '2024-10-23 14:54:18');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '文档', 'doc', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:54:32', '2024-10-23 14:54:32');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '音频', 'audio', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:54:55', '2024-10-23 14:54:55');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '视频', 'video', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:55:09', '2024-10-23 14:55:09');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '压缩包', 'zip', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:55:22', '2024-10-23 14:55:22');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, update_by, remark, created_at, updated_at)
VALUES (0, '其它', 'other', 'sys_upload_file_type', '', '', 0, 1, 31, 0, '', '2024-10-23 14:55:40', '2024-10-23 14:55:40');
注意:如果使用pg数据库中存json
数据,字段类型请使用json
或jsonb
否则可能出现json解析错误
作者:管理员 创建时间:2024-11-19 10:20
最后编辑:管理员 更新时间:2024-11-21 16:10
最后编辑:管理员 更新时间:2024-11-21 16:10