mirror of
https://github.com/flipped-aurora/gin-vue-admin.git
synced 2026-09-21 12:32:25 +00:00
update:发布2.9.2版本 (#2211)
* feat: 调整AI工作模式,更符合harness基准 * feat: 添加BusinessDB字段到PluginInitializeGorm结构体,并增加相关测试用例 * [middleware/jwt.go]: fix #2192 issues bug * docs: add auto plugin design spec * chore: ignore worktrees directory * feat: 调整代码辅助能力至插件 * feat: 添加警告条组件,提示授权用户访问限制 * fix: 修正商业用途版权声明链接 * feat: 调整agent.md 更加节省token * fix: 修改casbin版本为v3 * feat: 更新JSONMap和JSONSlice类型,优化GORM数据类型处理 * feat: 添加数据库就绪通知机制,优化插件注册流程 * feat: 重构API路径和描述,优化代码生成器和模板配置分组 * feat: 优化 person 页面的 css 作用域限制 * feat: 更新 vite 至 vite8 * 新增:MCP工具为指定URL的角色ID授权 * fix: 增加文件名合法性检查,拒绝包含非法字符的文件写入 * chore: 更新CI配置,升级Node.js和Go版本,调整checkout和setup动作版本 * feat: 为数据库连接增加最大复用时间配置 * feat: 为各数据库连接配置增加最大连接生命周期设置 * feat: 更新插件注册逻辑并优化API和菜单组件的标签显示 * feat: 更新版本号至v2.9.2并添加新插件路径信息 --------- Co-authored-by: taincheng <zhangtc@gmail.com> Co-authored-by: Azir-11 <2075125282@qq.com> Co-authored-by: lanxi <1220lanxi@gmail.com>
This commit is contained in:
co-authored by
taincheng
Azir-11
lanxi
parent
699817becc
commit
15e6e7685c
@@ -0,0 +1,65 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// SysAutoCodeHistory 自动代码生成记录,用于回滚与重放。
|
||||
type SysAutoCodeHistory struct {
|
||||
global.GVA_MODEL
|
||||
Table string `json:"tableName" gorm:"column:table_name;comment:表名"`
|
||||
Package string `json:"package" gorm:"column:package;comment:模块名或插件名"`
|
||||
Request string `json:"request" gorm:"type:text;column:request;comment:前端传入的结构化信息"`
|
||||
StructName string `json:"structName" gorm:"column:struct_name;comment:结构体名称"`
|
||||
Abbreviation string `json:"abbreviation" gorm:"column:abbreviation;comment:结构体简称"`
|
||||
BusinessDB string `json:"businessDb" gorm:"column:business_db;comment:业务库"`
|
||||
Description string `json:"description" gorm:"column:description;comment:结构体中文名"`
|
||||
Templates map[string]string `json:"template" gorm:"serializer:json;type:text;column:templates;comment:模板信息"`
|
||||
Injections map[string]string `json:"injections" gorm:"serializer:json;type:text;column:injections;comment:注入信息"`
|
||||
Flag int `json:"flag" gorm:"column:flag;comment:[0:创建,1:回滚]"`
|
||||
ApiIDs []uint `json:"apiIDs" gorm:"serializer:json;column:api_ids;comment:关联API ID"`
|
||||
MenuID uint `json:"menuId" gorm:"column:menu_id;comment:菜单ID"`
|
||||
ExportTemplateID uint `json:"exportTemplateID" gorm:"column:export_template_id;comment:导出模板ID"`
|
||||
AutoCodePackage SysAutoCodePackage `json:"autoCodePackage" gorm:"foreignKey:ID;references:PackageID"`
|
||||
PackageID uint `json:"packageID" gorm:"column:package_id;comment:包ID"`
|
||||
}
|
||||
|
||||
func (s *SysAutoCodeHistory) BeforeCreate(db *gorm.DB) error {
|
||||
_ = db
|
||||
templates := make(map[string]string, len(s.Templates))
|
||||
for key, value := range s.Templates {
|
||||
server := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.Server)
|
||||
if hasServer := strings.Index(key, server); hasServer != -1 {
|
||||
key = strings.TrimPrefix(key, server)
|
||||
keys := strings.Split(key, string(os.PathSeparator))
|
||||
key = path.Join(keys...)
|
||||
}
|
||||
|
||||
web := filepath.Join(global.GVA_CONFIG.AutoCode.Root, global.GVA_CONFIG.AutoCode.WebRoot())
|
||||
if hasWeb := strings.Index(value, web); hasWeb != -1 {
|
||||
value = strings.TrimPrefix(value, web)
|
||||
values := strings.Split(value, string(os.PathSeparator))
|
||||
templates[key] = path.Join(values...)
|
||||
continue
|
||||
}
|
||||
|
||||
if hasServer := strings.Index(value, server); hasServer != -1 {
|
||||
value = strings.TrimPrefix(value, server)
|
||||
values := strings.Split(value, string(os.PathSeparator))
|
||||
templates[key] = path.Join(values...)
|
||||
continue
|
||||
}
|
||||
}
|
||||
s.Templates = templates
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SysAutoCodeHistory) TableName() string {
|
||||
return "sys_auto_code_histories"
|
||||
}
|
||||
Reference in New Issue
Block a user