Browse Source

自动化代码模板bug调整

main
蒋吉兆 3 years ago
parent
commit
6ccc4c0e5e
  1. 2
      server/api/v1/autocode/autocodeExample.go
  2. 0
      server/model/autocode/request/autocodeExample.go
  3. 9
      server/resource/template/server/api.go.tpl
  4. 2
      server/resource/template/server/router.go.tpl
  5. 7
      server/resource/template/server/service.go.tpl
  6. 2
      server/service/autocode/autocodeExample.go
  7. 2
      server/service/example/exa_file_upload_download.go

2
server/api/v1/autocode/autocodeExample.go

@ -3,7 +3,7 @@ package autocode
import ( import (
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model/autocode" "gin-vue-admin/model/autocode"
autocodeReq "gin-vue-admin/model/autocode/requset"
autocodeReq "gin-vue-admin/model/autocode/request"
"gin-vue-admin/model/common/response" "gin-vue-admin/model/common/response"
"gin-vue-admin/service" "gin-vue-admin/service"
"gin-vue-admin/utils" "gin-vue-admin/utils"

0
server/model/autocode/requset/autocodeExample.go → server/model/autocode/request/autocodeExample.go

9
server/resource/template/server/api.go.tpl

@ -1,13 +1,12 @@
package v1
package autocode
import ( import (
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model/autocode" "gin-vue-admin/model/autocode"
"gin-vue-admin/model/common/requset"
autocodeReq "gin-vue-admin/model/autocode/requset"
"gin-vue-admin/model/common/request"
autocodeReq "gin-vue-admin/model/autocode/request"
"gin-vue-admin/model/common/response" "gin-vue-admin/model/common/response"
"gin-vue-admin/service" "gin-vue-admin/service"
"gin-vue-admin/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"go.uber.org/zap" "go.uber.org/zap"
) )
@ -28,7 +27,7 @@ var {{.Abbreviation}}Service = service.ServiceGroupApp.AutoCodeServiceGroup.{{.S
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
// @Router /{{.Abbreviation}}/create{{.StructName}} [post] // @Router /{{.Abbreviation}}/create{{.StructName}} [post]
func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Context) { func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Context) {
var {{.Abbreviation}} model.{{.StructName}}
var {{.Abbreviation}} autocode.{{.StructName}}
_ = c.ShouldBindJSON(&{{.Abbreviation}}) _ = c.ShouldBindJSON(&{{.Abbreviation}})
if err := {{.Abbreviation}}Service.Create{{.StructName}}({{.Abbreviation}}); err != nil { if err := {{.Abbreviation}}Service.Create{{.StructName}}({{.Abbreviation}}); err != nil {
global.GVA_LOG.Error("创建失败!", zap.Any("err", err)) global.GVA_LOG.Error("创建失败!", zap.Any("err", err))

2
server/resource/template/server/router.go.tpl

@ -1,4 +1,4 @@
package router
package autocode
import ( import (
"gin-vue-admin/api/v1" "gin-vue-admin/api/v1"

7
server/resource/template/server/service.go.tpl

@ -1,9 +1,10 @@
package service
package autocode
import ( import (
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model/autocode" "gin-vue-admin/model/autocode"
"gin-vue-admin/model/autocode/request"
"gin-vue-admin/model/common/request"
autoCodeReq "gin-vue-admin/model/autocode/request"
) )
type {{.StructName}}Service struct { type {{.StructName}}Service struct {
@ -46,7 +47,7 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}(id uin
// Get{{.StructName}}InfoList 分页获取{{.StructName}}记录 // Get{{.StructName}}InfoList 分页获取{{.StructName}}记录
// Author [piexlmax](https://github.com/piexlmax) // Author [piexlmax](https://github.com/piexlmax)
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error, list interface{}, total int64) {
func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoList(info autoCodeReq.{{.StructName}}Search) (err error, list interface{}, total int64) {
limit := info.PageSize limit := info.PageSize
offset := info.PageSize * (info.Page - 1) offset := info.PageSize * (info.Page - 1)
// 创建db // 创建db

2
server/service/autocode/autocodeExample.go

@ -3,7 +3,7 @@ package autocode
import ( import (
"gin-vue-admin/global" "gin-vue-admin/global"
"gin-vue-admin/model/autocode" "gin-vue-admin/model/autocode"
"gin-vue-admin/model/autocode/requset"
"gin-vue-admin/model/autocode/request"
) )
type AutoCodeExampleService struct { type AutoCodeExampleService struct {

2
server/service/example/exa_file_upload_download.go

@ -52,7 +52,7 @@ func (e *FileUploadAndDownloadService) DeleteFile(file example.ExaFileUploadAndD
//@author: [piexlmax](https://github.com/piexlmax) //@author: [piexlmax](https://github.com/piexlmax)
//@function: GetFileRecordInfoList //@function: GetFileRecordInfoList
//@description: 分页获取数据 //@description: 分页获取数据
//@param: info requset.PageInfo
//@param: info request.PageInfo
//@return: err error, list interface{}, total int64 //@return: err error, list interface{}, total int64
func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) { func (e *FileUploadAndDownloadService) GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int64) {

Loading…
Cancel
Save