refactor🎨 : 修正模版

This commit is contained in:
zhangwenjian committed 2020-12-21 22:04:46 +08:00
1 parent 46ea5f18aa
commit eaa135e2ad
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -45,7 +45,7 @@ type {{.ClassName}}Control struct {
{{ range .Columns -}} {{ range .Columns -}}
{{$x := .Pk}} {{$x := .Pk}}
{{- if ($x) }} {{- if ($x) }}
{{.GoField}} uint `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}"` // {{.ColumnComment}} {{.GoField}} {{.GoType}} `uri:"{{.JsonField}}" comment:"{{.ColumnComment}}"` // {{.ColumnComment}}
{{- else if eq .GoField "CreatedAt" -}} {{- else if eq .GoField "CreatedAt" -}}
{{- else if eq .GoField "UpdatedAt" -}} {{- else if eq .GoField "UpdatedAt" -}}
{{- else if eq .GoField "DeletedAt" -}} {{- else if eq .GoField "DeletedAt" -}}
+3 -3
View File
@@ -109,7 +109,7 @@ func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
return return
} }
// 设置创建人 // 设置创建人
object.SetCreateBy(tools.GetUserIdUint(c)) object.SetCreateBy(tools.GetUserId(c))
service{{.ClassName}} := service.{{.ClassName}}{} service{{.ClassName}} := service.{{.ClassName}}{}
service{{.ClassName}}.Orm = db service{{.ClassName}}.Orm = db
@@ -146,7 +146,7 @@ func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
e.Error(c, http.StatusInternalServerError, err, "模型生成失败") e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
return return
} }
object.SetUpdateBy(tools.GetUserIdUint(c)) object.SetUpdateBy(tools.GetUserId(c))
//数据权限检查 //数据权限检查
p := actions.GetPermissionFromContext(c) p := actions.GetPermissionFromContext(c)
@@ -187,7 +187,7 @@ func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) {
} }
// 设置编辑人 // 设置编辑人
object.SetUpdateBy(tools.GetUserIdUint(c)) object.SetUpdateBy(tools.GetUserId(c))
// 数据权限检查 // 数据权限检查
p := actions.GetPermissionFromContext(c) p := actions.GetPermissionFromContext(c)