增加自动化代码匹配进入业务库功能 (#1249)

* Update api.go.tpl

修复不创建资源标识时 批量删除 方法内 deletedBy 未声明的问题

* 可自动创建业务库

* 自动化业务库回滚适配

* 修复断点续传路径穿越漏洞

* 增加指定菜单亮起功能

* 增加菜单高亮功能,调整版本号

* fixed: 用户后台注册没接收手机号和邮箱

Co-authored-by: dzwvip <dzwvip@qq.com>
Co-authored-by: SliverHorn <503551462@qq.com>
This commit is contained in:
奇淼(piexlmax
2022-10-15 13:55:47 +08:00
committed by GitHub
co-authored by dzwvip SliverHorn
parent 28c928890a
commit 03265e03fc
20 changed files with 140 additions and 64 deletions
+7 -3
View File
@@ -252,7 +252,7 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
}
}
// 增加判断: 重复创建struct
if autoCode.AutoMoveFile && AutoCodeHistoryServiceApp.Repeat(autoCode.StructName, autoCode.Package) {
if autoCode.AutoMoveFile && AutoCodeHistoryServiceApp.Repeat(autoCode.BusinessDB, autoCode.StructName, autoCode.Package) {
return RepeatErr
}
dataList, fileList, needMkdir, err := autoCodeService.getNeedList(&autoCode)
@@ -393,8 +393,12 @@ func (autoCodeService *AutoCodeService) GetAllTplFile(pathName string, fileList
//@param: tableName string, dbName string
//@return: err error, Columns []request.ColumnReq
func (autoCodeService *AutoCodeService) DropTable(tableName string) error {
return global.GVA_DB.Exec("DROP TABLE " + tableName).Error
func (autoCodeService *AutoCodeService) DropTable(BusinessDb, tableName string) error {
if BusinessDb != "" {
return global.GVA_DB.Exec("DROP TABLE " + tableName).Error
} else {
return global.MustGetGlobalDBByDBName(BusinessDb).Exec("DROP TABLE " + tableName).Error
}
}
//@author: [SliverHorn](https://github.com/SliverHorn)
@@ -53,9 +53,9 @@ func (autoCodeHistoryService *AutoCodeHistoryService) First(info *request.GetByI
// Repeat 检测重复
// Author [SliverHorn](https://github.com/SliverHorn)
// Author [songzhibin97](https://github.com/songzhibin97)
func (autoCodeHistoryService *AutoCodeHistoryService) Repeat(structName string, Package string) bool {
func (autoCodeHistoryService *AutoCodeHistoryService) Repeat(businessDB, structName, Package string) bool {
var count int64
global.GVA_DB.Model(&system.SysAutoCodeHistory{}).Where("struct_name = ? and package = ? and flag = 0", structName, Package).Count(&count)
global.GVA_DB.Model(&system.SysAutoCodeHistory{}).Where("business_db = ? and struct_name = ? and package = ? and flag = 0", businessDB, structName, Package).Count(&count)
return count > 0
}
@@ -84,7 +84,7 @@ func (autoCodeHistoryService *AutoCodeHistoryService) RollBack(info *systemReq.R
}
// 删除表
if info.DeleteTable {
if err = AutoCodeServiceApp.DropTable(md.TableName); err != nil {
if err = AutoCodeServiceApp.DropTable(md.BusinessDB, md.TableName); err != nil {
global.GVA_LOG.Error("ClearTag DropTable:", zap.Error(err))
}
}
+1
View File
@@ -59,6 +59,7 @@ func (baseMenuService *BaseMenuService) UpdateBaseMenu(menu system.SysBaseMenu)
upDateMap["hidden"] = menu.Hidden
upDateMap["component"] = menu.Component
upDateMap["title"] = menu.Title
upDateMap["active_name"] = menu.ActiveName
upDateMap["icon"] = menu.Icon
upDateMap["sort"] = menu.Sort