From 70b54b5b1a4c213326823d5106ed012630006e87 Mon Sep 17 00:00:00 2001 From: yxh Date: Mon, 30 Sep 2024 17:53:31 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90-?= =?UTF-8?q?=E5=8D=A1=E5=85=B3=E5=AD=97=E6=AE=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/template/vm/go/controller.template | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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 {