From 90f3eddc1428ae4ffb993a86fe8c83f007dc08b7 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 13 Jul 2021 19:59:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E5=AE=8C=E5=96=84=E5=89=8D=E5=90=8E?= =?UTF-8?q?=E7=AB=AF=E5=9B=9E=E6=BB=9A=E4=BA=A4=E4=BA=92=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BA=A4=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/model/sys_autocode_history.go | 10 ++++++---- server/service/sys_auto_code.go | 4 ++++ server/service/sys_autocode_history.go | 6 ++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/server/model/sys_autocode_history.go b/server/model/sys_autocode_history.go index 74465c80..0a75c59b 100644 --- a/server/model/sys_autocode_history.go +++ b/server/model/sys_autocode_history.go @@ -7,10 +7,12 @@ import "gin-vue-admin/global" type SysAutoCodeHistory struct { global.GVA_MODEL TableName string `json:"tableName"` - RequestMeta string `gorm:"type:text" json:"requestMeta,omitempty"` // 前端传入的结构化信息 - AutoCodePath string `gorm:"type:text" json:"autoCodePath"` // 其他meta信息 path;path - InjectionMeta string `gorm:"type:text" json:"injectionMeta"` // 注入的内容 RouterPath@functionName@RouterString; - ApiIDs string `json:"apiIDs"` // api表注册内容 + RequestMeta string `gorm:"type:text" json:"requestMeta,omitempty"` // 前端传入的结构化信息 + AutoCodePath string `gorm:"type:text" json:"autoCodePath,omitempty"` // 其他meta信息 path;path + InjectionMeta string `gorm:"type:text" json:"injectionMeta,omitempty"` // 注入的内容 RouterPath@functionName@RouterString; + StructName string `json:"structName"` + StructCNName string `json:"structCNName"` + ApiIDs string `json:"apiIDs,omitempty"` // api表注册内容 Flag int // 表示对应状态 0 代表创建, 1 代表回滚 ... } diff --git a/server/service/sys_auto_code.go b/server/service/sys_auto_code.go index efd116b8..a4db85fc 100644 --- a/server/service/sys_auto_code.go +++ b/server/service/sys_auto_code.go @@ -185,6 +185,8 @@ func CreateTemp(autoCode model.AutoCodeStruct, ids ...uint) (err error) { if autoCode.TableName != "" { err = CreateAutoCodeHistory( string(meta), + autoCode.StructName, + autoCode.Description, bf.String(), injectionCodeMeta.String(), autoCode.TableName, @@ -193,6 +195,8 @@ func CreateTemp(autoCode model.AutoCodeStruct, ids ...uint) (err error) { } else { err = CreateAutoCodeHistory( string(meta), + autoCode.StructName, + autoCode.Description, bf.String(), injectionCodeMeta.String(), autoCode.StructName, diff --git a/server/service/sys_autocode_history.go b/server/service/sys_autocode_history.go index fbbc5b39..757da9f8 100644 --- a/server/service/sys_autocode_history.go +++ b/server/service/sys_autocode_history.go @@ -11,11 +11,13 @@ import ( ) // CreateAutoCodeHistory RouterPath : RouterPath@RouterString;RouterPath2@RouterString2 -func CreateAutoCodeHistory(meta, autoCodePath string, injectionMeta string, tableName string, apiIds string) error { +func CreateAutoCodeHistory(meta, structName, structCNName, autoCodePath string, injectionMeta string, tableName string, apiIds string) error { return global.GVA_DB.Create(&model.SysAutoCodeHistory{ RequestMeta: meta, AutoCodePath: autoCodePath, InjectionMeta: injectionMeta, + StructName: structName, + StructCNName: structCNName, TableName: tableName, ApiIDs: apiIds, }).Error @@ -74,6 +76,6 @@ func GetSysHistoryPage(info request.PageInfo) (err error, list interface{}, tota db := global.GVA_DB var fileLists []model.SysAutoCodeHistory err = db.Find(&fileLists).Count(&total).Error - err = db.Limit(limit).Offset(offset).Order("updated_at desc").Select("id,created_at,updated_at,table_name,auto_code_path,injection_meta,api_ids,flag").Find(&fileLists).Error + err = db.Limit(limit).Offset(offset).Order("updated_at desc").Select("id,created_at,updated_at,struct_name,struct_cn_name,flag").Find(&fileLists).Error return err, fileLists, total } From d452c996bd04bf71efd310ff51ada83bded64df1 Mon Sep 17 00:00:00 2001 From: songzhibin97 <718428482@qq.com> Date: Tue, 13 Jul 2021 20:07:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E8=A1=A5=E5=85=85=E8=BF=87=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/model/sys_autocode_history.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/sys_autocode_history.go b/server/model/sys_autocode_history.go index 0a75c59b..62ceaaa0 100644 --- a/server/model/sys_autocode_history.go +++ b/server/model/sys_autocode_history.go @@ -6,7 +6,7 @@ import "gin-vue-admin/global" type SysAutoCodeHistory struct { global.GVA_MODEL - TableName string `json:"tableName"` + TableName string `json:"tableName,omitempty"` RequestMeta string `gorm:"type:text" json:"requestMeta,omitempty"` // 前端传入的结构化信息 AutoCodePath string `gorm:"type:text" json:"autoCodePath,omitempty"` // 其他meta信息 path;path InjectionMeta string `gorm:"type:text" json:"injectionMeta,omitempty"` // 注入的内容 RouterPath@functionName@RouterString;