fix 代码生产细节完善,导出功能修复
This commit is contained in:
parent
7bfbf4e37d
commit
8c669310fe
@ -9,5 +9,5 @@ package consts
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
Logo = `CiAgIF9fX19fX19fX19fXyAgICAgICAgICAgX18gCiAgLyBfX19fLyBfX19fL19fXyBfX19fX18vIC9fCiAvIC8gX18vIC9fICAvIF9fIGAvIF9fXy8gX18vCi8gL18vIC8gX18vIC8gL18vIChfXyAgKSAvXyAgClxfX19fL18vICAgIFxfXyxfL19fX18vXF9fLyAg`
|
Logo = `CiAgIF9fX19fX19fX19fXyAgICAgICAgICAgX18gCiAgLyBfX19fLyBfX19fL19fXyBfX19fX18vIC9fCiAvIC8gX18vIC9fICAvIF9fIGAvIF9fXy8gX18vCi8gL18vIC8gX18vIC8gL18vIChfXyAgKSAvXyAgClxfX19fL18vICAgIFxfXyxfL19fX18vXF9fLyAg`
|
||||||
Version = "3.3.0"
|
Version = "3.3.1"
|
||||||
)
|
)
|
||||||
|
@ -20,14 +20,20 @@ package controller
|
|||||||
{{$hasCommonService:=false}}
|
{{$hasCommonService:=false}}
|
||||||
{{$excel :=false}}
|
{{$excel :=false}}
|
||||||
{{$serviceVal := "service"}}
|
{{$serviceVal := "service"}}
|
||||||
|
{{$modelVal := "model"}}
|
||||||
{{if ne .table.ModuleName "system"}}
|
{{if ne .table.ModuleName "system"}}
|
||||||
{{$serviceVal = "systemService"}}
|
{{$serviceVal = "systemService"}}
|
||||||
|
{{$modelVal = "systemModel"}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{$usedSystemModel := false}}
|
||||||
{{$impSystemService := false}}
|
{{$impSystemService := false}}
|
||||||
{{if or .table.ExcelPort .table.ExcelImp}}
|
{{if or .table.ExcelPort .table.ExcelImp}}
|
||||||
{{$excel = true}}
|
{{$excel = true}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .table.ExcelPort}}
|
{{if .table.ExcelPort}}
|
||||||
|
{{if .table.UseSnowId}}
|
||||||
|
{{$hasGconv = true}}
|
||||||
|
{{end}}
|
||||||
{{range $index, $column := .table.Columns}}
|
{{range $index, $column := .table.Columns}}
|
||||||
{{if ne $column.DictType ""}}
|
{{if ne $column.DictType ""}}
|
||||||
{{$hasGmap = true}}
|
{{$hasGmap = true}}
|
||||||
@ -42,6 +48,11 @@ package controller
|
|||||||
{{$hasGstr = true}}
|
{{$hasGstr = true}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if and (eq $column.HtmlType "userSelectorSingle" "userSelectorMultiple" "deptSelectorMultiple" "deptSelectorSingle") (ne $.table.ModuleName "system")}}
|
||||||
|
{{$usedSystemModel = true}}
|
||||||
|
{{$hasGconv = true}}
|
||||||
|
{{$impSystemService = true}}
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
import (
|
import (
|
||||||
@ -74,6 +85,9 @@ import (
|
|||||||
{{if and (ne $.table.ModuleName "system") $hasSystemApi}}
|
{{if and (ne $.table.ModuleName "system") $hasSystemApi}}
|
||||||
systemApi "{{$.goModName}}/api/v1/system"
|
systemApi "{{$.goModName}}/api/v1/system"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{if $usedSystemModel}}
|
||||||
|
systemModel "{{.goModName}}/internal/app/system/model"
|
||||||
|
{{end}}
|
||||||
{{if $hasCommonService}}
|
{{if $hasCommonService}}
|
||||||
commonService "{{.goModName}}/internal/app/common/service"
|
commonService "{{.goModName}}/internal/app/common/service"
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -229,6 +243,39 @@ func (c *{{$structName}}Controller) Export(ctx context.Context, req *{{.table.Mo
|
|||||||
if v.UpdatedUser!=nil{
|
if v.UpdatedUser!=nil{
|
||||||
{{$column.HtmlField}} = v.UpdatedUser.UserNickname
|
{{$column.HtmlField}} = v.UpdatedUser.UserNickname
|
||||||
}
|
}
|
||||||
|
{{else if eq $column.HtmlType "userSelectorSingle"}}
|
||||||
|
//{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str := ""
|
||||||
|
if v.Linked{{$column.GoField}} != nil {
|
||||||
|
{{$column.HtmlField}}Str = v.Linked{{$column.GoField}}.UserNickname
|
||||||
|
}
|
||||||
|
{{else if eq $column.HtmlType "userSelectorMultiple"}}
|
||||||
|
//{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str:=""
|
||||||
|
v.Linked{{$column.GoField}}, err = {{$serviceVal}}.SysUser().GetUsers(ctx, gconv.Interfaces(v.{{$column.GoField}}))
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for _, us := range v.Linked{{$column.GoField}} {
|
||||||
|
{{$column.HtmlField}}Str += us.UserNickname + ","
|
||||||
|
}
|
||||||
|
{{else if eq $column.HtmlType "deptSelectorSingle"}}
|
||||||
|
//{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str := ""
|
||||||
|
{{$column.HtmlField}}Obj := systemService.SysDept().GetByDept(ctx, v.DepartId)
|
||||||
|
if {{$column.HtmlField}}Obj != nil {
|
||||||
|
{{$column.HtmlField}}Str = {{$column.HtmlField}}Obj.DeptName
|
||||||
|
}
|
||||||
|
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
|
||||||
|
//{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str := ""
|
||||||
|
linked{{$column.GoField}} := make([]*{{$modelVal}}.LinkDeptRes, len(v.{{$column.GoField}}))
|
||||||
|
for lk, lv := range v.{{$column.GoField}} {
|
||||||
|
linked{{$column.GoField}}[lk] = {{$serviceVal}}.SysDept().GetByDept(ctx, lv)
|
||||||
|
}
|
||||||
|
for _, dv := range linked{{$column.GoField}} {
|
||||||
|
{{$column.HtmlField}}Str += dv.DeptName + ","
|
||||||
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
@ -259,6 +306,20 @@ func (c *{{$structName}}Controller) Export(ctx context.Context, req *{{.table.Mo
|
|||||||
{{$column.HtmlField}},
|
{{$column.HtmlField}},
|
||||||
{{else if eq $column.HtmlType "date" "datetime"}}
|
{{else if eq $column.HtmlType "date" "datetime"}}
|
||||||
v.{{$column.GoField}}.Format("Y-m-d H:i:s"),
|
v.{{$column.GoField}}.Format("Y-m-d H:i:s"),
|
||||||
|
{{else if eq $column.HtmlType "userSelectorSingle"}}
|
||||||
|
//用户选择器-单选-{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str,
|
||||||
|
{{else if eq $column.HtmlType "userSelectorMultiple"}}
|
||||||
|
//用户选择器-多选-{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str,
|
||||||
|
{{else if eq $column.HtmlType "deptSelectorSingle"}}
|
||||||
|
//部门选择器-单选-{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str,
|
||||||
|
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
|
||||||
|
//部门选择器-多选-{{$column.ColumnComment}}
|
||||||
|
{{$column.HtmlField}}Str,
|
||||||
|
{{else if and $column.IsPk $.table.UseSnowId}}
|
||||||
|
gconv.String(v.{{$column.GoField}}),
|
||||||
{{else}}
|
{{else}}
|
||||||
v.{{$column.GoField}},
|
v.{{$column.GoField}},
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -301,7 +301,7 @@ func (s *s{{.table.ClassName}})List(ctx context.Context, req *model.{{.table.Cla
|
|||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $column.HtmlType "userSelectorSingle"}}
|
{{if eq $column.HtmlType "userSelectorSingle"}}
|
||||||
Linked{{$column.GoField}} : v.Linked{{$column.GoField}},
|
Linked{{$column.GoField}} : v.Linked{{$column.GoField}},
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $column.HtmlType "userSelectorMultiple"}}
|
{{if eq $column.HtmlType "userSelectorMultiple"}}
|
||||||
@ -519,7 +519,10 @@ func (s *s{{.table.ClassName}})GetBy{{$pkGoField}}(ctx context.Context, {{$.tabl
|
|||||||
{{end}}
|
{{end}}
|
||||||
{{if $hasDeptSelector}}
|
{{if $hasDeptSelector}}
|
||||||
{{range $index, $column := .table.Columns}}
|
{{range $index, $column := .table.Columns}}
|
||||||
{{if eq $column.HtmlType "deptSelectorSingle"}}
|
{{if eq $column.HtmlType "userSelectorMultiple"}}
|
||||||
|
res.Linked{{$column.GoField}}, err = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysUser().GetUsers(ctx, gconv.Interfaces(res.{{$column.GoField}}))
|
||||||
|
liberr.ErrIsNil(ctx, err)
|
||||||
|
{{else if eq $column.HtmlType "deptSelectorSingle"}}
|
||||||
res.Linked{{$column.GoField}} = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, res.{{$column.GoField}})
|
res.Linked{{$column.GoField}} = {{if $usedSystemModule}}systemService{{else}}service{{end}}.SysDept().GetByDept(ctx, res.{{$column.GoField}})
|
||||||
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
|
{{else if eq $column.HtmlType "deptSelectorMultiple"}}
|
||||||
res.Linked{{$column.GoField}} = make([]*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.LinkDeptRes, len(res.{{$column.GoField}}))
|
res.Linked{{$column.GoField}} = make([]*{{if $usedSystemModel}}systemModel{{else}}model{{end}}.LinkDeptRes, len(res.{{$column.GoField}}))
|
||||||
|
@ -73,7 +73,7 @@ type {{.table.ClassName}}InfoRes struct {
|
|||||||
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
|
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $column.HtmlType "userSelectorMultiple"}}
|
{{if eq $column.HtmlType "userSelectorMultiple"}}
|
||||||
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}LinkUserRes `orm:"with:id={{$column.ColumnName}}" json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
|
Linked{{$column.GoField}} []*{{if $hasUser}}systemModel.{{end}}SysUserSimpleRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if eq $column.HtmlType "deptSelectorSingle"}}
|
{{if eq $column.HtmlType "deptSelectorSingle"}}
|
||||||
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
|
Linked{{$column.GoField}} *{{if $hasUser}}systemModel.{{end}}LinkDeptRes `json:"linked{{$column.GoField}}" dc:"{{$column.ColumnComment}}"`
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
{{else if eq $column.HtmlType "select" "selects"}}
|
{{else if eq $column.HtmlType "select" "selects"}}
|
||||||
{{if ne $column.LinkTableName ""}}
|
{{if ne $column.LinkTableName ""}}
|
||||||
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
|
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
|
||||||
<el-select filterable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}} {{if $column.IsCascadeParent}}@change="form{{$column.ColumnName | CaseCamel}}Changed"{{end}} {{if eq $column.HtmlType "selects"}}multiple{{end}}>
|
<el-select filterable clearable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}} {{if $column.IsCascadeParent}}@change="form{{$column.ColumnName | CaseCamel}}Changed"{{end}} {{if eq $column.HtmlType "selects"}}multiple{{end}}>
|
||||||
<el-option
|
<el-option
|
||||||
{{if $column.IsCascade}}
|
{{if $column.IsCascade}}
|
||||||
v-for="item in {{$column.HtmlField}}FormOptions"
|
v-for="item in {{$column.HtmlField}}FormOptions"
|
||||||
@ -54,7 +54,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{else if ne $column.DictType ""}}
|
{{else if ne $column.DictType ""}}
|
||||||
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
|
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
|
||||||
<el-select filterable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
|
<el-select filterable clearable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="dict in {{$column.HtmlField}}Options"
|
v-for="dict in {{$column.HtmlField}}Options"
|
||||||
:key="dict.value"
|
:key="dict.value"
|
||||||
@ -69,7 +69,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
{{else}}
|
{{else}}
|
||||||
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
|
<el-form-item label="{{$column.ColumnComment}}" prop="{{$column.HtmlField}}">
|
||||||
<el-select filterable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
|
<el-select filterable clearable v-model="formData.{{$column.HtmlField}}" placeholder="请选择{{$column.ColumnComment}}" {{if $column.IsPk}}v-bind:disabled="this.currentOp === 'edit'" {{end}}>
|
||||||
<el-option label="请选择字典生成" value="" />
|
<el-option label="请选择字典生成" value="" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user