diff --git a/main.go b/main.go
index efca6d7..8b55f2c 100644
--- a/main.go
+++ b/main.go
@@ -8,6 +8,7 @@ import (
_ "github.com/tiger1103/gfast/v3/internal/app/boot"
_ "github.com/tiger1103/gfast/v3/internal/app/system/packed"
"github.com/tiger1103/gfast/v3/internal/cmd"
+ _ "github.com/tiger1103/gfast/v3/library/libValidate"
_ "github.com/tiger1103/gfast/v3/task"
)
diff --git a/resource/template/vm/go/controller.template b/resource/template/vm/go/controller.template
index 83b96df..a180842 100644
--- a/resource/template/vm/go/controller.template
+++ b/resource/template/vm/go/controller.template
@@ -262,7 +262,7 @@ func (c *{{$structName}}Controller) Export(ctx context.Context, req *{{.table.Mo
{{else if eq $column.HtmlType "deptSelectorSingle"}}
//{{$column.ColumnComment}}
{{$column.HtmlField}}Str := ""
- {{$column.HtmlField}}Obj := systemService.SysDept().GetByDept(ctx, v.DepartId)
+ {{$column.HtmlField}}Obj := systemService.SysDept().GetByDept(ctx, v.{{$column.GoField}})
if {{$column.HtmlField}}Obj != nil {
{{$column.HtmlField}}Str = {{$column.HtmlField}}Obj.DeptName
}
diff --git a/resource/template/vm/go/logic.template b/resource/template/vm/go/logic.template
index 4e0b0af..598d78c 100644
--- a/resource/template/vm/go/logic.template
+++ b/resource/template/vm/go/logic.template
@@ -19,6 +19,7 @@ package {{$structName}}
{{$hasLinkTable:=false}}
{{$useCommonService:=false}}
{{$hasDeptSelector:=false}}
+{{$hasUserMultipleSelector:=false}}
{{$usedSystemModel := false}}
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "images" "file" "files" "imageSelector" "fileSelector"}}
@@ -27,6 +28,9 @@ package {{$structName}}
{{if eq $column.HtmlType "deptSelectorMultiple" "deptSelectorSingle"}}
{{$hasDeptSelector = true}}
{{end}}
+{{if eq $column.HtmlType "userSelectorMultiple"}}
+ {{$hasUserMultipleSelector = true}}
+{{end}}
{{if and (or (eq $column.HtmlField "createdBy" "updatedBy" "deletedBy" "deptId") (eq $column.HtmlType "userSelectorSingle" "userSelectorMultiple" "deptSelectorMultiple" "deptSelectorSingle")) (ne $.table.ModuleName "system")}}
{{$usedSystemModule = true}}
{{end}}
@@ -206,12 +210,12 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
listRes.List = make([]*model.{{.table.ClassName}}ListRes,len(res))
for k,v:=range res{
{{range $index, $column := .table.Columns}}
- {{if eq $column.HtmlType "userSelectorMultiple"}}
+ {{if and $column.IsList (eq $column.HtmlType "userSelectorMultiple")}}
var linked{{$column.GoField}} []*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.SysUserSimpleRes
linked{{$column.GoField}}, err = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysUser().GetUsers(ctx, gconv.Interfaces(v.{{$column.GoField}}))
liberr.ErrIsNil(ctx, err)
{{end}}
- {{if eq $column.HtmlType "deptSelectorMultiple"}}
+ {{if and $column.IsList (eq $column.HtmlType "deptSelectorMultiple")}}
linked{{$column.GoField}} := make([]*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.LinkDeptRes, len(v.{{$column.GoField}}))
for lk, lv := range v.{{$column.GoField}} {
linked{{$column.GoField}}[lk] = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, lv)
@@ -508,7 +512,7 @@ func (s *s{{.table.ClassName}})GetBy{{$pkGoField}}(ctx context.Context, {{$.tabl
err =g.Try(ctx, func(ctx context.Context){
err = dao.{{.table.ClassName}}.Ctx(ctx).WithAll().Where(dao.{{.table.ClassName}}.Columns().{{$pkGoField}}, {{$.table.PkColumn.HtmlField}}).Scan(&res)
liberr.ErrIsNil(ctx,err,"获取信息失败")
- {{if or $.table.HasDeptId $hasDeptSelector}}
+ {{if or $.table.HasDeptId $hasDeptSelector $hasUserMultipleSelector}}
if res!=nil{
{{if $.table.HasDeptId}}
{{if $usedSystemModule}}
@@ -517,7 +521,6 @@ func (s *s{{.table.ClassName}})GetBy{{$pkGoField}}(ctx context.Context, {{$.tabl
res.DeptInfo = service.SysDept().GetByDept(ctx, res.DeptId)
{{end}}
{{end}}
- {{if $hasDeptSelector}}
{{range $index, $column := .table.Columns}}
{{if eq $column.HtmlType "userSelectorMultiple"}}
res.Linked{{$column.GoField}}, err = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysUser().GetUsers(ctx, gconv.Interfaces(res.{{$column.GoField}}))
@@ -531,7 +534,6 @@ func (s *s{{.table.ClassName}})GetBy{{$pkGoField}}(ctx context.Context, {{$.tabl
}
{{end}}
{{end}}
- {{end}}
}
{{end}}
{{range $index, $column := .table.Columns}}
diff --git a/resource/template/vm/vue/edit-vue.template b/resource/template/vm/vue/edit-vue.template
index 037e64b..2aa2dfc 100644
--- a/resource/template/vm/vue/edit-vue.template
+++ b/resource/template/vm/vue/edit-vue.template
@@ -132,6 +132,7 @@
@@ -140,6 +141,7 @@