diff --git a/resource/template/vm/go/controller.template b/resource/template/vm/go/controller.template index 5241730..b3cd7de 100644 --- a/resource/template/vm/go/controller.template +++ b/resource/template/vm/go/controller.template @@ -23,6 +23,7 @@ package controller {{if ne .table.ModuleName "system"}} {{$serviceVal = "systemService"}} {{end}} +{{$impSystemService := false}} {{if or .table.ExcelPort .table.ExcelImp}} {{$excel = true}} {{end}} @@ -53,7 +54,7 @@ import ( {{if gt (len .table.LinkedTables) 0}} "errors" {{if ne $.table.ModuleName "system"}} - systemService "{{.goModName}}/internal/app/system/service" + {{$impSystemService = true}} {{else}} "{{.goModName}}/internal/app/system/service" {{end}} @@ -82,6 +83,16 @@ import ( "{{$.goModName}}/library/libUtils" "github.com/xuri/excelize/v2" {{end}} + {{if not $impSystemService}} + {{range $index,$column:= .table.Columns}} + {{if eq $column.HtmlType "switch"}} + {{$impSystemService = true}} + {{end}} + {{end}} + {{end}} + {{if $impSystemService}} + systemService "{{.goModName}}/internal/app/system/service" + {{end}} ) //// type {{$structName}}Controller struct {