feature:自动化代码支持基础菜单创建

This commit is contained in:
piexlMax
2024-03-27 21:18:34 +08:00
parent 26cdb472f0
commit d31b01415b
3 changed files with 21 additions and 5 deletions

View File

@@ -389,7 +389,7 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
return err
}
}
if autoCode.AutoMoveFile || autoCode.AutoCreateApiToSql {
if autoCode.AutoMoveFile || autoCode.AutoCreateApiToSql || autoCode.AutoCreateMenuToSql {
if autoCode.TableName != "" {
err = AutoCodeHistoryServiceApp.CreateAutoCodeHistory(
string(meta),
@@ -573,10 +573,11 @@ func (autoCodeService *AutoCodeService) AutoCreateApi(a *system.AutoCodeStruct)
func (autoCodeService *AutoCodeService) AutoCreateMenu(a *system.AutoCodeStruct) (id uint, err error) {
var menu system.SysBaseMenu
err = global.GVA_DB.First(&menu, "name = ?", menu.Name).Error
err = global.GVA_DB.First(&menu, "name = ?", a.Abbreviation).Error
if err == nil {
return 0, errors.New("存在相同的菜单路由,请关闭自动创建菜单功能")
}
menu.ParentId = "0"
menu.Name = a.Abbreviation
menu.Path = a.Abbreviation
menu.Meta.Title = a.Description