* 增强代码生成

This commit is contained in:
Kevin
2023-10-06 16:38:46 +08:00
parent b05f1fac36
commit f27241251c
5 changed files with 27 additions and 6 deletions

View File

@@ -186,9 +186,17 @@ func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) (err error)
importInput := gstr.Replace(temp.InputPath, "./", modName+"/")
importController := gstr.Replace(temp.ControllerPath, "./", modName+"/")
importService := "hotgo/internal/service"
importDao := "hotgo/internal/dao"
importEntity := "hotgo/internal/model/entity"
if temp.IsAddon {
importService = "hotgo/addons/" + in.In.AddonName + "/service"
}
if temp.IsAddon {
importDao = "hotgo/addons/" + in.In.AddonName + "/dao"
}
if temp.IsAddon {
importEntity = "hotgo/addons/" + in.In.AddonName + "/model/entity"
}
importWebApi := "@/api/" + gstr.LcFirst(in.In.VarName)
if temp.IsAddon {
@@ -221,6 +229,8 @@ func (l *gCurd) loadView(ctx context.Context, in *CurdPreviewInput) (err error)
"importWebApi": importWebApi, // 导入webApi
"apiPrefix": in.options.ApiPrefix, // api前缀
"componentPrefix": componentPrefix, // vue子组件前缀
"importDao": importDao, // vue子组件前缀
"importEntity": importEntity, // vue子组件前缀
})
in.view = view

View File

@@ -15,8 +15,8 @@ import (
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"@{.importEntity}"
"@{.importInput}"
"hotgo/utility/validate"
)
@{ if eq .options.Step.HasEdit true }

View File

@@ -16,13 +16,13 @@ import (
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gtime"
"github.com/gogf/gf/v2/util/gconv"
"hotgo/internal/dao"
"hotgo/internal/library/contexts"
"hotgo/internal/library/hgorm"
"hotgo/internal/library/hgorm/handler"
"@{.importInput}"
"hotgo/internal/model/input/form"
"@{.importService}"
"@{.importDao}"
"@{.importInput}"
"hotgo/utility/convert"
"hotgo/utility/excel"
"hotgo/utility/validate"