修复生成的结构体 tag 字段错误以及其它注释和尾部空格问题 (#1968)
* 修复生成的结构体 tag 字段错误 * 移除字段注释多余尾部空格 * 文件模板注释 `@accept` 保持规范
This commit is contained in:
parent
93c0525ea5
commit
532d282509
|
@ -2,7 +2,7 @@
|
||||||
// {{.FuncName}} {{.FuncDesc}}
|
// {{.FuncName}} {{.FuncDesc}}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary {{.FuncDesc}}
|
// @Summary {{.FuncDesc}}
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
|
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
|
||||||
|
@ -22,7 +22,7 @@ func (a *{{.Abbreviation}}) {{.FuncName}}(c *gin.Context) {
|
||||||
// {{.FuncName}} {{.FuncDesc}}
|
// {{.FuncName}} {{.FuncDesc}}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary {{.FuncDesc}}
|
// @Summary {{.FuncDesc}}
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功"
|
// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功"
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
|
||||||
|
@ -37,4 +37,4 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api){{.FuncName}}(c *gin.Context) {
|
||||||
}
|
}
|
||||||
response.OkWithData("返回数据",c)
|
response.OkWithData("返回数据",c)
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// {{.FuncName}} {{.FuncDesc}}
|
// {{.FuncName}} {{.FuncDesc}}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary {{.FuncDesc}}
|
// @Summary {{.FuncDesc}}
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
|
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
|
||||||
|
@ -18,7 +18,7 @@ export const {{.Router}} = () => {
|
||||||
// {{.FuncName}} {{.FuncDesc}}
|
// {{.FuncName}} {{.FuncDesc}}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary {{.FuncDesc}}
|
// @Summary {{.FuncDesc}}
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
|
||||||
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
|
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
|
||||||
|
@ -29,4 +29,4 @@ export const {{.Router}} = () => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -27,7 +27,7 @@ type {{.StructName}}Api struct {}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 创建{{.Description}}
|
// @Summary 创建{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body {{.Package}}.{{.StructName}} true "创建{{.Description}}"
|
// @Param data body {{.Package}}.{{.StructName}} true "创建{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||||
|
@ -55,7 +55,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Con
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 删除{{.Description}}
|
// @Summary 删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body {{.Package}}.{{.StructName}} true "删除{{.Description}}"
|
// @Param data body {{.Package}}.{{.StructName}} true "删除{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||||
|
@ -78,7 +78,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Con
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 批量删除{{.Description}}
|
// @Summary 批量删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||||
// @Router /{{.Abbreviation}}/delete{{.StructName}}ByIds [delete]
|
// @Router /{{.Abbreviation}}/delete{{.StructName}}ByIds [delete]
|
||||||
|
@ -100,7 +100,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gi
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 更新{{.Description}}
|
// @Summary 更新{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body {{.Package}}.{{.StructName}} true "更新{{.Description}}"
|
// @Param data body {{.Package}}.{{.StructName}} true "更新{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||||
|
@ -128,7 +128,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 用id查询{{.Description}}
|
// @Summary 用id查询{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query {{.PrimaryField.FieldType}} true "用id查询{{.Description}}"
|
// @Param data query {{.PrimaryField.FieldType}} true "用id查询{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{data={{.Package}}.{{.StructName}},msg=string} "查询成功"
|
// @Success 200 {object} response.Response{data={{.Package}}.{{.StructName}},msg=string} "查询成功"
|
||||||
|
@ -149,7 +149,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
|
||||||
|
@ -167,7 +167,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query {{.Package}}Req.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
// @Param data query {{.Package}}Req.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
||||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||||
|
@ -198,7 +198,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
|
||||||
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 获取{{.StructName}}的数据源
|
// @Summary 获取{{.StructName}}的数据源
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "查询成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "查询成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}DataSource [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}DataSource [get]
|
||||||
|
@ -219,7 +219,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}DataSource(c *
|
||||||
// Get{{.StructName}}Public 不需要鉴权的{{.Description}}接口
|
// Get{{.StructName}}Public 不需要鉴权的{{.Description}}接口
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 不需要鉴权的{{.Description}}接口
|
// @Summary 不需要鉴权的{{.Description}}接口
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
||||||
|
|
|
@ -8,18 +8,18 @@
|
||||||
{{- else if eq .FieldType "video" }}
|
{{- else if eq .FieldType "video" }}
|
||||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "file" }}
|
{{- else if eq .FieldType "file" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "pictures" }}
|
{{- else if eq .FieldType "pictures" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "richtext" }}
|
{{- else if eq .FieldType "richtext" }}
|
||||||
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "json" }}
|
{{- else if eq .FieldType "json" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"object"`
|
||||||
{{- else if eq .FieldType "array" }}
|
{{- else if eq .FieldType "array" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }}
|
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}}{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
@ -54,18 +54,18 @@ type {{.StructName}} struct {
|
||||||
{{- else if eq .FieldType "video" }}
|
{{- else if eq .FieldType "video" }}
|
||||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "file" }}
|
{{- else if eq .FieldType "file" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "pictures" }}
|
{{- else if eq .FieldType "pictures" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "richtext" }}
|
{{- else if eq .FieldType "richtext" }}
|
||||||
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "json" }}
|
{{- else if eq .FieldType "json" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"object"`
|
||||||
{{- else if eq .FieldType "array" }}
|
{{- else if eq .FieldType "array" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }}
|
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}}{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .AutoCreateResource }}
|
{{- if .AutoCreateResource }}
|
||||||
CreatedBy uint `gorm:"column:created_by;comment:创建者"`
|
CreatedBy uint `gorm:"column:created_by;comment:创建者"`
|
||||||
|
|
|
@ -4,7 +4,7 @@ import service from '@/utils/request'
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 创建{{.Description}}
|
// @Summary 创建{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||||
|
@ -20,7 +20,7 @@ export const create{{.StructName}} = (data) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 删除{{.Description}}
|
// @Summary 删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||||
|
@ -36,7 +36,7 @@ export const delete{{.StructName}} = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 批量删除{{.Description}}
|
// @Summary 批量删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body request.IdsReq true "批量删除{{.Description}}"
|
// @Param data body request.IdsReq true "批量删除{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||||
|
@ -52,7 +52,7 @@ export const delete{{.StructName}}ByIds = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 更新{{.Description}}
|
// @Summary 更新{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||||
|
@ -68,7 +68,7 @@ export const update{{.StructName}} = (data) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 用id查询{{.Description}}
|
// @Summary 用id查询{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||||
|
@ -84,7 +84,7 @@ export const find{{.StructName}} = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query request.PageInfo true "分页获取{{.Description}}列表"
|
// @Param data query request.PageInfo true "分页获取{{.Description}}列表"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||||
|
@ -101,7 +101,7 @@ export const get{{.StructName}}List = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 获取数据源
|
// @Summary 获取数据源
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||||
// @Router /{{.Abbreviation}}/find{{.StructName}}DataSource [get]
|
// @Router /{{.Abbreviation}}/find{{.StructName}}DataSource [get]
|
||||||
|
@ -117,7 +117,7 @@ export const get{{.StructName}}DataSource = () => {
|
||||||
|
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 不需要鉴权的{{.Description}}接口
|
// @Summary 不需要鉴权的{{.Description}}接口
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query {{.Package}}Req.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
// @Param data query {{.Package}}Req.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
|
|
|
@ -27,7 +27,7 @@ type {{.Abbreviation}} struct {}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 创建{{.Description}}
|
// @Summary 创建{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
// @Success 200 {object} response.Response{msg=string} "创建成功"
|
||||||
|
@ -55,7 +55,7 @@ func (a *{{.Abbreviation}}) Create{{.StructName}}(c *gin.Context) {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 删除{{.Description}}
|
// @Summary 删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
// @Success 200 {object} response.Response{msg=string} "删除成功"
|
||||||
|
@ -78,7 +78,7 @@ func (a *{{.Abbreviation}}) Delete{{.StructName}}(c *gin.Context) {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 批量删除{{.Description}}
|
// @Summary 批量删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
// @Success 200 {object} response.Response{msg=string} "批量删除成功"
|
||||||
// @Router /{{.Abbreviation}}/delete{{.StructName}}ByIds [delete]
|
// @Router /{{.Abbreviation}}/delete{{.StructName}}ByIds [delete]
|
||||||
|
@ -100,7 +100,7 @@ func (a *{{.Abbreviation}}) Delete{{.StructName}}ByIds(c *gin.Context) {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 更新{{.Description}}
|
// @Summary 更新{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
// @Success 200 {object} response.Response{msg=string} "更新成功"
|
||||||
|
@ -128,7 +128,7 @@ func (a *{{.Abbreviation}}) Update{{.StructName}}(c *gin.Context) {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 用id查询{{.Description}}
|
// @Summary 用id查询{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
||||||
// @Success 200 {object} response.Response{data=model.{{.StructName}},msg=string} "查询成功"
|
// @Success 200 {object} response.Response{data=model.{{.StructName}},msg=string} "查询成功"
|
||||||
|
@ -149,7 +149,7 @@ func (a *{{.Abbreviation}}) Find{{.StructName}}(c *gin.Context) {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
|
||||||
|
@ -167,7 +167,7 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}List(c *gin.Context) {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
||||||
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "获取成功"
|
||||||
|
@ -198,7 +198,7 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}List(c *gin.Context) {
|
||||||
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
// Get{{.StructName}}DataSource 获取{{.StructName}}的数据源
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 获取{{.StructName}}的数据源
|
// @Summary 获取{{.StructName}}的数据源
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "查询成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "查询成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}DataSource [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}DataSource [get]
|
||||||
|
@ -217,7 +217,7 @@ func (a *{{.Abbreviation}}) Get{{.StructName}}DataSource(c *gin.Context) {
|
||||||
// Get{{.StructName}}Public 不需要鉴权的{{.Description}}接口
|
// Get{{.StructName}}Public 不需要鉴权的{{.Description}}接口
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 不需要鉴权的{{.Description}}接口
|
// @Summary 不需要鉴权的{{.Description}}接口
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
// @Router /{{.Abbreviation}}/get{{.StructName}}Public [get]
|
||||||
|
|
|
@ -8,18 +8,18 @@
|
||||||
{{- else if eq .FieldType "video" }}
|
{{- else if eq .FieldType "video" }}
|
||||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "file" }}
|
{{- else if eq .FieldType "file" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "pictures" }}
|
{{- else if eq .FieldType "pictures" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "richtext" }}
|
{{- else if eq .FieldType "richtext" }}
|
||||||
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "json" }}
|
{{- else if eq .FieldType "json" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"object"`
|
||||||
{{- else if eq .FieldType "array" }}
|
{{- else if eq .FieldType "array" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}} {{ end }}
|
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}}{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
@ -53,15 +53,15 @@ type {{.StructName}} struct {
|
||||||
{{- else if eq .FieldType "video" }}
|
{{- else if eq .FieldType "video" }}
|
||||||
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "file" }}
|
{{- else if eq .FieldType "file" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "pictures" }}
|
{{- else if eq .FieldType "pictures" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else if eq .FieldType "richtext" }}
|
{{- else if eq .FieldType "richtext" }}
|
||||||
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- else if eq .FieldType "json" }}
|
{{- else if eq .FieldType "json" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"object"`
|
||||||
{{- else if eq .FieldType "array" }}
|
{{- else if eq .FieldType "array" }}
|
||||||
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end -}} swaggertype:"array,object"`
|
{{.FieldName}} datatypes.JSON `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}type:text;" {{- if .Require }} binding:"required"{{- end }} swaggertype:"array,object"`
|
||||||
{{- else }}
|
{{- else }}
|
||||||
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"{{- if ne .FieldIndexType "" -}}{{ .FieldIndexType }};{{- end -}}{{- if .PrimaryKey -}}primarykey;{{- end -}}{{- if .DefaultValue -}}default:{{ .DefaultValue }};{{- end -}}column:{{.ColumnName}};comment:{{.Comment}};{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}" {{- if .Require }} binding:"required"{{- end -}}`
|
||||||
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}}{{ end }}
|
{{- end }} {{ if .FieldDesc }}//{{.FieldDesc}}{{ end }}
|
||||||
|
|
|
@ -3,7 +3,7 @@ import service from '@/utils/request'
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 创建{{.Description}}
|
// @Summary 创建{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
// @Param data body model.{{.StructName}} true "创建{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
|
||||||
|
@ -19,7 +19,7 @@ export const create{{.StructName}} = (data) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 删除{{.Description}}
|
// @Summary 删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
// @Param data body model.{{.StructName}} true "删除{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||||
|
@ -35,7 +35,7 @@ export const delete{{.StructName}} = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 批量删除{{.Description}}
|
// @Summary 批量删除{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body request.IdsReq true "批量删除{{.Description}}"
|
// @Param data body request.IdsReq true "批量删除{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||||
|
@ -51,7 +51,7 @@ export const delete{{.StructName}}ByIds = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 更新{{.Description}}
|
// @Summary 更新{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
// @Param data body model.{{.StructName}} true "更新{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
|
||||||
|
@ -67,7 +67,7 @@ export const update{{.StructName}} = (data) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 用id查询{{.Description}}
|
// @Summary 用id查询{{.Description}}
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
// @Param data query model.{{.StructName}} true "用id查询{{.Description}}"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||||
|
@ -83,7 +83,7 @@ export const find{{.StructName}} = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 分页获取{{.Description}}列表
|
// @Summary 分页获取{{.Description}}列表
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query request.PageInfo true "分页获取{{.Description}}列表"
|
// @Param data query request.PageInfo true "分页获取{{.Description}}列表"
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
|
||||||
|
@ -100,7 +100,7 @@ export const get{{.StructName}}List = (params) => {
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 获取数据源
|
// @Summary 获取数据源
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
|
||||||
// @Router /{{.Abbreviation}}/find{{.StructName}}DataSource [get]
|
// @Router /{{.Abbreviation}}/find{{.StructName}}DataSource [get]
|
||||||
|
@ -114,7 +114,7 @@ export const get{{.StructName}}DataSource = () => {
|
||||||
{{- end}}
|
{{- end}}
|
||||||
// @Tags {{.StructName}}
|
// @Tags {{.StructName}}
|
||||||
// @Summary 不需要鉴权的{{.Description}}接口
|
// @Summary 不需要鉴权的{{.Description}}接口
|
||||||
// @accept application/json
|
// @Accept application/json
|
||||||
// @Produce application/json
|
// @Produce application/json
|
||||||
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
|
||||||
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
|
||||||
|
@ -124,4 +124,4 @@ export const get{{.StructName}}Public = () => {
|
||||||
url: '/{{.Abbreviation}}/get{{.StructName}}Public',
|
url: '/{{.Abbreviation}}/get{{.StructName}}Public',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue