Ver Fonte

Merge branch 'gva_gormv2_dev' into develop

songzhibin97 há 3 anos atrás
pai
commit
1c07b5e5cf
100 ficheiros alterados com 1003 adições e 729 exclusões
  1. 121 0
      server/api/v1/autocode/autocodeExample.go
  2. 7 0
      server/api/v1/autocode/enter.go
  3. 15 0
      server/api/v1/enter.go
  4. 15 0
      server/api/v1/example/enter.go
  5. 16 16
      server/api/v1/example/exa_breakpoint_continue.go
  6. 25 22
      server/api/v1/example/exa_customer.go
  7. 13 11
      server/api/v1/example/exa_excel.go
  8. 17 14
      server/api/v1/example/exa_file_upload_download.go
  9. 16 14
      server/api/v1/example/exa_simple_uploader.go
  10. 34 0
      server/api/v1/system/enter.go
  11. 30 26
      server/api/v1/system/sys_api.go
  12. 32 27
      server/api/v1/system/sys_authority.go
  13. 37 35
      server/api/v1/system/sys_auto_code.go
  14. 8 4
      server/api/v1/system/sys_captcha.go
  15. 12 9
      server/api/v1/system/sys_casbin.go
  16. 21 19
      server/api/v1/system/sys_dictionary.go
  17. 21 19
      server/api/v1/system/sys_dictionary_detail.go
  18. 4 5
      server/api/v1/system/sys_email.go
  19. 9 8
      server/api/v1/system/sys_initdb.go
  20. 9 7
      server/api/v1/system/sys_jwt_blacklist.go
  21. 36 32
      server/api/v1/system/sys_menu.go
  22. 22 19
      server/api/v1/system/sys_operation_record.go
  23. 16 13
      server/api/v1/system/sys_system.go
  24. 46 78
      server/api/v1/system/sys_user.go
  25. 5 5
      server/config.yaml
  26. 19 16
      server/initialize/gorm.go
  27. 24 18
      server/initialize/router.go
  28. 5 3
      server/middleware/casbin_rbac.go
  29. 6 4
      server/middleware/email.go
  30. 11 9
      server/middleware/jwt.go
  31. 1 1
      server/middleware/need_init.go
  32. 6 4
      server/middleware/operation.go
  33. 12 0
      server/model/autocode/autocodeExample.go
  34. 13 0
      server/model/autocode/request/autocodeExample.go
  35. 0 0
      server/model/common/request/common.go
  36. 0 0
      server/model/common/response/common.go
  37. 0 0
      server/model/common/response/response.go
  38. 0 14
      server/model/exa_customer.go
  39. 0 6
      server/model/exa_excel.go
  40. 1 1
      server/model/example/exa_breakpoint_continue.go
  41. 15 0
      server/model/example/exa_customer.go
  42. 8 0
      server/model/example/exa_excel.go
  43. 1 1
      server/model/example/exa_file_upload_download.go
  44. 1 1
      server/model/example/exa_simple_uploader.go
  45. 2 2
      server/model/example/response/exa_breakpoint_continue.go
  46. 7 0
      server/model/example/response/exa_customer.go
  47. 7 0
      server/model/example/response/exa_file_upload_download.go
  48. 0 8
      server/model/request/sys_dictionary.go
  49. 0 8
      server/model/request/sys_dictionary_detail.go
  50. 0 8
      server/model/request/sys_operation_record.go
  51. 0 7
      server/model/response/exa_customer.go
  52. 0 7
      server/model/response/exa_file_upload_download.go
  53. 0 11
      server/model/response/sys_api.go
  54. 0 12
      server/model/response/sys_authority.go
  55. 0 15
      server/model/response/sys_menu.go
  56. 0 15
      server/model/response/sys_user.go
  57. 0 36
      server/model/sys_base_menu.go
  58. 0 0
      server/model/system/request/jwt.go
  59. 6 3
      server/model/system/request/sys_api.go
  60. 3 1
      server/model/system/request/sys_autocode.go
  61. 0 0
      server/model/system/request/sys_casbin.go
  62. 11 0
      server/model/system/request/sys_dictionary.go
  63. 11 0
      server/model/system/request/sys_dictionary_detail.go
  64. 0 0
      server/model/system/request/sys_init.go
  65. 5 5
      server/model/system/request/sys_menu.go
  66. 11 0
      server/model/system/request/sys_operation_record.go
  67. 0 0
      server/model/system/request/sys_user.go
  68. 11 0
      server/model/system/response/sys_api.go
  69. 12 0
      server/model/system/response/sys_authority.go
  70. 0 0
      server/model/system/response/sys_captcha.go
  71. 3 1
      server/model/system/response/sys_casbin.go
  72. 15 0
      server/model/system/response/sys_menu.go
  73. 0 0
      server/model/system/response/sys_system.go
  74. 15 0
      server/model/system/response/sys_user.go
  75. 4 4
      server/model/system/sys_api.go
  76. 1 1
      server/model/system/sys_authority.go
  77. 1 1
      server/model/system/sys_authority_menu.go
  78. 1 1
      server/model/system/sys_auto_code.go
  79. 1 1
      server/model/system/sys_autocode_history.go
  80. 36 0
      server/model/system/sys_base_menu.go
  81. 1 1
      server/model/system/sys_casbin.go
  82. 1 1
      server/model/system/sys_dictionary.go
  83. 1 1
      server/model/system/sys_dictionary_detail.go
  84. 1 1
      server/model/system/sys_initdb.go
  85. 1 1
      server/model/system/sys_jwt_blacklist.go
  86. 1 1
      server/model/system/sys_operation_record.go
  87. 1 1
      server/model/system/sys_system.go
  88. 5 5
      server/model/system/sys_user.go
  89. 33 26
      server/resource/template/server/api.go.tpl
  90. 2 2
      server/resource/template/server/model.go.tpl
  91. 6 3
      server/resource/template/server/request.go.tpl
  92. 13 9
      server/resource/template/server/router.go.tpl
  93. 19 15
      server/resource/template/server/service.go.tpl
  94. 1 1
      server/resource/template/web/table.vue.tpl
  95. 22 0
      server/router/autocode/autocodeExample.go
  96. 7 0
      server/router/autocode/enter.go
  97. 15 0
      server/router/enter.go
  98. 0 18
      server/router/exa_customer.go
  99. 0 16
      server/router/exa_excel.go
  100. 0 19
      server/router/exa_file_upload_and_download.go

+ 121 - 0
server/api/v1/autocode/autocodeExample.go

@@ -0,0 +1,121 @@
+package autocode
+
+import (
+	"gin-vue-admin/global"
+	"gin-vue-admin/model/autocode"
+	autocodeReq "gin-vue-admin/model/autocode/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/service"
+	"gin-vue-admin/utils"
+	"github.com/gin-gonic/gin"
+	"go.uber.org/zap"
+)
+
+type AutoCodeExampleApi struct {
+}
+
+var autoCodeExampleService = service.ServiceGroupApp.AutoCodeServiceGroup.AutoCodeExampleService
+
+// @Tags AutoCodeExample
+// @Summary 创建AutoCodeExample
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.AutoCodeExample true "AutoCodeExample模型"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
+// @Router /autoCodeExample/createAutoCodeExample [post]
+func (autoCodeExampleApi *AutoCodeExampleApi) CreateAutoCodeExample(c *gin.Context) {
+	var autoCodeExample autocode.AutoCodeExample
+	_ = c.ShouldBindJSON(&autoCodeExample)
+	if err := autoCodeExampleService.CreateAutoCodeExample(autoCodeExample); err != nil {
+		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
+		response.FailWithMessage("创建失败", c)
+	} else {
+		response.OkWithMessage("创建成功", c)
+	}
+}
+
+// @Tags AutoCodeExample
+// @Summary 删除AutoCodeExample
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.AutoCodeExample true "AutoCodeExample模型"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
+// @Router /autoCodeExample/deleteAutoCodeExample [delete]
+func (autoCodeExampleApi *AutoCodeExampleApi) DeleteAutoCodeExample(c *gin.Context) {
+	var autoCodeExample autocode.AutoCodeExample
+	_ = c.ShouldBindJSON(&autoCodeExample)
+	if err := autoCodeExampleService.DeleteAutoCodeExample(autoCodeExample); err != nil {
+		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
+		response.FailWithMessage("删除失败", c)
+	} else {
+		response.OkWithMessage("删除成功", c)
+	}
+}
+
+// @Tags AutoCodeExample
+// @Summary 更新AutoCodeExample
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.AutoCodeExample true "更新AutoCodeExample"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
+// @Router /autoCodeExample/updateAutoCodeExample [put]
+func (autoCodeExampleApi *AutoCodeExampleApi) UpdateAutoCodeExample(c *gin.Context) {
+	var autoCodeExample autocode.AutoCodeExample
+	_ = c.ShouldBindJSON(&autoCodeExample)
+	if err := autoCodeExampleService.UpdateAutoCodeExample(&autoCodeExample); err != nil {
+		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
+		response.FailWithMessage("更新失败", c)
+	} else {
+		response.OkWithMessage("更新成功", c)
+	}
+}
+
+// @Tags AutoCodeExample
+// @Summary 用id查询AutoCodeExample
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocode.AutoCodeExample true "用id查询AutoCodeExample"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
+// @Router /autoCodeExample/findAutoCodeExample [get]
+func (autoCodeExampleApi *AutoCodeExampleApi) FindAutoCodeExample(c *gin.Context) {
+	var autoCodeExample autocode.AutoCodeExample
+	_ = c.ShouldBindQuery(&autoCodeExample)
+	if err := utils.Verify(autoCodeExample, utils.IdVerify); err != nil {
+		response.FailWithMessage(err.Error(), c)
+		return
+	}
+	if err, reAutoCodeExample := autoCodeExampleService.GetAutoCodeExample(autoCodeExample.ID); err != nil {
+		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
+		response.FailWithMessage("查询失败", c)
+	} else {
+		response.OkWithDetailed(gin.H{"reAutoCodeExample": reAutoCodeExample}, "查询成功", c)
+	}
+}
+
+// @Tags AutoCodeExample
+// @Summary 分页获取AutoCodeExample列表
+// @Security ApiKeyAuth
+// @accept application/json
+// @Produce application/json
+// @Param data body autocodeReq.AutoCodeExampleSearch true "页码, 每页大小, 搜索条件"
+// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
+// @Router /autoCodeExample/getAutoCodeExampleList [get]
+func (autoCodeExampleApi *AutoCodeExampleApi) GetAutoCodeExampleList(c *gin.Context) {
+	var pageInfo autocodeReq.AutoCodeExampleSearch
+	_ = c.ShouldBindQuery(&pageInfo)
+	if err, list, total := autoCodeExampleService.GetAutoCodeExampleInfoList(pageInfo); err != nil {
+		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
+		response.FailWithMessage("获取失败", c)
+	} else {
+		response.OkWithDetailed(response.PageResult{
+			List:     list,
+			Total:    total,
+			Page:     pageInfo.Page,
+			PageSize: pageInfo.PageSize,
+		}, "获取成功", c)
+	}
+}

+ 7 - 0
server/api/v1/autocode/enter.go

@@ -0,0 +1,7 @@
+package autocode
+
+type ApiGroup struct {
+	// Code generated by gin-vue-admin Begin; DO NOT EDIT.
+	AutoCodeExampleApi
+	// Code generated by gin-vue-admin End; DO NOT EDIT.
+}

+ 15 - 0
server/api/v1/enter.go

@@ -0,0 +1,15 @@
+package v1
+
+import (
+	"gin-vue-admin/api/v1/autocode"
+	"gin-vue-admin/api/v1/example"
+	"gin-vue-admin/api/v1/system"
+)
+
+type ApiGroup struct {
+	ExampleApiGroup  example.ApiGroup
+	SystemApiGroup   system.ApiGroup
+	AutoCodeApiGroup autocode.ApiGroup
+}
+
+var ApiGroupApp = new(ApiGroup)

+ 15 - 0
server/api/v1/example/enter.go

@@ -0,0 +1,15 @@
+package example
+
+import "gin-vue-admin/service"
+
+type ApiGroup struct {
+	CustomerApi
+	ExcelApi
+	FileUploadAndDownloadApi
+	SimpleUploaderApi
+}
+
+var fileUploadAndDownloadService = service.ServiceGroupApp.ExampleServiceGroup.FileUploadAndDownloadService
+var customerService = service.ServiceGroupApp.ExampleServiceGroup.CustomerService
+var excelService = service.ServiceGroupApp.ExampleServiceGroup.ExcelService
+var simpleUploaderService = service.ServiceGroupApp.ExampleServiceGroup.SimpleUploaderService

+ 16 - 16
server/api/v1/exa_breakpoint_continue.go → server/api/v1/example/exa_breakpoint_continue.go

@@ -1,9 +1,9 @@
-package v1
+package example
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	exampleRes "gin-vue-admin/model/example/response"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
@@ -19,7 +19,7 @@ import (
 // @Param file formData file true "an example for breakpoint resume, 断点续传示例"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"切片创建成功"}"
 // @Router /fileUploadAndDownload/breakpointContinue [post]
-func BreakpointContinue(c *gin.Context) {
+func (u *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) {
 	fileMd5 := c.Request.FormValue("fileMd5")
 	fileName := c.Request.FormValue("fileName")
 	chunkMd5 := c.Request.FormValue("chunkMd5")
@@ -44,7 +44,7 @@ func BreakpointContinue(c *gin.Context) {
 		response.FailWithMessage("检查md5失败", c)
 		return
 	}
-	err, file := service.FindOrCreateFile(fileMd5, fileName, chunkTotal)
+	err, file := fileUploadAndDownloadService.FindOrCreateFile(fileMd5, fileName, chunkTotal)
 	if err != nil {
 		global.GVA_LOG.Error("查找或创建记录失败!", zap.Any("err", err))
 		response.FailWithMessage("查找或创建记录失败", c)
@@ -57,7 +57,7 @@ func BreakpointContinue(c *gin.Context) {
 		return
 	}
 
-	if err = service.CreateFileChunk(file.ID, pathc, chunkNumber); err != nil {
+	if err = fileUploadAndDownloadService.CreateFileChunk(file.ID, pathc, chunkNumber); err != nil {
 		global.GVA_LOG.Error("创建文件记录失败!", zap.Any("err", err))
 		response.FailWithMessage("创建文件记录失败", c)
 		return
@@ -73,16 +73,16 @@ func BreakpointContinue(c *gin.Context) {
 // @Param file formData file true "Find the file, 查找文件"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
 // @Router /fileUploadAndDownload/findFile [post]
-func FindFile(c *gin.Context) {
+func (u *FileUploadAndDownloadApi) FindFile(c *gin.Context) {
 	fileMd5 := c.Query("fileMd5")
 	fileName := c.Query("fileName")
 	chunkTotal, _ := strconv.Atoi(c.Query("chunkTotal"))
-	err, file := service.FindOrCreateFile(fileMd5, fileName, chunkTotal)
+	err, file := fileUploadAndDownloadService.FindOrCreateFile(fileMd5, fileName, chunkTotal)
 	if err != nil {
 		global.GVA_LOG.Error("查找失败!", zap.Any("err", err))
 		response.FailWithMessage("查找失败", c)
 	} else {
-		response.OkWithDetailed(response.FileResponse{File: file}, "查找成功", c)
+		response.OkWithDetailed(exampleRes.FileResponse{File: file}, "查找成功", c)
 	}
 }
 
@@ -94,15 +94,15 @@ func FindFile(c *gin.Context) {
 // @Param file formData file true "上传文件完成"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"file uploaded, 文件创建成功"}"
 // @Router /fileUploadAndDownload/findFile [post]
-func BreakpointContinueFinish(c *gin.Context) {
+func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) {
 	fileMd5 := c.Query("fileMd5")
 	fileName := c.Query("fileName")
 	err, filePath := utils.MakeFile(fileName, fileMd5)
 	if err != nil {
 		global.GVA_LOG.Error("文件创建失败!", zap.Any("err", err))
-		response.FailWithDetailed(response.FilePathResponse{FilePath: filePath}, "文件创建失败", c)
+		response.FailWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "文件创建失败", c)
 	} else {
-		response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "文件创建成功", c)
+		response.OkWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "文件创建成功", c)
 	}
 }
 
@@ -114,16 +114,16 @@ func BreakpointContinueFinish(c *gin.Context) {
 // @Param file formData file true "删除缓存切片"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"缓存切片删除成功"}"
 // @Router /fileUploadAndDownload/removeChunk [post]
-func RemoveChunk(c *gin.Context) {
+func (u *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) {
 	fileMd5 := c.Query("fileMd5")
 	fileName := c.Query("fileName")
 	filePath := c.Query("filePath")
 	err := utils.RemoveChunk(fileMd5)
-	err = service.DeleteFileChunk(fileMd5, fileName, filePath)
+	err = fileUploadAndDownloadService.DeleteFileChunk(fileMd5, fileName, filePath)
 	if err != nil {
 		global.GVA_LOG.Error("缓存切片删除失败!", zap.Any("err", err))
-		response.FailWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除失败", c)
+		response.FailWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "缓存切片删除失败", c)
 	} else {
-		response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
+		response.OkWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
 	}
 }

+ 25 - 22
server/api/v1/exa_customer.go → server/api/v1/example/exa_customer.go

@@ -1,16 +1,19 @@
-package v1
+package example
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/example"
+	exampleRes "gin-vue-admin/model/example/response"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type CustomerApi struct {
+}
+
 // @Tags ExaCustomer
 // @Summary 创建客户
 // @Security ApiKeyAuth
@@ -19,16 +22,16 @@ import (
 // @Param data body model.ExaCustomer true "客户用户名, 客户手机号码"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /customer/customer [post]
-func CreateExaCustomer(c *gin.Context) {
-	var customer model.ExaCustomer
+func (e *CustomerApi) CreateExaCustomer(c *gin.Context) {
+	var customer example.ExaCustomer
 	_ = c.ShouldBindJSON(&customer)
 	if err := utils.Verify(customer, utils.CustomerVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	customer.SysUserID = getUserID(c)
-	customer.SysUserAuthorityID = getUserAuthorityId(c)
-	if err := service.CreateExaCustomer(customer); err != nil {
+	customer.SysUserID = utils.GetUserID(c)
+	customer.SysUserAuthorityID = utils.GetUserAuthorityId(c)
+	if err := customerService.CreateExaCustomer(customer); err != nil {
 		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败", c)
 	} else {
@@ -44,14 +47,14 @@ func CreateExaCustomer(c *gin.Context) {
 // @Param data body model.ExaCustomer true "客户ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /customer/customer [delete]
-func DeleteExaCustomer(c *gin.Context) {
-	var customer model.ExaCustomer
+func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) {
+	var customer example.ExaCustomer
 	_ = c.ShouldBindJSON(&customer)
 	if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.DeleteExaCustomer(customer); err != nil {
+	if err := customerService.DeleteExaCustomer(customer); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -67,8 +70,8 @@ func DeleteExaCustomer(c *gin.Context) {
 // @Param data body model.ExaCustomer true "客户ID, 客户信息"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /customer/customer [put]
-func UpdateExaCustomer(c *gin.Context) {
-	var customer model.ExaCustomer
+func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) {
+	var customer example.ExaCustomer
 	_ = c.ShouldBindJSON(&customer)
 	if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -78,7 +81,7 @@ func UpdateExaCustomer(c *gin.Context) {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.UpdateExaCustomer(&customer); err != nil {
+	if err := customerService.UpdateExaCustomer(&customer); err != nil {
 		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败", c)
 	} else {
@@ -94,19 +97,19 @@ func UpdateExaCustomer(c *gin.Context) {
 // @Param data body model.ExaCustomer true "客户ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /customer/customer [get]
-func GetExaCustomer(c *gin.Context) {
-	var customer model.ExaCustomer
+func (e *CustomerApi) GetExaCustomer(c *gin.Context) {
+	var customer example.ExaCustomer
 	_ = c.ShouldBindQuery(&customer)
 	if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	err, data := service.GetExaCustomer(customer.ID)
+	err, data := customerService.GetExaCustomer(customer.ID)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
-		response.OkWithDetailed(response.ExaCustomerResponse{Customer: data}, "获取成功", c)
+		response.OkWithDetailed(exampleRes.ExaCustomerResponse{Customer: data}, "获取成功", c)
 	}
 }
 
@@ -118,14 +121,14 @@ func GetExaCustomer(c *gin.Context) {
 // @Param data body request.PageInfo true "页码, 每页大小"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /customer/customerList [get]
-func GetExaCustomerList(c *gin.Context) {
+func (e *CustomerApi) GetExaCustomerList(c *gin.Context) {
 	var pageInfo request.PageInfo
 	_ = c.ShouldBindQuery(&pageInfo)
 	if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	err, customerList, total := service.GetCustomerInfoList(getUserAuthorityId(c), pageInfo)
+	err, customerList, total := customerService.GetCustomerInfoList(utils.GetUserAuthorityId(c), pageInfo)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败"+err.Error(), c)

+ 13 - 11
server/api/v1/exa_excel.go → server/api/v1/example/exa_excel.go

@@ -1,15 +1,17 @@
-package v1
+package example
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/example"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type ExcelApi struct {
+}
+
 // /excel/importExcel 接口,与upload接口作用类似,只是把文件存到resource/excel目录下,用于导入Excel时存放Excel文件(ExcelImport.xlsx)
 // /excel/loadExcel接口,用于读取resource/excel目录下的文件((ExcelImport.xlsx)并加载为[]model.SysBaseMenu类型的示例数据
 // /excel/exportExcel 接口,用于读取前端传来的tableData,生成Excel文件并返回
@@ -23,11 +25,11 @@ import (
 // @Param data body model.ExcelInfo true "导出Excel文件信息"
 // @Success 200
 // @Router /excel/exportExcel [post]
-func ExportExcel(c *gin.Context) {
-	var excelInfo model.ExcelInfo
+func (e *ExcelApi) ExportExcel(c *gin.Context) {
+	var excelInfo example.ExcelInfo
 	_ = c.ShouldBindJSON(&excelInfo)
 	filePath := global.GVA_CONFIG.Excel.Dir + excelInfo.FileName
-	err := service.ParseInfoList2Excel(excelInfo.InfoList, filePath)
+	err := excelService.ParseInfoList2Excel(excelInfo.InfoList, filePath)
 	if err != nil {
 		global.GVA_LOG.Error("转换Excel失败!", zap.Any("err", err))
 		response.FailWithMessage("转换Excel失败", c)
@@ -45,7 +47,7 @@ func ExportExcel(c *gin.Context) {
 // @Param file formData file true "导入Excel文件"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"导入成功"}"
 // @Router /excel/importExcel [post]
-func ImportExcel(c *gin.Context) {
+func (e *ExcelApi) ImportExcel(c *gin.Context) {
 	_, header, err := c.Request.FormFile("file")
 	if err != nil {
 		global.GVA_LOG.Error("接收文件失败!", zap.Any("err", err))
@@ -62,8 +64,8 @@ func ImportExcel(c *gin.Context) {
 // @Produce  application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"加载数据成功"}"
 // @Router /excel/loadExcel [get]
-func LoadExcel(c *gin.Context) {
-	menus, err := service.ParseExcel2InfoList()
+func (e *ExcelApi) LoadExcel(c *gin.Context) {
+	menus, err := excelService.ParseExcel2InfoList()
 	if err != nil {
 		global.GVA_LOG.Error("加载数据失败!", zap.Any("err", err))
 		response.FailWithMessage("加载数据失败", c)
@@ -85,7 +87,7 @@ func LoadExcel(c *gin.Context) {
 // @Param fileName query string true "模板名称"
 // @Success 200
 // @Router /excel/downloadTemplate [get]
-func DownloadTemplate(c *gin.Context) {
+func (e *ExcelApi) DownloadTemplate(c *gin.Context) {
 	fileName := c.Query("fileName")
 	filePath := global.GVA_CONFIG.Excel.Dir + fileName
 	ok, err := utils.PathExists(filePath)

+ 17 - 14
server/api/v1/exa_file_upload_download.go → server/api/v1/example/exa_file_upload_download.go

@@ -1,15 +1,18 @@
-package v1
+package example
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/example"
+	exampleRes "gin-vue-admin/model/example/response"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type FileUploadAndDownloadApi struct {
+}
+
 // @Tags ExaFileUploadAndDownload
 // @Summary 上传文件示例
 // @Security ApiKeyAuth
@@ -18,8 +21,8 @@ import (
 // @Param file formData file true "上传文件示例"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"上传成功"}"
 // @Router /fileUploadAndDownload/upload [post]
-func UploadFile(c *gin.Context) {
-	var file model.ExaFileUploadAndDownload
+func (u *FileUploadAndDownloadApi) UploadFile(c *gin.Context) {
+	var file example.ExaFileUploadAndDownload
 	noSave := c.DefaultQuery("noSave", "0")
 	_, header, err := c.Request.FormFile("file")
 	if err != nil {
@@ -27,13 +30,13 @@ func UploadFile(c *gin.Context) {
 		response.FailWithMessage("接收文件失败", c)
 		return
 	}
-	err, file = service.UploadFile(header, noSave) // 文件上传后拿到文件路径
+	err, file = fileUploadAndDownloadService.UploadFile(header, noSave) // 文件上传后拿到文件路径
 	if err != nil {
 		global.GVA_LOG.Error("修改数据库链接失败!", zap.Any("err", err))
 		response.FailWithMessage("修改数据库链接失败", c)
 		return
 	}
-	response.OkWithDetailed(response.ExaFileResponse{File: file}, "上传成功", c)
+	response.OkWithDetailed(exampleRes.ExaFileResponse{File: file}, "上传成功", c)
 }
 
 // @Tags ExaFileUploadAndDownload
@@ -43,10 +46,10 @@ func UploadFile(c *gin.Context) {
 // @Param data body model.ExaFileUploadAndDownload true "传入文件里面id即可"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /fileUploadAndDownload/deleteFile [post]
-func DeleteFile(c *gin.Context) {
-	var file model.ExaFileUploadAndDownload
+func (u *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) {
+	var file example.ExaFileUploadAndDownload
 	_ = c.ShouldBindJSON(&file)
-	if err := service.DeleteFile(file); err != nil {
+	if err := fileUploadAndDownloadService.DeleteFile(file); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 		return
@@ -62,10 +65,10 @@ func DeleteFile(c *gin.Context) {
 // @Param data body request.PageInfo true "页码, 每页大小"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /fileUploadAndDownload/getFileList [post]
-func GetFileList(c *gin.Context) {
+func (u *FileUploadAndDownloadApi) GetFileList(c *gin.Context) {
 	var pageInfo request.PageInfo
 	_ = c.ShouldBindJSON(&pageInfo)
-	err, list, total := service.GetFileRecordInfoList(pageInfo)
+	err, list, total := fileUploadAndDownloadService.GetFileRecordInfoList(pageInfo)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)

+ 16 - 14
server/api/v1/exa_simple_uploader.go → server/api/v1/example/exa_simple_uploader.go

@@ -1,15 +1,17 @@
-package v1
+package example
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/example"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type SimpleUploaderApi struct {
+}
+
 // @Tags SimpleUploader
 // @Summary 断点续传插件版示例
 // @Security ApiKeyAuth
@@ -17,9 +19,9 @@ import (
 // @Produce  application/json
 // @Param file formData file true "断点续传插件版示例"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"切片创建成功"}"
-// @Router /simpleUploader/upload [post]
-func SimpleUploaderUpload(c *gin.Context) {
-	var chunk model.ExaSimpleUploader
+// @Router /SimpleUploaderApi/upload [post]
+func (s *SimpleUploaderApi) SimpleUploaderUpload(c *gin.Context) {
+	var chunk example.ExaSimpleUploader
 	_, header, err := c.Request.FormFile("file")
 	chunk.Filename = c.PostForm("filename")
 	chunk.ChunkNumber = c.PostForm("chunkNumber")
@@ -42,7 +44,7 @@ func SimpleUploaderUpload(c *gin.Context) {
 		return
 	}
 	chunk.CurrentChunkPath = chunkPath
-	err = service.SaveChunk(chunk)
+	err = simpleUploaderService.SaveChunk(chunk)
 	if err != nil {
 		global.GVA_LOG.Error("切片创建失败!", zap.Any("err", err))
 		response.FailWithMessage("切片创建失败", c)
@@ -58,10 +60,10 @@ func SimpleUploaderUpload(c *gin.Context) {
 // @Produce  application/json
 // @Param md5 query string true "md5"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
-// @Router /simpleUploader/checkFileMd5 [get]
-func CheckFileMd5(c *gin.Context) {
+// @Router /SimpleUploaderApi/checkFileMd5 [get]
+func (s *SimpleUploaderApi) CheckFileMd5(c *gin.Context) {
 	md5 := c.Query("md5")
-	err, chunks, isDone := service.CheckFileMd5(md5)
+	err, chunks, isDone := simpleUploaderService.CheckFileMd5(md5)
 	if err != nil {
 		global.GVA_LOG.Error("md5读取失败!", zap.Any("err", err))
 		response.FailWithMessage("md5读取失败", c)
@@ -79,11 +81,11 @@ func CheckFileMd5(c *gin.Context) {
 // @Produce  application/json
 // @Param md5 query string true "md5"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"合并成功"}"
-// @Router /simpleUploader/mergeFileMd5 [get]
-func MergeFileMd5(c *gin.Context) {
+// @Router /SimpleUploaderApi/mergeFileMd5 [get]
+func (s *SimpleUploaderApi) MergeFileMd5(c *gin.Context) {
 	md5 := c.Query("md5")
 	fileName := c.Query("fileName")
-	err := service.MergeFileMd5(md5, fileName)
+	err := simpleUploaderService.MergeFileMd5(md5, fileName)
 	if err != nil {
 		global.GVA_LOG.Error("md5读取失败!", zap.Any("err", err))
 		response.FailWithMessage("md5读取失败", c)

+ 34 - 0
server/api/v1/system/enter.go

@@ -0,0 +1,34 @@
+package system
+
+import "gin-vue-admin/service"
+
+type ApiGroup struct {
+	SystemApiApi
+	AuthorityApi
+	AutoCodeApi
+	BaseApi
+	CasbinApi
+	DictionaryApi
+	DictionaryDetailApi
+	SystemApi
+	DBApi
+	JwtApi
+	OperationRecordApi
+	AuthorityMenuApi
+}
+
+var authorityService = service.ServiceGroupApp.SystemServiceGroup.AuthorityService
+var apiService = service.ServiceGroupApp.SystemServiceGroup.ApiService
+var menuService = service.ServiceGroupApp.SystemServiceGroup.MenuService
+var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
+var autoCodeService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeService
+var autoCodeHistoryService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeHistoryService
+var dictionaryService = service.ServiceGroupApp.SystemServiceGroup.DictionaryService
+var dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
+var emailService = service.ServiceGroupApp.SystemServiceGroup.EmailService
+var initDBService = service.ServiceGroupApp.SystemServiceGroup.InitDBService
+var jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
+var baseMenuService = service.ServiceGroupApp.SystemServiceGroup.BaseMenuService
+var operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
+var userService = service.ServiceGroupApp.SystemServiceGroup.UserService
+var systemConfigService = service.ServiceGroupApp.SystemServiceGroup.SystemConfigService

+ 30 - 26
server/api/v1/sys_api.go → server/api/v1/system/sys_api.go

@@ -1,17 +1,21 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemReq "gin-vue-admin/model/system/request"
+	systemRes "gin-vue-admin/model/system/response"
 	"gin-vue-admin/utils"
 
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type SystemApiApi struct {
+}
+
 // @Tags SysApi
 // @Summary 创建基础api
 // @Security ApiKeyAuth
@@ -20,14 +24,14 @@ import (
 // @Param data body model.SysApi true "api路径, api中文描述, api组, 方法"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /api/createApi [post]
-func CreateApi(c *gin.Context) {
-	var api model.SysApi
+func (s *SystemApiApi) CreateApi(c *gin.Context) {
+	var api system.SysApi
 	_ = c.ShouldBindJSON(&api)
 	if err := utils.Verify(api, utils.ApiVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.CreateApi(api); err != nil {
+	if err := apiService.CreateApi(api); err != nil {
 		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败", c)
 	} else {
@@ -43,14 +47,14 @@ func CreateApi(c *gin.Context) {
 // @Param data body model.SysApi true "ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /api/deleteApi [post]
-func DeleteApi(c *gin.Context) {
-	var api model.SysApi
+func (s *SystemApiApi) DeleteApi(c *gin.Context) {
+	var api system.SysApi
 	_ = c.ShouldBindJSON(&api)
 	if err := utils.Verify(api.GVA_MODEL, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.DeleteApi(api); err != nil {
+	if err := apiService.DeleteApi(api); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -63,17 +67,17 @@ func DeleteApi(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.SearchApiParams true "分页获取API列表"
+// @Param data body systemReq.SearchApiParams true "分页获取API列表"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /api/getApiList [post]
-func GetApiList(c *gin.Context) {
-	var pageInfo request.SearchApiParams
+func (s *SystemApiApi) GetApiList(c *gin.Context) {
+	var pageInfo systemReq.SearchApiParams
 	_ = c.ShouldBindJSON(&pageInfo)
 	if err := utils.Verify(pageInfo.PageInfo, utils.PageInfoVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, list, total := service.GetAPIInfoList(pageInfo.SysApi, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
+	if err, list, total := apiService.GetAPIInfoList(pageInfo.SysApi, pageInfo.PageInfo, pageInfo.OrderKey, pageInfo.Desc); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
@@ -94,19 +98,19 @@ func GetApiList(c *gin.Context) {
 // @Param data body request.GetById true "根据id获取api"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /api/getApiById [post]
-func GetApiById(c *gin.Context) {
+func (s *SystemApiApi) GetApiById(c *gin.Context) {
 	var idInfo request.GetById
 	_ = c.ShouldBindJSON(&idInfo)
 	if err := utils.Verify(idInfo, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	err, api := service.GetApiById(idInfo.ID)
+	err, api := apiService.GetApiById(idInfo.ID)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
-		response.OkWithData(response.SysAPIResponse{Api: api}, c)
+		response.OkWithData(systemRes.SysAPIResponse{Api: api}, c)
 	}
 }
 
@@ -118,14 +122,14 @@ func GetApiById(c *gin.Context) {
 // @Param data body model.SysApi true "api路径, api中文描述, api组, 方法"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
 // @Router /api/updateApi [post]
-func UpdateApi(c *gin.Context) {
-	var api model.SysApi
+func (s *SystemApiApi) UpdateApi(c *gin.Context) {
+	var api system.SysApi
 	_ = c.ShouldBindJSON(&api)
 	if err := utils.Verify(api, utils.ApiVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.UpdateApi(api); err != nil {
+	if err := apiService.UpdateApi(api); err != nil {
 		global.GVA_LOG.Error("修改失败!", zap.Any("err", err))
 		response.FailWithMessage("修改失败", c)
 	} else {
@@ -140,12 +144,12 @@ func UpdateApi(c *gin.Context) {
 // @Produce application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /api/getAllApis [post]
-func GetAllApis(c *gin.Context) {
-	if err, apis := service.GetAllApis(); err != nil {
+func (s *SystemApiApi) GetAllApis(c *gin.Context) {
+	if err, apis := apiService.GetAllApis(); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
-		response.OkWithDetailed(response.SysAPIListResponse{Apis: apis}, "获取成功", c)
+		response.OkWithDetailed(systemRes.SysAPIListResponse{Apis: apis}, "获取成功", c)
 	}
 }
 
@@ -157,10 +161,10 @@ func GetAllApis(c *gin.Context) {
 // @Param data body request.IdsReq true "ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /api/deleteApisByIds [delete]
-func DeleteApisByIds(c *gin.Context) {
+func (s *SystemApiApi) DeleteApisByIds(c *gin.Context) {
 	var ids request.IdsReq
 	_ = c.ShouldBindJSON(&ids)
-	if err := service.DeleteApisByIds(ids); err != nil {
+	if err := apiService.DeleteApisByIds(ids); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {

+ 32 - 27
server/api/v1/sys_authority.go → server/api/v1/system/sys_authority.go

@@ -1,38 +1,43 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemReq "gin-vue-admin/model/system/request"
+	systemRes "gin-vue-admin/model/system/response"
 	"gin-vue-admin/utils"
 
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type AuthorityApi struct {
+}
+
 // @Tags Authority
 // @Summary 创建角色
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body model.SysAuthority true "权限id, 权限名, 父角色id"
+// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /authority/createAuthority [post]
-func CreateAuthority(c *gin.Context) {
-	var authority model.SysAuthority
+func (a *AuthorityApi) CreateAuthority(c *gin.Context) {
+	var authority system.SysAuthority
 	_ = c.ShouldBindJSON(&authority)
 	if err := utils.Verify(authority, utils.AuthorityVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, authBack := service.CreateAuthority(authority); err != nil {
+	if err, authBack := authorityService.CreateAuthority(authority); err != nil {
 		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败"+err.Error(), c)
 	} else {
-		_ = service.UpdateCasbin(authority.AuthorityId, request.DefaultCasbin())
-		response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
+		_ = menuService.AddMenuAuthority(systemReq.DefaultMenu(), authority.AuthorityId)
+		_ = casbinService.UpdateCasbin(authority.AuthorityId, systemReq.DefaultCasbin())
+		response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authBack}, "创建成功", c)
 	}
 }
 
@@ -44,8 +49,8 @@ func CreateAuthority(c *gin.Context) {
 // @Param data body response.SysAuthorityCopyResponse true "旧角色id, 新权限id, 新权限名, 新父角色id"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"拷贝成功"}"
 // @Router /authority/copyAuthority [post]
-func CopyAuthority(c *gin.Context) {
-	var copyInfo response.SysAuthorityCopyResponse
+func (a *AuthorityApi) CopyAuthority(c *gin.Context) {
+	var copyInfo systemRes.SysAuthorityCopyResponse
 	_ = c.ShouldBindJSON(&copyInfo)
 	if err := utils.Verify(copyInfo, utils.OldAuthorityVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -55,11 +60,11 @@ func CopyAuthority(c *gin.Context) {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, authBack := service.CopyAuthority(copyInfo); err != nil {
+	if err, authBack := authorityService.CopyAuthority(copyInfo); err != nil {
 		global.GVA_LOG.Error("拷贝失败!", zap.Any("err", err))
 		response.FailWithMessage("拷贝失败"+err.Error(), c)
 	} else {
-		response.OkWithDetailed(response.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c)
+		response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c)
 	}
 }
 
@@ -71,14 +76,14 @@ func CopyAuthority(c *gin.Context) {
 // @Param data body model.SysAuthority true "删除角色"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /authority/deleteAuthority [post]
-func DeleteAuthority(c *gin.Context) {
-	var authority model.SysAuthority
+func (a *AuthorityApi) DeleteAuthority(c *gin.Context) {
+	var authority system.SysAuthority
 	_ = c.ShouldBindJSON(&authority)
 	if err := utils.Verify(authority, utils.AuthorityIdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.DeleteAuthority(&authority); err != nil { // 删除角色之前需要判断是否有用户正在使用此角色
+	if err := authorityService.DeleteAuthority(&authority); err != nil { // 删除角色之前需要判断是否有用户正在使用此角色
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败"+err.Error(), c)
 	} else {
@@ -94,18 +99,18 @@ func DeleteAuthority(c *gin.Context) {
 // @Param data body model.SysAuthority true "权限id, 权限名, 父角色id"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /authority/updateAuthority [post]
-func UpdateAuthority(c *gin.Context) {
-	var auth model.SysAuthority
+func (a *AuthorityApi) UpdateAuthority(c *gin.Context) {
+	var auth system.SysAuthority
 	_ = c.ShouldBindJSON(&auth)
 	if err := utils.Verify(auth, utils.AuthorityVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, authority := service.UpdateAuthority(auth); err != nil {
+	if err, authority := authorityService.UpdateAuthority(auth); err != nil {
 		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败"+err.Error(), c)
 	} else {
-		response.OkWithDetailed(response.SysAuthorityResponse{Authority: authority}, "更新成功", c)
+		response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authority}, "更新成功", c)
 	}
 }
 
@@ -117,14 +122,14 @@ func UpdateAuthority(c *gin.Context) {
 // @Param data body request.PageInfo true "页码, 每页大小"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /authority/getAuthorityList [post]
-func GetAuthorityList(c *gin.Context) {
+func (a *AuthorityApi) GetAuthorityList(c *gin.Context) {
 	var pageInfo request.PageInfo
 	_ = c.ShouldBindJSON(&pageInfo)
 	if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, list, total := service.GetAuthorityInfoList(pageInfo); err != nil {
+	if err, list, total := authorityService.GetAuthorityInfoList(pageInfo); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败"+err.Error(), c)
 	} else {
@@ -145,14 +150,14 @@ func GetAuthorityList(c *gin.Context) {
 // @Param data body model.SysAuthority true "设置角色资源权限"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
 // @Router /authority/setDataAuthority [post]
-func SetDataAuthority(c *gin.Context) {
-	var auth model.SysAuthority
+func (a *AuthorityApi) SetDataAuthority(c *gin.Context) {
+	var auth system.SysAuthority
 	_ = c.ShouldBindJSON(&auth)
 	if err := utils.Verify(auth, utils.AuthorityIdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.SetDataAuthority(auth); err != nil {
+	if err := authorityService.SetDataAuthority(auth); err != nil {
 		global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
 		response.FailWithMessage("设置失败"+err.Error(), c)
 	} else {

+ 37 - 35
server/api/v1/sys_auto_code.go → server/api/v1/system/sys_auto_code.go

@@ -1,13 +1,12 @@
-package v1
+package system
 
 import (
 	"errors"
 	"fmt"
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemReq "gin-vue-admin/model/system/request"
 	"gin-vue-admin/utils"
 	"net/url"
 	"os"
@@ -16,18 +15,21 @@ import (
 	"go.uber.org/zap"
 )
 
+type AutoCodeApi struct {
+}
+
 // @Tags AutoCode
 // @Summary 删除回滚记录
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.AutoHistoryByID true "删除回滚记录"
+// @Param data body systemReq.AutoHistoryByID true "删除回滚记录"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /autoCode/delSysHistory [post]
-func DelSysHistory(c *gin.Context) {
-	var id request.AutoHistoryByID
+func (autoApi *AutoCodeApi) DelSysHistory(c *gin.Context) {
+	var id systemReq.AutoHistoryByID
 	_ = c.ShouldBindJSON(&id)
-	err := service.DeletePage(id.ID)
+	err := autoCodeHistoryService.DeletePage(id.ID)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
@@ -41,13 +43,13 @@ func DelSysHistory(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.SysAutoHistory true "查询回滚记录"
+// @Param data body systemReq.SysAutoHistory true "查询回滚记录"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /autoCode/getSysHistory [post]
-func GetSysHistory(c *gin.Context) {
-	var search request.SysAutoHistory
+func (autoApi *AutoCodeApi) GetSysHistory(c *gin.Context) {
+	var search systemReq.SysAutoHistory
 	_ = c.ShouldBindJSON(&search)
-	err, list, total := service.GetSysHistoryPage(search.PageInfo)
+	err, list, total := autoCodeHistoryService.GetSysHistoryPage(search.PageInfo)
 	if err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
@@ -66,13 +68,13 @@ func GetSysHistory(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.AutoHistoryByID true "回滚自动生成代码"
+// @Param data body systemReq.AutoHistoryByID true "回滚自动生成代码"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"回滚成功"}"
 // @Router /autoCode/rollback [post]
-func RollBack(c *gin.Context) {
-	var id request.AutoHistoryByID
+func (autoApi *AutoCodeApi) RollBack(c *gin.Context) {
+	var id systemReq.AutoHistoryByID
 	_ = c.ShouldBindJSON(&id)
-	if err := service.RollBack(id.ID); err != nil {
+	if err := autoCodeHistoryService.RollBack(id.ID); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
@@ -84,13 +86,13 @@ func RollBack(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.AutoHistoryByID true "获取meta信息"
+// @Param data body systemReq.AutoHistoryByID true "获取meta信息"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /autoCode/getMeta [post]
-func GetMeta(c *gin.Context) {
-	var id request.AutoHistoryByID
+func (autoApi *AutoCodeApi) GetMeta(c *gin.Context) {
+	var id systemReq.AutoHistoryByID
 	_ = c.ShouldBindJSON(&id)
-	if v, err := service.GetMeta(id.ID); err != nil {
+	if v, err := autoCodeHistoryService.GetMeta(id.ID); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	} else {
@@ -107,14 +109,14 @@ func GetMeta(c *gin.Context) {
 // @Param data body model.AutoCodeStruct true "预览创建代码"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /autoCode/preview [post]
-func PreviewTemp(c *gin.Context) {
-	var a model.AutoCodeStruct
+func (autoApi *AutoCodeApi) PreviewTemp(c *gin.Context) {
+	var a system.AutoCodeStruct
 	_ = c.ShouldBindJSON(&a)
 	if err := utils.Verify(a, utils.AutoCodeVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	autoCode, err := service.PreviewTemp(a)
+	autoCode, err := autoCodeService.PreviewTemp(a)
 	if err != nil {
 		global.GVA_LOG.Error("预览失败!", zap.Any("err", err))
 		response.FailWithMessage("预览失败", c)
@@ -131,8 +133,8 @@ func PreviewTemp(c *gin.Context) {
 // @Param data body model.AutoCodeStruct true "创建自动代码"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /autoCode/createTemp [post]
-func CreateTemp(c *gin.Context) {
-	var a model.AutoCodeStruct
+func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) {
+	var a system.AutoCodeStruct
 	_ = c.ShouldBindJSON(&a)
 	if err := utils.Verify(a, utils.AutoCodeVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -140,7 +142,7 @@ func CreateTemp(c *gin.Context) {
 	}
 	var apiIds []uint
 	if a.AutoCreateApiToSql {
-		if ids, err := service.AutoCreateApi(&a); err != nil {
+		if ids, err := autoCodeService.AutoCreateApi(&a); err != nil {
 			global.GVA_LOG.Error("自动化创建失败!请自行清空垃圾数据!", zap.Any("err", err))
 			c.Writer.Header().Add("success", "false")
 			c.Writer.Header().Add("msg", url.QueryEscape("自动化创建失败!请自行清空垃圾数据!"))
@@ -149,9 +151,9 @@ func CreateTemp(c *gin.Context) {
 			apiIds = ids
 		}
 	}
-	err := service.CreateTemp(a, apiIds...)
+	err := autoCodeService.CreateTemp(a, apiIds...)
 	if err != nil {
-		if errors.Is(err, model.AutoMoveErr) {
+		if errors.Is(err, system.AutoMoveErr) {
 			c.Writer.Header().Add("success", "false")
 			c.Writer.Header().Add("msgtype", "success")
 			c.Writer.Header().Add("msg", url.QueryEscape(err.Error()))
@@ -176,9 +178,9 @@ func CreateTemp(c *gin.Context) {
 // @Produce application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /autoCode/getTables [get]
-func GetTables(c *gin.Context) {
+func (autoApi *AutoCodeApi) GetTables(c *gin.Context) {
 	dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
-	err, tables := service.GetTables(dbName)
+	err, tables := autoCodeService.GetTables(dbName)
 	if err != nil {
 		global.GVA_LOG.Error("查询table失败!", zap.Any("err", err))
 		response.FailWithMessage("查询table失败", c)
@@ -194,8 +196,8 @@ func GetTables(c *gin.Context) {
 // @Produce application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /autoCode/getDatabase [get]
-func GetDB(c *gin.Context) {
-	if err, dbs := service.GetDB(); err != nil {
+func (autoApi *AutoCodeApi) GetDB(c *gin.Context) {
+	if err, dbs := autoCodeService.GetDB(); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
@@ -210,10 +212,10 @@ func GetDB(c *gin.Context) {
 // @Produce application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /autoCode/getColumn [get]
-func GetColumn(c *gin.Context) {
+func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) {
 	dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
 	tableName := c.Query("tableName")
-	if err, columns := service.GetColumn(tableName, dbName); err != nil {
+	if err, columns := autoCodeService.GetColumn(tableName, dbName); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {

+ 8 - 4
server/api/v1/sys_captcha.go → server/api/v1/system/sys_captcha.go

@@ -1,8 +1,9 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/response"
+	"gin-vue-admin/model/common/response"
+	systemRes "gin-vue-admin/model/system/response"
 	"github.com/gin-gonic/gin"
 	"github.com/mojocn/base64Captcha"
 	"go.uber.org/zap"
@@ -12,6 +13,9 @@ import (
 // var store = captcha.NewDefaultRedisStore()
 var store = base64Captcha.DefaultMemStore
 
+type BaseApi struct {
+}
+
 // @Tags Base
 // @Summary 生成验证码
 // @Security ApiKeyAuth
@@ -19,7 +23,7 @@ var store = base64Captcha.DefaultMemStore
 // @Produce application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"验证码获取成功"}"
 // @Router /base/captcha [post]
-func Captcha(c *gin.Context) {
+func (b *BaseApi) Captcha(c *gin.Context) {
 	// 字符,公式,验证码配置
 	// 生成默认数字的driver
 	driver := base64Captcha.NewDriverDigit(global.GVA_CONFIG.Captcha.ImgHeight, global.GVA_CONFIG.Captcha.ImgWidth, global.GVA_CONFIG.Captcha.KeyLong, 0.7, 80)
@@ -28,7 +32,7 @@ func Captcha(c *gin.Context) {
 		global.GVA_LOG.Error("验证码获取失败!", zap.Any("err", err))
 		response.FailWithMessage("验证码获取失败", c)
 	} else {
-		response.OkWithDetailed(response.SysCaptchaResponse{
+		response.OkWithDetailed(systemRes.SysCaptchaResponse{
 			CaptchaId: id,
 			PicPath:   b64s,
 		}, "验证码获取成功", c)

+ 12 - 9
server/api/v1/sys_casbin.go → server/api/v1/system/sys_casbin.go

@@ -1,15 +1,18 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system/request"
+	systemRes "gin-vue-admin/model/system/response"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type CasbinApi struct {
+}
+
 // @Tags Casbin
 // @Summary 更新角色api权限
 // @Security ApiKeyAuth
@@ -18,14 +21,14 @@ import (
 // @Param data body request.CasbinInReceive true "权限id, 权限模型列表"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /casbin/UpdateCasbin [post]
-func UpdateCasbin(c *gin.Context) {
+func (cas *CasbinApi) UpdateCasbin(c *gin.Context) {
 	var cmr request.CasbinInReceive
 	_ = c.ShouldBindJSON(&cmr)
 	if err := utils.Verify(cmr, utils.AuthorityIdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos); err != nil {
+	if err := casbinService.UpdateCasbin(cmr.AuthorityId, cmr.CasbinInfos); err != nil {
 		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败", c)
 	} else {
@@ -41,13 +44,13 @@ func UpdateCasbin(c *gin.Context) {
 // @Param data body request.CasbinInReceive true "权限id, 权限模型列表"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /casbin/getPolicyPathByAuthorityId [post]
-func GetPolicyPathByAuthorityId(c *gin.Context) {
+func (cas *CasbinApi) GetPolicyPathByAuthorityId(c *gin.Context) {
 	var casbin request.CasbinInReceive
 	_ = c.ShouldBindJSON(&casbin)
 	if err := utils.Verify(casbin, utils.AuthorityIdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	paths := service.GetPolicyPathByAuthorityId(casbin.AuthorityId)
-	response.OkWithDetailed(response.PolicyPathResponse{Paths: paths}, "获取成功", c)
+	paths := casbinService.GetPolicyPathByAuthorityId(casbin.AuthorityId)
+	response.OkWithDetailed(systemRes.PolicyPathResponse{Paths: paths}, "获取成功", c)
 }

+ 21 - 19
server/api/v1/sys_dictionary.go → server/api/v1/system/sys_dictionary.go

@@ -1,16 +1,18 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	"gin-vue-admin/model/system/request"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type DictionaryApi struct {
+}
+
 // @Tags SysDictionary
 // @Summary 创建SysDictionary
 // @Security ApiKeyAuth
@@ -19,10 +21,10 @@ import (
 // @Param data body model.SysDictionary true "SysDictionary模型"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /sysDictionary/createSysDictionary [post]
-func CreateSysDictionary(c *gin.Context) {
-	var dictionary model.SysDictionary
+func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) {
+	var dictionary system.SysDictionary
 	_ = c.ShouldBindJSON(&dictionary)
-	if err := service.CreateSysDictionary(dictionary); err != nil {
+	if err := dictionaryService.CreateSysDictionary(dictionary); err != nil {
 		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败", c)
 	} else {
@@ -38,10 +40,10 @@ func CreateSysDictionary(c *gin.Context) {
 // @Param data body model.SysDictionary true "SysDictionary模型"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /sysDictionary/deleteSysDictionary [delete]
-func DeleteSysDictionary(c *gin.Context) {
-	var dictionary model.SysDictionary
+func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) {
+	var dictionary system.SysDictionary
 	_ = c.ShouldBindJSON(&dictionary)
-	if err := service.DeleteSysDictionary(dictionary); err != nil {
+	if err := dictionaryService.DeleteSysDictionary(dictionary); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -57,10 +59,10 @@ func DeleteSysDictionary(c *gin.Context) {
 // @Param data body model.SysDictionary true "SysDictionary模型"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /sysDictionary/updateSysDictionary [put]
-func UpdateSysDictionary(c *gin.Context) {
-	var dictionary model.SysDictionary
+func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) {
+	var dictionary system.SysDictionary
 	_ = c.ShouldBindJSON(&dictionary)
-	if err := service.UpdateSysDictionary(&dictionary); err != nil {
+	if err := dictionaryService.UpdateSysDictionary(&dictionary); err != nil {
 		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败", c)
 	} else {
@@ -76,10 +78,10 @@ func UpdateSysDictionary(c *gin.Context) {
 // @Param data body model.SysDictionary true "ID或字典英名"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
 // @Router /sysDictionary/findSysDictionary [get]
-func FindSysDictionary(c *gin.Context) {
-	var dictionary model.SysDictionary
+func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
+	var dictionary system.SysDictionary
 	_ = c.ShouldBindQuery(&dictionary)
-	if err, sysDictionary := service.GetSysDictionary(dictionary.Type, dictionary.ID); err != nil {
+	if err, sysDictionary := dictionaryService.GetSysDictionary(dictionary.Type, dictionary.ID); err != nil {
 		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
 		response.FailWithMessage("查询失败", c)
 	} else {
@@ -95,14 +97,14 @@ func FindSysDictionary(c *gin.Context) {
 // @Param data body request.SysDictionarySearch true "页码, 每页大小, 搜索条件"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /sysDictionary/getSysDictionaryList [get]
-func GetSysDictionaryList(c *gin.Context) {
+func (s *DictionaryApi) GetSysDictionaryList(c *gin.Context) {
 	var pageInfo request.SysDictionarySearch
 	_ = c.ShouldBindQuery(&pageInfo)
 	if err := utils.Verify(pageInfo.PageInfo, utils.PageInfoVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, list, total := service.GetSysDictionaryInfoList(pageInfo); err != nil {
+	if err, list, total := dictionaryService.GetSysDictionaryInfoList(pageInfo); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {

+ 21 - 19
server/api/v1/sys_dictionary_detail.go → server/api/v1/system/sys_dictionary_detail.go

@@ -1,16 +1,18 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	"gin-vue-admin/model/system/request"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type DictionaryDetailApi struct {
+}
+
 // @Tags SysDictionaryDetail
 // @Summary 创建SysDictionaryDetail
 // @Security ApiKeyAuth
@@ -19,10 +21,10 @@ import (
 // @Param data body model.SysDictionaryDetail true "SysDictionaryDetail模型"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
 // @Router /sysDictionaryDetail/createSysDictionaryDetail [post]
-func CreateSysDictionaryDetail(c *gin.Context) {
-	var detail model.SysDictionaryDetail
+func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) {
+	var detail system.SysDictionaryDetail
 	_ = c.ShouldBindJSON(&detail)
-	if err := service.CreateSysDictionaryDetail(detail); err != nil {
+	if err := dictionaryDetailService.CreateSysDictionaryDetail(detail); err != nil {
 		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败", c)
 	} else {
@@ -38,10 +40,10 @@ func CreateSysDictionaryDetail(c *gin.Context) {
 // @Param data body model.SysDictionaryDetail true "SysDictionaryDetail模型"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete]
-func DeleteSysDictionaryDetail(c *gin.Context) {
-	var detail model.SysDictionaryDetail
+func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) {
+	var detail system.SysDictionaryDetail
 	_ = c.ShouldBindJSON(&detail)
-	if err := service.DeleteSysDictionaryDetail(detail); err != nil {
+	if err := dictionaryDetailService.DeleteSysDictionaryDetail(detail); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -57,10 +59,10 @@ func DeleteSysDictionaryDetail(c *gin.Context) {
 // @Param data body model.SysDictionaryDetail true "更新SysDictionaryDetail"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /sysDictionaryDetail/updateSysDictionaryDetail [put]
-func UpdateSysDictionaryDetail(c *gin.Context) {
-	var detail model.SysDictionaryDetail
+func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) {
+	var detail system.SysDictionaryDetail
 	_ = c.ShouldBindJSON(&detail)
-	if err := service.UpdateSysDictionaryDetail(&detail); err != nil {
+	if err := dictionaryDetailService.UpdateSysDictionaryDetail(&detail); err != nil {
 		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败", c)
 	} else {
@@ -76,14 +78,14 @@ func UpdateSysDictionaryDetail(c *gin.Context) {
 // @Param data body model.SysDictionaryDetail true "用id查询SysDictionaryDetail"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
 // @Router /sysDictionaryDetail/findSysDictionaryDetail [get]
-func FindSysDictionaryDetail(c *gin.Context) {
-	var detail model.SysDictionaryDetail
+func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) {
+	var detail system.SysDictionaryDetail
 	_ = c.ShouldBindQuery(&detail)
 	if err := utils.Verify(detail, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, resysDictionaryDetail := service.GetSysDictionaryDetail(detail.ID); err != nil {
+	if err, resysDictionaryDetail := dictionaryDetailService.GetSysDictionaryDetail(detail.ID); err != nil {
 		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
 		response.FailWithMessage("查询失败", c)
 	} else {
@@ -99,10 +101,10 @@ func FindSysDictionaryDetail(c *gin.Context) {
 // @Param data body request.SysDictionaryDetailSearch true "页码, 每页大小, 搜索条件"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /sysDictionaryDetail/getSysDictionaryDetailList [get]
-func GetSysDictionaryDetailList(c *gin.Context) {
+func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) {
 	var pageInfo request.SysDictionaryDetailSearch
 	_ = c.ShouldBindQuery(&pageInfo)
-	if err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo); err != nil {
+	if err, list, total := dictionaryDetailService.GetSysDictionaryDetailInfoList(pageInfo); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {

+ 4 - 5
server/api/v1/sys_email.go → server/api/v1/system/sys_email.go

@@ -1,9 +1,8 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
@@ -14,8 +13,8 @@ import (
 // @Produce  application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"发送成功"}"
 // @Router /email/emailTest [post]
-func EmailTest(c *gin.Context) {
-	if err := service.EmailTest(); err != nil {
+func (s *SystemApi) EmailTest(c *gin.Context) {
+	if err := emailService.EmailTest(); err != nil {
 		global.GVA_LOG.Error("发送失败!", zap.Any("err", err))
 		response.FailWithMessage("发送失败", c)
 	} else {

+ 9 - 8
server/api/v1/sys_initdb.go → server/api/v1/system/sys_initdb.go

@@ -1,23 +1,24 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
-
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system/request"
 	"go.uber.org/zap"
 
 	"github.com/gin-gonic/gin"
 )
 
+type DBApi struct {
+}
+
 // @Tags InitDB
 // @Summary 初始化用户数据库
 // @Produce  application/json
 // @Param data body request.InitDB true "初始化数据库参数"
 // @Success 200 {string} string "{"code":0,"data":{},"msg":"自动创建数据库成功"}"
 // @Router /init/initdb [post]
-func InitDB(c *gin.Context) {
+func (i *DBApi) InitDB(c *gin.Context) {
 	if global.GVA_DB != nil {
 		global.GVA_LOG.Error("已存在数据库配置!")
 		response.FailWithMessage("已存在数据库配置", c)
@@ -29,7 +30,7 @@ func InitDB(c *gin.Context) {
 		response.FailWithMessage("参数校验不通过", c)
 		return
 	}
-	if err := service.InitDB(dbInfo); err != nil {
+	if err := initDBService.InitDB(dbInfo); err != nil {
 		global.GVA_LOG.Error("自动创建数据库失败!", zap.Any("err", err))
 		response.FailWithMessage("自动创建数据库失败,请查看后台日志,检查后在进行初始化", c)
 		return
@@ -42,7 +43,7 @@ func InitDB(c *gin.Context) {
 // @Produce  application/json
 // @Success 200 {string} string "{"code":0,"data":{},"msg":"探测完成"}"
 // @Router /init/checkdb [post]
-func CheckDB(c *gin.Context) {
+func (i *DBApi) CheckDB(c *gin.Context) {
 	if global.GVA_DB != nil {
 		global.GVA_LOG.Info("数据库无需初始化")
 		response.OkWithDetailed(gin.H{"needInit": false}, "数据库无需初始化", c)

+ 9 - 7
server/api/v1/sys_jwt_blacklist.go → server/api/v1/system/sys_jwt_blacklist.go

@@ -1,14 +1,16 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type JwtApi struct {
+}
+
 // @Tags Jwt
 // @Summary jwt加入黑名单
 // @Security ApiKeyAuth
@@ -16,10 +18,10 @@ import (
 // @Produce application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"拉黑成功"}"
 // @Router /jwt/jsonInBlacklist [post]
-func JsonInBlacklist(c *gin.Context) {
+func (j *JwtApi) JsonInBlacklist(c *gin.Context) {
 	token := c.Request.Header.Get("x-token")
-	jwt := model.JwtBlacklist{Jwt: token}
-	if err := service.JsonInBlacklist(jwt); err != nil {
+	jwt := system.JwtBlacklist{Jwt: token}
+	if err := jwtService.JsonInBlacklist(jwt); err != nil {
 		global.GVA_LOG.Error("jwt作废失败!", zap.Any("err", err))
 		response.FailWithMessage("jwt作废失败", c)
 	} else {

+ 36 - 32
server/api/v1/sys_menu.go → server/api/v1/system/sys_menu.go

@@ -1,17 +1,21 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemReq "gin-vue-admin/model/system/request"
+	systemRes "gin-vue-admin/model/system/response"
 	"gin-vue-admin/utils"
 
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type AuthorityMenuApi struct {
+}
+
 // @Tags AuthorityMenu
 // @Summary 获取用户动态路由
 // @Security ApiKeyAuth
@@ -19,15 +23,15 @@ import (
 // @Param data body request.Empty true "空"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /menu/getMenu [post]
-func GetMenu(c *gin.Context) {
-	if err, menus := service.GetMenuTree(getUserAuthorityId(c)); err != nil {
+func (a *AuthorityMenuApi) GetMenu(c *gin.Context) {
+	if err, menus := menuService.GetMenuTree(utils.GetUserAuthorityId(c)); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
 		if menus == nil {
-			menus = []model.SysMenu{}
+			menus = []system.SysMenu{}
 		}
-		response.OkWithDetailed(response.SysMenusResponse{Menus: menus}, "获取成功", c)
+		response.OkWithDetailed(systemRes.SysMenusResponse{Menus: menus}, "获取成功", c)
 	}
 }
 
@@ -38,12 +42,12 @@ func GetMenu(c *gin.Context) {
 // @Param data body request.Empty true "空"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /menu/getBaseMenuTree [post]
-func GetBaseMenuTree(c *gin.Context) {
-	if err, menus := service.GetBaseMenuTree(); err != nil {
+func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) {
+	if err, menus := menuService.GetBaseMenuTree(); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
-		response.OkWithDetailed(response.SysBaseMenusResponse{Menus: menus}, "获取成功", c)
+		response.OkWithDetailed(systemRes.SysBaseMenusResponse{Menus: menus}, "获取成功", c)
 	}
 }
 
@@ -52,17 +56,17 @@ func GetBaseMenuTree(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.AddMenuAuthorityInfo true "角色ID"
+// @Param data body systemReq.AddMenuAuthorityInfo true "角色ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
 // @Router /menu/addMenuAuthority [post]
-func AddMenuAuthority(c *gin.Context) {
-	var authorityMenu request.AddMenuAuthorityInfo
+func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) {
+	var authorityMenu systemReq.AddMenuAuthorityInfo
 	_ = c.ShouldBindJSON(&authorityMenu)
 	if err := utils.Verify(authorityMenu, utils.AuthorityIdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.AddMenuAuthority(authorityMenu.Menus, authorityMenu.AuthorityId); err != nil {
+	if err := menuService.AddMenuAuthority(authorityMenu.Menus, authorityMenu.AuthorityId); err != nil {
 		global.GVA_LOG.Error("添加失败!", zap.Any("err", err))
 		response.FailWithMessage("添加失败", c)
 	} else {
@@ -78,16 +82,16 @@ func AddMenuAuthority(c *gin.Context) {
 // @Param data body request.GetAuthorityId true "角色ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /menu/GetMenuAuthority [post]
-func GetMenuAuthority(c *gin.Context) {
+func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) {
 	var param request.GetAuthorityId
 	_ = c.ShouldBindJSON(&param)
 	if err := utils.Verify(param, utils.AuthorityIdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, menus := service.GetMenuAuthority(&param); err != nil {
+	if err, menus := menuService.GetMenuAuthority(&param); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
-		response.FailWithDetailed(response.SysMenusResponse{Menus: menus}, "获取失败", c)
+		response.FailWithDetailed(systemRes.SysMenusResponse{Menus: menus}, "获取失败", c)
 	} else {
 		response.OkWithDetailed(gin.H{"menus": menus}, "获取成功", c)
 	}
@@ -101,8 +105,8 @@ func GetMenuAuthority(c *gin.Context) {
 // @Param data body model.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"添加成功"}"
 // @Router /menu/addBaseMenu [post]
-func AddBaseMenu(c *gin.Context) {
-	var menu model.SysBaseMenu
+func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) {
+	var menu system.SysBaseMenu
 	_ = c.ShouldBindJSON(&menu)
 	if err := utils.Verify(menu, utils.MenuVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -112,7 +116,7 @@ func AddBaseMenu(c *gin.Context) {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.AddBaseMenu(menu); err != nil {
+	if err := menuService.AddBaseMenu(menu); err != nil {
 		global.GVA_LOG.Error("添加失败!", zap.Any("err", err))
 
 		response.FailWithMessage("添加失败", c)
@@ -129,14 +133,14 @@ func AddBaseMenu(c *gin.Context) {
 // @Param data body request.GetById true "菜单id"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /menu/deleteBaseMenu [post]
-func DeleteBaseMenu(c *gin.Context) {
+func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) {
 	var menu request.GetById
 	_ = c.ShouldBindJSON(&menu)
 	if err := utils.Verify(menu, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.DeleteBaseMenu(menu.ID); err != nil {
+	if err := baseMenuService.DeleteBaseMenu(menu.ID); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -152,8 +156,8 @@ func DeleteBaseMenu(c *gin.Context) {
 // @Param data body model.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /menu/updateBaseMenu [post]
-func UpdateBaseMenu(c *gin.Context) {
-	var menu model.SysBaseMenu
+func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) {
+	var menu system.SysBaseMenu
 	_ = c.ShouldBindJSON(&menu)
 	if err := utils.Verify(menu, utils.MenuVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
@@ -163,7 +167,7 @@ func UpdateBaseMenu(c *gin.Context) {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err := service.UpdateBaseMenu(menu); err != nil {
+	if err := baseMenuService.UpdateBaseMenu(menu); err != nil {
 		global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败", c)
 	} else {
@@ -179,18 +183,18 @@ func UpdateBaseMenu(c *gin.Context) {
 // @Param data body request.GetById true "菜单id"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /menu/getBaseMenuById [post]
-func GetBaseMenuById(c *gin.Context) {
+func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) {
 	var idInfo request.GetById
 	_ = c.ShouldBindJSON(&idInfo)
 	if err := utils.Verify(idInfo, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, menu := service.GetBaseMenuById(idInfo.ID); err != nil {
+	if err, menu := baseMenuService.GetBaseMenuById(idInfo.ID); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
-		response.OkWithDetailed(response.SysBaseMenuResponse{Menu: menu}, "获取成功", c)
+		response.OkWithDetailed(systemRes.SysBaseMenuResponse{Menu: menu}, "获取成功", c)
 	}
 }
 
@@ -202,14 +206,14 @@ func GetBaseMenuById(c *gin.Context) {
 // @Param data body request.PageInfo true "页码, 每页大小"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /menu/getMenuList [post]
-func GetMenuList(c *gin.Context) {
+func (a *AuthorityMenuApi) GetMenuList(c *gin.Context) {
 	var pageInfo request.PageInfo
 	_ = c.ShouldBindJSON(&pageInfo)
 	if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, menuList, total := service.GetInfoList(); err != nil {
+	if err, menuList, total := menuService.GetInfoList(); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {

+ 22 - 19
server/api/v1/sys_operation_record.go → server/api/v1/system/sys_operation_record.go

@@ -1,16 +1,19 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemReq "gin-vue-admin/model/system/request"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type OperationRecordApi struct {
+}
+
 // @Tags SysOperationRecord
 // @Summary 创建SysOperationRecord
 // @Security ApiKeyAuth
@@ -19,10 +22,10 @@ import (
 // @Param data body model.SysOperationRecord true "创建SysOperationRecord"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /sysOperationRecord/createSysOperationRecord [post]
-func CreateSysOperationRecord(c *gin.Context) {
-	var sysOperationRecord model.SysOperationRecord
+func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) {
+	var sysOperationRecord system.SysOperationRecord
 	_ = c.ShouldBindJSON(&sysOperationRecord)
-	if err := service.CreateSysOperationRecord(sysOperationRecord); err != nil {
+	if err := operationRecordService.CreateSysOperationRecord(sysOperationRecord); err != nil {
 		global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败", c)
 	} else {
@@ -38,10 +41,10 @@ func CreateSysOperationRecord(c *gin.Context) {
 // @Param data body model.SysOperationRecord true "SysOperationRecord模型"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /sysOperationRecord/deleteSysOperationRecord [delete]
-func DeleteSysOperationRecord(c *gin.Context) {
-	var sysOperationRecord model.SysOperationRecord
+func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) {
+	var sysOperationRecord system.SysOperationRecord
 	_ = c.ShouldBindJSON(&sysOperationRecord)
-	if err := service.DeleteSysOperationRecord(sysOperationRecord); err != nil {
+	if err := operationRecordService.DeleteSysOperationRecord(sysOperationRecord); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -57,10 +60,10 @@ func DeleteSysOperationRecord(c *gin.Context) {
 // @Param data body request.IdsReq true "批量删除SysOperationRecord"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
 // @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete]
-func DeleteSysOperationRecordByIds(c *gin.Context) {
+func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) {
 	var IDS request.IdsReq
 	_ = c.ShouldBindJSON(&IDS)
-	if err := service.DeleteSysOperationRecordByIds(IDS); err != nil {
+	if err := operationRecordService.DeleteSysOperationRecordByIds(IDS); err != nil {
 		global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
 		response.FailWithMessage("批量删除失败", c)
 	} else {
@@ -76,14 +79,14 @@ func DeleteSysOperationRecordByIds(c *gin.Context) {
 // @Param data body model.SysOperationRecord true "Id"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
 // @Router /sysOperationRecord/findSysOperationRecord [get]
-func FindSysOperationRecord(c *gin.Context) {
-	var sysOperationRecord model.SysOperationRecord
+func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) {
+	var sysOperationRecord system.SysOperationRecord
 	_ = c.ShouldBindQuery(&sysOperationRecord)
 	if err := utils.Verify(sysOperationRecord, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, resysOperationRecord := service.GetSysOperationRecord(sysOperationRecord.ID); err != nil {
+	if err, resysOperationRecord := operationRecordService.GetSysOperationRecord(sysOperationRecord.ID); err != nil {
 		global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
 		response.FailWithMessage("查询失败", c)
 	} else {
@@ -99,10 +102,10 @@ func FindSysOperationRecord(c *gin.Context) {
 // @Param data body request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /sysOperationRecord/getSysOperationRecordList [get]
-func GetSysOperationRecordList(c *gin.Context) {
-	var pageInfo request.SysOperationRecordSearch
+func (s *OperationRecordApi) GetSysOperationRecordList(c *gin.Context) {
+	var pageInfo systemReq.SysOperationRecordSearch
 	_ = c.ShouldBindQuery(&pageInfo)
-	if err, list, total := service.GetSysOperationRecordInfoList(pageInfo); err != nil {
+	if err, list, total := operationRecordService.GetSysOperationRecordInfoList(pageInfo); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {

+ 16 - 13
server/api/v1/sys_system.go → server/api/v1/system/sys_system.go

@@ -1,28 +1,31 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemRes "gin-vue-admin/model/system/response"
 	"gin-vue-admin/utils"
 
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
 )
 
+type SystemApi struct {
+}
+
 // @Tags System
 // @Summary 获取配置文件内容
 // @Security ApiKeyAuth
 // @Produce  application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /system/getSystemConfig [post]
-func GetSystemConfig(c *gin.Context) {
-	if err, config := service.GetSystemConfig(); err != nil {
+func (s *SystemApi) GetSystemConfig(c *gin.Context) {
+	if err, config := systemConfigService.GetSystemConfig(); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
-		response.OkWithDetailed(response.SysConfigResponse{Config: config}, "获取成功", c)
+		response.OkWithDetailed(systemRes.SysConfigResponse{Config: config}, "获取成功", c)
 	}
 }
 
@@ -33,10 +36,10 @@ func GetSystemConfig(c *gin.Context) {
 // @Param data body model.System true "设置配置文件内容"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
 // @Router /system/setSystemConfig [post]
-func SetSystemConfig(c *gin.Context) {
-	var sys model.System
+func (s *SystemApi) SetSystemConfig(c *gin.Context) {
+	var sys system.System
 	_ = c.ShouldBindJSON(&sys)
-	if err := service.SetSystemConfig(sys); err != nil {
+	if err := systemConfigService.SetSystemConfig(sys); err != nil {
 		global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
 		response.FailWithMessage("设置失败", c)
 	} else {
@@ -50,7 +53,7 @@ func SetSystemConfig(c *gin.Context) {
 // @Produce  application/json
 // @Success 200 {string} string "{"code":0,"data":{},"msg":"重启系统成功"}"
 // @Router /system/reloadSystem [post]
-func ReloadSystem(c *gin.Context) {
+func (s *SystemApi) ReloadSystem(c *gin.Context) {
 	err := utils.Reload()
 	if err != nil {
 		global.GVA_LOG.Error("重启系统失败!", zap.Any("err", err))
@@ -66,8 +69,8 @@ func ReloadSystem(c *gin.Context) {
 // @Produce  application/json
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /system/getServerInfo [post]
-func GetServerInfo(c *gin.Context) {
-	if server, err := service.GetServerInfo(); err != nil {
+func (s *SystemApi) GetServerInfo(c *gin.Context) {
+	if server, err := systemConfigService.GetServerInfo(); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {

+ 46 - 78
server/api/v1/sys_user.go → server/api/v1/system/sys_user.go

@@ -1,12 +1,13 @@
-package v1
+package system
 
 import (
 	"gin-vue-admin/global"
 	"gin-vue-admin/middleware"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
-	"gin-vue-admin/service"
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	systemReq "gin-vue-admin/model/system/request"
+	systemRes "gin-vue-admin/model/system/response"
 	"gin-vue-admin/utils"
 	"time"
 
@@ -19,23 +20,23 @@ import (
 // @Tags Base
 // @Summary 用户登录
 // @Produce  application/json
-// @Param data body request.Login true "用户名, 密码, 验证码"
+// @Param data body systemReq.Login true "用户名, 密码, 验证码"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}"
 // @Router /base/login [post]
-func Login(c *gin.Context) {
-	var l request.Login
+func (b *BaseApi) Login(c *gin.Context) {
+	var l systemReq.Login
 	_ = c.ShouldBindJSON(&l)
 	if err := utils.Verify(l, utils.LoginVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
 	if store.Verify(l.CaptchaId, l.Captcha, true) {
-		u := &model.SysUser{Username: l.Username, Password: l.Password}
-		if err, user := service.Login(u); err != nil {
+		u := &system.SysUser{Username: l.Username, Password: l.Password}
+		if err, user := userService.Login(u); err != nil {
 			global.GVA_LOG.Error("登陆失败! 用户名不存在或者密码错误!", zap.Any("err", err))
 			response.FailWithMessage("用户名不存在或者密码错误", c)
 		} else {
-			tokenNext(c, *user)
+			b.tokenNext(c, *user)
 		}
 	} else {
 		response.FailWithMessage("验证码错误", c)
@@ -43,9 +44,9 @@ func Login(c *gin.Context) {
 }
 
 // 登录以后签发jwt
-func tokenNext(c *gin.Context, user model.SysUser) {
+func (b *BaseApi) tokenNext(c *gin.Context, user system.SysUser) {
 	j := &middleware.JWT{SigningKey: []byte(global.GVA_CONFIG.JWT.SigningKey)} // 唯一签名
-	claims := request.CustomClaims{
+	claims := systemReq.CustomClaims{
 		UUID:        user.UUID,
 		ID:          user.ID,
 		NickName:    user.NickName,
@@ -65,20 +66,20 @@ func tokenNext(c *gin.Context, user model.SysUser) {
 		return
 	}
 	if !global.GVA_CONFIG.System.UseMultipoint {
-		response.OkWithDetailed(response.LoginResponse{
+		response.OkWithDetailed(systemRes.LoginResponse{
 			User:      user,
 			Token:     token,
 			ExpiresAt: claims.StandardClaims.ExpiresAt * 1000,
 		}, "登录成功", c)
 		return
 	}
-	if err, jwtStr := service.GetRedisJWT(user.Username); err == redis.Nil {
-		if err := service.SetRedisJWT(token, user.Username); err != nil {
+	if err, jwtStr := jwtService.GetRedisJWT(user.Username); err == redis.Nil {
+		if err := jwtService.SetRedisJWT(token, user.Username); err != nil {
 			global.GVA_LOG.Error("设置登录状态失败!", zap.Any("err", err))
 			response.FailWithMessage("设置登录状态失败", c)
 			return
 		}
-		response.OkWithDetailed(response.LoginResponse{
+		response.OkWithDetailed(systemRes.LoginResponse{
 			User:      user,
 			Token:     token,
 			ExpiresAt: claims.StandardClaims.ExpiresAt * 1000,
@@ -87,17 +88,17 @@ func tokenNext(c *gin.Context, user model.SysUser) {
 		global.GVA_LOG.Error("设置登录状态失败!", zap.Any("err", err))
 		response.FailWithMessage("设置登录状态失败", c)
 	} else {
-		var blackJWT model.JwtBlacklist
+		var blackJWT system.JwtBlacklist
 		blackJWT.Jwt = jwtStr
-		if err := service.JsonInBlacklist(blackJWT); err != nil {
+		if err := jwtService.JsonInBlacklist(blackJWT); err != nil {
 			response.FailWithMessage("jwt作废失败", c)
 			return
 		}
-		if err := service.SetRedisJWT(token, user.Username); err != nil {
+		if err := jwtService.SetRedisJWT(token, user.Username); err != nil {
 			response.FailWithMessage("设置登录状态失败", c)
 			return
 		}
-		response.OkWithDetailed(response.LoginResponse{
+		response.OkWithDetailed(systemRes.LoginResponse{
 			User:      user,
 			Token:     token,
 			ExpiresAt: claims.StandardClaims.ExpiresAt * 1000,
@@ -108,23 +109,23 @@ func tokenNext(c *gin.Context, user model.SysUser) {
 // @Tags SysUser
 // @Summary 用户注册账号
 // @Produce  application/json
-// @Param data body model.SysUser true "用户名, 昵称, 密码, 角色ID"
+// @Param data body systemReq.Register true "用户名, 昵称, 密码, 角色ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}"
 // @Router /user/register [post]
-func Register(c *gin.Context) {
-	var r request.Register
+func (b *BaseApi) Register(c *gin.Context) {
+	var r systemReq.Register
 	_ = c.ShouldBindJSON(&r)
 	if err := utils.Verify(r, utils.RegisterVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	user := &model.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId}
-	err, userReturn := service.Register(*user)
+	user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId}
+	err, userReturn := userService.Register(*user)
 	if err != nil {
 		global.GVA_LOG.Error("注册失败!", zap.Any("err", err))
-		response.FailWithDetailed(response.SysUserResponse{User: userReturn}, "注册失败", c)
+		response.FailWithDetailed(systemRes.SysUserResponse{User: userReturn}, "注册失败", c)
 	} else {
-		response.OkWithDetailed(response.SysUserResponse{User: userReturn}, "注册成功", c)
+		response.OkWithDetailed(systemRes.SysUserResponse{User: userReturn}, "注册成功", c)
 	}
 }
 
@@ -132,18 +133,18 @@ func Register(c *gin.Context) {
 // @Summary 用户修改密码
 // @Security ApiKeyAuth
 // @Produce  application/json
-// @Param data body request.ChangePasswordStruct true "用户名, 原密码, 新密码"
+// @Param data body systemReq.ChangePasswordStruct true "用户名, 原密码, 新密码"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
 // @Router /user/changePassword [put]
-func ChangePassword(c *gin.Context) {
-	var user request.ChangePasswordStruct
+func (b *BaseApi) ChangePassword(c *gin.Context) {
+	var user systemReq.ChangePasswordStruct
 	_ = c.ShouldBindJSON(&user)
 	if err := utils.Verify(user, utils.ChangePasswordVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	u := &model.SysUser{Username: user.Username, Password: user.Password}
-	if err, _ := service.ChangePassword(u, user.NewPassword); err != nil {
+	u := &system.SysUser{Username: user.Username, Password: user.Password}
+	if err, _ := userService.ChangePassword(u, user.NewPassword); err != nil {
 		global.GVA_LOG.Error("修改失败!", zap.Any("err", err))
 		response.FailWithMessage("修改失败,原密码与当前账户不符", c)
 	} else {
@@ -159,14 +160,14 @@ func ChangePassword(c *gin.Context) {
 // @Param data body request.PageInfo true "页码, 每页大小"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /user/getUserList [post]
-func GetUserList(c *gin.Context) {
+func (b *BaseApi) GetUserList(c *gin.Context) {
 	var pageInfo request.PageInfo
 	_ = c.ShouldBindJSON(&pageInfo)
 	if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, list, total := service.GetUserInfoList(pageInfo); err != nil {
+	if err, list, total := userService.GetUserInfoList(pageInfo); err != nil {
 		global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
 		response.FailWithMessage("获取失败", c)
 	} else {
@@ -184,17 +185,17 @@ func GetUserList(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.SetUserAuth true "用户UUID, 角色ID"
+// @Param data body systemReq.SetUserAuth true "用户UUID, 角色ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}"
 // @Router /user/setUserAuthority [post]
-func SetUserAuthority(c *gin.Context) {
-	var sua request.SetUserAuth
+func (b *BaseApi) SetUserAuthority(c *gin.Context) {
+	var sua systemReq.SetUserAuth
 	_ = c.ShouldBindJSON(&sua)
 	if UserVerifyErr := utils.Verify(sua, utils.SetUserAuthorityVerify); UserVerifyErr != nil {
 		response.FailWithMessage(UserVerifyErr.Error(), c)
 		return
 	}
-	if err := service.SetUserAuthority(sua.UUID, sua.AuthorityId); err != nil {
+	if err := userService.SetUserAuthority(sua.UUID, sua.AuthorityId); err != nil {
 		global.GVA_LOG.Error("修改失败!", zap.Any("err", err))
 		response.FailWithMessage("修改失败", c)
 	} else {
@@ -210,19 +211,19 @@ func SetUserAuthority(c *gin.Context) {
 // @Param data body request.GetById true "用户ID"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /user/deleteUser [delete]
-func DeleteUser(c *gin.Context) {
+func (b *BaseApi) DeleteUser(c *gin.Context) {
 	var reqId request.GetById
 	_ = c.ShouldBindJSON(&reqId)
 	if err := utils.Verify(reqId, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	jwtId := getUserID(c)
+	jwtId := utils.GetUserID(c)
 	if jwtId == uint(reqId.ID) {
 		response.FailWithMessage("删除失败, 自杀失败", c)
 		return
 	}
-	if err := service.DeleteUser(reqId.ID); err != nil {
+	if err := userService.DeleteUser(reqId.ID); err != nil {
 		global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -238,50 +239,17 @@ func DeleteUser(c *gin.Context) {
 // @Param data body model.SysUser true "ID, 用户名, 昵称, 头像链接"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}"
 // @Router /user/setUserInfo [put]
-func SetUserInfo(c *gin.Context) {
-	var user model.SysUser
+func (b *BaseApi) SetUserInfo(c *gin.Context) {
+	var user system.SysUser
 	_ = c.ShouldBindJSON(&user)
 	if err := utils.Verify(user, utils.IdVerify); err != nil {
 		response.FailWithMessage(err.Error(), c)
 		return
 	}
-	if err, ReqUser := service.SetUserInfo(user); err != nil {
+	if err, ReqUser := userService.SetUserInfo(user); err != nil {
 		global.GVA_LOG.Error("设置失败!", zap.Any("err", err))
 		response.FailWithMessage("设置失败", c)
 	} else {
 		response.OkWithDetailed(gin.H{"userInfo": ReqUser}, "设置成功", c)
 	}
 }
-
-// 从Gin的Context中获取从jwt解析出来的用户ID
-func getUserID(c *gin.Context) uint {
-	if claims, exists := c.Get("claims"); !exists {
-		global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户ID失败, 请检查路由是否使用jwt中间件!")
-		return 0
-	} else {
-		waitUse := claims.(*request.CustomClaims)
-		return waitUse.ID
-	}
-}
-
-// 从Gin的Context中获取从jwt解析出来的用户UUID
-func getUserUuid(c *gin.Context) string {
-	if claims, exists := c.Get("claims"); !exists {
-		global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!")
-		return ""
-	} else {
-		waitUse := claims.(*request.CustomClaims)
-		return waitUse.UUID.String()
-	}
-}
-
-// 从Gin的Context中获取从jwt解析出来的用户角色id
-func getUserAuthorityId(c *gin.Context) string {
-	if claims, exists := c.Get("claims"); !exists {
-		global.GVA_LOG.Error("从Gin的Context中获取从jwt解析出来的用户UUID失败, 请检查路由是否使用jwt中间件!")
-		return ""
-	} else {
-		waitUse := claims.(*request.CustomClaims)
-		return waitUse.AuthorityId
-	}
-}

+ 5 - 5
server/config.yaml

@@ -74,12 +74,12 @@ autocode:
   transfer-restart: true
   root: ""
   server: /server
-  server-api: /api/v1
+  server-api: /api/v1/autocode
   server-initialize: /initialize
-  server-model: /model
-  server-request: /model/request/
-  server-router: /router
-  server-service: /service
+  server-model: /model/autocode
+  server-request: /model/autocode/request/
+  server-router: /router/autocode
+  server-service: /service/autocode
   web: /web/src
   web-api: /api
   web-flow: /view

+ 19 - 16
server/initialize/gorm.go

@@ -3,7 +3,9 @@ package initialize
 import (
 	"gin-vue-admin/global"
 	"gin-vue-admin/initialize/internal"
-	"gin-vue-admin/model"
+	"gin-vue-admin/model/autocode"
+	"gin-vue-admin/model/example"
+	"gin-vue-admin/model/system"
 	"os"
 
 	"go.uber.org/zap"
@@ -34,22 +36,23 @@ func Gorm() *gorm.DB {
 
 func MysqlTables(db *gorm.DB) {
 	err := db.AutoMigrate(
-		model.SysUser{},
-		model.SysAuthority{},
-		model.SysApi{},
-		model.SysBaseMenu{},
-		model.SysBaseMenuParameter{},
-		model.JwtBlacklist{},
-		model.SysDictionary{},
-		model.SysDictionaryDetail{},
-		model.ExaFileUploadAndDownload{},
-		model.ExaFile{},
-		model.ExaFileChunk{},
-		model.ExaSimpleUploader{},
-		model.ExaCustomer{},
-		model.SysOperationRecord{},
-		model.SysAutoCodeHistory{},
+		system.SysUser{},
+		system.SysAuthority{},
+		system.SysApi{},
+		system.SysBaseMenu{},
+		system.SysBaseMenuParameter{},
+		system.JwtBlacklist{},
+		system.SysDictionary{},
+		system.SysDictionaryDetail{},
+		example.ExaFileUploadAndDownload{},
+		example.ExaFile{},
+		example.ExaFileChunk{},
+		example.ExaSimpleUploader{},
+		example.ExaCustomer{},
+		system.SysOperationRecord{},
+		system.SysAutoCodeHistory{},
 		// Code generated by gin-vue-admin Begin; DO NOT EDIT.
+		autocode.AutoCodeExample{},
 		// Code generated by gin-vue-admin End; DO NOT EDIT.
 	)
 	if err != nil {

+ 24 - 18
server/initialize/router.go

@@ -25,32 +25,38 @@ func Routers() *gin.Engine {
 	Router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
 	global.GVA_LOG.Info("register swagger handler")
 	// 方便统一添加路由组前缀 多服务器上线使用
+
+	//获取路由组实例
+	systemRouter := router.RouterGroupApp.System
+	exampleRouter := router.RouterGroupApp.Example
+	autocodeRouter := router.RouterGroupApp.Autocode
 	PublicGroup := Router.Group("")
 	{
-		router.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
-		router.InitInitRouter(PublicGroup) // 自动初始化相关
+		systemRouter.InitBaseRouter(PublicGroup) // 注册基础功能路由 不做鉴权
+		systemRouter.InitInitRouter(PublicGroup) // 自动初始化相关
 	}
 	PrivateGroup := Router.Group("")
 	PrivateGroup.Use(middleware.JWTAuth()).Use(middleware.CasbinHandler())
 	{
-		router.InitApiRouter(PrivateGroup)                   // 注册功能api路由
-		router.InitJwtRouter(PrivateGroup)                   // jwt相关路由
-		router.InitUserRouter(PrivateGroup)                  // 注册用户路由
-		router.InitMenuRouter(PrivateGroup)                  // 注册menu路由
-		router.InitEmailRouter(PrivateGroup)                 // 邮件相关路由
-		router.InitSystemRouter(PrivateGroup)                // system相关路由
-		router.InitCasbinRouter(PrivateGroup)                // 权限相关路由
-		router.InitCustomerRouter(PrivateGroup)              // 客户路由
-		router.InitAutoCodeRouter(PrivateGroup)              // 创建自动化代码
-		router.InitAuthorityRouter(PrivateGroup)             // 注册角色路由
-		router.InitSimpleUploaderRouter(PrivateGroup)        // 断点续传(插件版)
-		router.InitSysDictionaryRouter(PrivateGroup)         // 字典管理
-		router.InitSysOperationRecordRouter(PrivateGroup)    // 操作记录
-		router.InitSysDictionaryDetailRouter(PrivateGroup)   // 字典详情管理
-		router.InitFileUploadAndDownloadRouter(PrivateGroup) // 文件上传下载功能路由
-		router.InitExcelRouter(PrivateGroup)                 // 表格导入导出
+		systemRouter.InitApiRouter(PrivateGroup)                    // 注册功能api路由
+		systemRouter.InitJwtRouter(PrivateGroup)                    // jwt相关路由
+		systemRouter.InitUserRouter(PrivateGroup)                   // 注册用户路由
+		systemRouter.InitMenuRouter(PrivateGroup)                   // 注册menu路由
+		systemRouter.InitEmailRouter(PrivateGroup)                  // 邮件相关路由
+		systemRouter.InitSystemRouter(PrivateGroup)                 // system相关路由
+		systemRouter.InitCasbinRouter(PrivateGroup)                 // 权限相关路由
+		systemRouter.InitAutoCodeRouter(PrivateGroup)               // 创建自动化代码
+		systemRouter.InitAuthorityRouter(PrivateGroup)              // 注册角色路由
+		systemRouter.InitSysDictionaryRouter(PrivateGroup)          // 字典管理
+		systemRouter.InitSysOperationRecordRouter(PrivateGroup)     // 操作记录
+		systemRouter.InitSysDictionaryDetailRouter(PrivateGroup)    // 字典详情管理
+		exampleRouter.InitFileUploadAndDownloadRouter(PrivateGroup) // 文件上传下载功能路由
+		exampleRouter.InitExcelRouter(PrivateGroup)                 // 表格导入导出
+		exampleRouter.InitSimpleUploaderRouter(PrivateGroup)        // 断点续传(插件版)
+		exampleRouter.InitCustomerRouter(PrivateGroup)              // 客户路由
 
 		// Code generated by gin-vue-admin Begin; DO NOT EDIT.
+		autocodeRouter.InitSysAutoCodeExampleRouter(PrivateGroup)
 		// Code generated by gin-vue-admin End; DO NOT EDIT.
 	}
 	global.GVA_LOG.Info("router register success")

+ 5 - 3
server/middleware/casbin_rbac.go

@@ -2,12 +2,14 @@ package middleware
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system/request"
 	"gin-vue-admin/service"
 	"github.com/gin-gonic/gin"
 )
 
+var casbinService = service.ServiceGroupApp.SystemServiceGroup.CasbinService
+
 // 拦截器
 func CasbinHandler() gin.HandlerFunc {
 	return func(c *gin.Context) {
@@ -19,7 +21,7 @@ func CasbinHandler() gin.HandlerFunc {
 		act := c.Request.Method
 		// 获取用户的角色
 		sub := waitUse.AuthorityId
-		e := service.Casbin()
+		e := casbinService.Casbin()
 		// 判断策略中是否存在
 		success, _ := e.Enforce(sub, obj, act)
 		if global.GVA_CONFIG.System.Env == "develop" || success {

+ 6 - 4
server/middleware/email.go

@@ -2,8 +2,8 @@ package middleware
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
+	"gin-vue-admin/model/system"
+	"gin-vue-admin/model/system/request"
 	"gin-vue-admin/service"
 	"gin-vue-admin/utils"
 	"github.com/gin-gonic/gin"
@@ -13,6 +13,8 @@ import (
 	"time"
 )
 
+var userService = service.ServiceGroupApp.SystemServiceGroup.UserService
+
 func ErrorToEmail() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		var username string
@@ -21,14 +23,14 @@ func ErrorToEmail() gin.HandlerFunc {
 			username = waitUse.Username
 		} else {
 			id, _ := strconv.Atoi(c.Request.Header.Get("x-user-id"))
-			err, user := service.FindUserById(id)
+			err, user := userService.FindUserById(id)
 			if err != nil {
 				username = "Unknown"
 			}
 			username = user.Username
 		}
 		body, _ := ioutil.ReadAll(c.Request.Body)
-		record := model.SysOperationRecord{
+		record := system.SysOperationRecord{
 			Ip:     c.ClientIP(),
 			Method: c.Request.Method,
 			Path:   c.Request.URL.Path,

+ 11 - 9
server/middleware/jwt.go

@@ -3,9 +3,9 @@ package middleware
 import (
 	"errors"
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
-	"gin-vue-admin/model/response"
+	"gin-vue-admin/model/common/response"
+	"gin-vue-admin/model/system"
+	"gin-vue-admin/model/system/request"
 	"gin-vue-admin/service"
 	"strconv"
 	"time"
@@ -15,6 +15,8 @@ import (
 	"go.uber.org/zap"
 )
 
+var jwtService = service.ServiceGroupApp.SystemServiceGroup.JwtService
+
 func JWTAuth() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		// 我们这里jwt鉴权取头部信息 x-token 登录时回返回token信息 这里前端需要把token存储到cookie或者本地localStorage中 不过需要跟后端协商过期时间 可以约定刷新令牌或者重新登录
@@ -24,7 +26,7 @@ func JWTAuth() gin.HandlerFunc {
 			c.Abort()
 			return
 		}
-		if service.IsBlacklist(token) {
+		if jwtService.IsBlacklist(token) {
 			response.FailWithDetailed(gin.H{"reload": true}, "您的帐户异地登陆或令牌失效", c)
 			c.Abort()
 			return
@@ -42,8 +44,8 @@ func JWTAuth() gin.HandlerFunc {
 			c.Abort()
 			return
 		}
-		if err, _ = service.FindUserByUuid(claims.UUID.String()); err != nil {
-			_ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: token})
+		if err, _ = userService.FindUserByUuid(claims.UUID.String()); err != nil {
+			_ = jwtService.JsonInBlacklist(system.JwtBlacklist{Jwt: token})
 			response.FailWithDetailed(gin.H{"reload": true}, err.Error(), c)
 			c.Abort()
 		}
@@ -54,14 +56,14 @@ func JWTAuth() gin.HandlerFunc {
 			c.Header("new-token", newToken)
 			c.Header("new-expires-at", strconv.FormatInt(newClaims.ExpiresAt, 10))
 			if global.GVA_CONFIG.System.UseMultipoint {
-				err, RedisJwtToken := service.GetRedisJWT(newClaims.Username)
+				err, RedisJwtToken := jwtService.GetRedisJWT(newClaims.Username)
 				if err != nil {
 					global.GVA_LOG.Error("get redis jwt failed", zap.Any("err", err))
 				} else { // 当之前的取成功时才进行拉黑操作
-					_ = service.JsonInBlacklist(model.JwtBlacklist{Jwt: RedisJwtToken})
+					_ = jwtService.JsonInBlacklist(system.JwtBlacklist{Jwt: RedisJwtToken})
 				}
 				// 无论如何都要记录当前的活跃状态
-				_ = service.SetRedisJWT(newToken, newClaims.Username)
+				_ = jwtService.SetRedisJWT(newToken, newClaims.Username)
 			}
 		}
 		c.Set("claims", claims)

+ 1 - 1
server/middleware/need_init.go

@@ -2,7 +2,7 @@ package middleware
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model/response"
+	"gin-vue-admin/model/common/response"
 	"github.com/gin-gonic/gin"
 )
 

+ 6 - 4
server/middleware/operation.go

@@ -3,8 +3,8 @@ package middleware
 import (
 	"bytes"
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
+	"gin-vue-admin/model/system"
+	"gin-vue-admin/model/system/request"
 	"gin-vue-admin/service"
 	"github.com/gin-gonic/gin"
 	"go.uber.org/zap"
@@ -14,6 +14,8 @@ import (
 	"time"
 )
 
+var operationRecordService = service.ServiceGroupApp.SystemServiceGroup.OperationRecordService
+
 func OperationRecord() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		var body []byte
@@ -37,7 +39,7 @@ func OperationRecord() gin.HandlerFunc {
 			}
 			userId = id
 		}
-		record := model.SysOperationRecord{
+		record := system.SysOperationRecord{
 			Ip:     c.ClientIP(),
 			Method: c.Request.Method,
 			Path:   c.Request.URL.Path,
@@ -65,7 +67,7 @@ func OperationRecord() gin.HandlerFunc {
 		record.Latency = latency
 		record.Resp = writer.body.String()
 
-		if err := service.CreateSysOperationRecord(record); err != nil {
+		if err := operationRecordService.CreateSysOperationRecord(record); err != nil {
 			global.GVA_LOG.Error("create operation record error:", zap.Any("err", err))
 		}
 	}

+ 12 - 0
server/model/autocode/autocodeExample.go

@@ -0,0 +1,12 @@
+// 自动生成模板SysDictionaryDetail
+package autocode
+
+import (
+	"gin-vue-admin/global"
+)
+
+// 如果含有time.Time 请自行import time包
+type AutoCodeExample struct {
+	global.GVA_MODEL
+	AutoCodeExampleField string `json:"autoCodeExampleField" form:"autoCodeExampleField" gorm:"column:auto_code_example_field;comment:仅作示例条目无实际作用"` // 展示值
+}

+ 13 - 0
server/model/autocode/request/autocodeExample.go

@@ -0,0 +1,13 @@
+// 自动生成模板SysDictionaryDetail
+package request
+
+import (
+	"gin-vue-admin/model/autocode"
+	"gin-vue-admin/model/common/request"
+)
+
+// 如果含有time.Time 请自行import time包
+type AutoCodeExampleSearch struct {
+	autocode.AutoCodeExample
+	request.PageInfo
+}

+ 0 - 0
server/model/request/common.go → server/model/common/request/common.go


+ 0 - 0
server/model/response/common.go → server/model/common/response/common.go


+ 0 - 0
server/model/response/response.go → server/model/common/response/response.go


+ 0 - 14
server/model/exa_customer.go

@@ -1,14 +0,0 @@
-package model
-
-import (
-	"gin-vue-admin/global"
-)
-
-type ExaCustomer struct {
-	global.GVA_MODEL
-	CustomerName       string  `json:"customerName" form:"customerName" gorm:"comment:客户名"`                // 客户名
-	CustomerPhoneData  string  `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:客户手机号"`    // 客户手机号
-	SysUserID          uint    `json:"sysUserId" form:"sysUserId" gorm:"comment:管理ID"`                     // 管理ID
-	SysUserAuthorityID string  `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:管理角色ID"` // 管理角色ID
-	SysUser            SysUser `json:"sysUser" form:"sysUser" gorm:"comment:管理详情"`                         // 管理详情
-}

+ 0 - 6
server/model/exa_excel.go

@@ -1,6 +0,0 @@
-package model
-
-type ExcelInfo struct {
-	FileName string        `json:"fileName"` // 文件名
-	InfoList []SysBaseMenu `json:"infoList"`
-}

+ 1 - 1
server/model/exa_breakpoint_continue.go → server/model/example/exa_breakpoint_continue.go

@@ -1,4 +1,4 @@
-package model
+package example
 
 import (
 	"gin-vue-admin/global"

+ 15 - 0
server/model/example/exa_customer.go

@@ -0,0 +1,15 @@
+package example
+
+import (
+	"gin-vue-admin/global"
+	"gin-vue-admin/model/system"
+)
+
+type ExaCustomer struct {
+	global.GVA_MODEL
+	CustomerName       string         `json:"customerName" form:"customerName" gorm:"comment:客户名"`                // 客户名
+	CustomerPhoneData  string         `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:客户手机号"`    // 客户手机号
+	SysUserID          uint           `json:"sysUserId" form:"sysUserId" gorm:"comment:管理ID"`                     // 管理ID
+	SysUserAuthorityID string         `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:管理角色ID"` // 管理角色ID
+	SysUser            system.SysUser `json:"sysUser" form:"sysUser" gorm:"comment:管理详情"`                         // 管理详情
+}

+ 8 - 0
server/model/example/exa_excel.go

@@ -0,0 +1,8 @@
+package example
+
+import "gin-vue-admin/model/system"
+
+type ExcelInfo struct {
+	FileName string               `json:"fileName"` // 文件名
+	InfoList []system.SysBaseMenu `json:"infoList"`
+}

+ 1 - 1
server/model/exa_file_upload_download.go → server/model/example/exa_file_upload_download.go

@@ -1,4 +1,4 @@
-package model
+package example
 
 import (
 	"gin-vue-admin/global"

+ 1 - 1
server/model/exa_simple_uploader.go → server/model/example/exa_simple_uploader.go

@@ -1,4 +1,4 @@
-package model
+package example
 
 type ExaSimpleUploader struct {
 	ChunkNumber      string `json:"chunkNumber" gorm:"comment:当前切片标记"`

+ 2 - 2
server/model/response/exa_breakpoint_continue.go → server/model/example/response/exa_breakpoint_continue.go

@@ -1,11 +1,11 @@
 package response
 
-import "gin-vue-admin/model"
+import "gin-vue-admin/model/example"
 
 type FilePathResponse struct {
 	FilePath string `json:"filePath"`
 }
 
 type FileResponse struct {
-	File model.ExaFile `json:"file"`
+	File example.ExaFile `json:"file"`
 }

+ 7 - 0
server/model/example/response/exa_customer.go

@@ -0,0 +1,7 @@
+package response
+
+import "gin-vue-admin/model/example"
+
+type ExaCustomerResponse struct {
+	Customer example.ExaCustomer `json:"customer"`
+}

+ 7 - 0
server/model/example/response/exa_file_upload_download.go

@@ -0,0 +1,7 @@
+package response
+
+import "gin-vue-admin/model/example"
+
+type ExaFileResponse struct {
+	File example.ExaFileUploadAndDownload `json:"file"`
+}

+ 0 - 8
server/model/request/sys_dictionary.go

@@ -1,8 +0,0 @@
-package request
-
-import "gin-vue-admin/model"
-
-type SysDictionarySearch struct {
-	model.SysDictionary
-	PageInfo
-}

+ 0 - 8
server/model/request/sys_dictionary_detail.go

@@ -1,8 +0,0 @@
-package request
-
-import "gin-vue-admin/model"
-
-type SysDictionaryDetailSearch struct {
-	model.SysDictionaryDetail
-	PageInfo
-}

+ 0 - 8
server/model/request/sys_operation_record.go

@@ -1,8 +0,0 @@
-package request
-
-import "gin-vue-admin/model"
-
-type SysOperationRecordSearch struct {
-	model.SysOperationRecord
-	PageInfo
-}

+ 0 - 7
server/model/response/exa_customer.go

@@ -1,7 +0,0 @@
-package response
-
-import "gin-vue-admin/model"
-
-type ExaCustomerResponse struct {
-	Customer model.ExaCustomer `json:"customer"`
-}

+ 0 - 7
server/model/response/exa_file_upload_download.go

@@ -1,7 +0,0 @@
-package response
-
-import "gin-vue-admin/model"
-
-type ExaFileResponse struct {
-	File model.ExaFileUploadAndDownload `json:"file"`
-}

+ 0 - 11
server/model/response/sys_api.go

@@ -1,11 +0,0 @@
-package response
-
-import "gin-vue-admin/model"
-
-type SysAPIResponse struct {
-	Api model.SysApi `json:"api"`
-}
-
-type SysAPIListResponse struct {
-	Apis []model.SysApi `json:"apis"`
-}

+ 0 - 12
server/model/response/sys_authority.go

@@ -1,12 +0,0 @@
-package response
-
-import "gin-vue-admin/model"
-
-type SysAuthorityResponse struct {
-	Authority model.SysAuthority `json:"authority"`
-}
-
-type SysAuthorityCopyResponse struct {
-	Authority      model.SysAuthority `json:"authority"`
-	OldAuthorityId string             `json:"oldAuthorityId"` // 旧角色ID
-}

+ 0 - 15
server/model/response/sys_menu.go

@@ -1,15 +0,0 @@
-package response
-
-import "gin-vue-admin/model"
-
-type SysMenusResponse struct {
-	Menus []model.SysMenu `json:"menus"`
-}
-
-type SysBaseMenusResponse struct {
-	Menus []model.SysBaseMenu `json:"menus"`
-}
-
-type SysBaseMenuResponse struct {
-	Menu model.SysBaseMenu `json:"menu"`
-}

+ 0 - 15
server/model/response/sys_user.go

@@ -1,15 +0,0 @@
-package response
-
-import (
-	"gin-vue-admin/model"
-)
-
-type SysUserResponse struct {
-	User model.SysUser `json:"user"`
-}
-
-type LoginResponse struct {
-	User      model.SysUser `json:"user"`
-	Token     string        `json:"token"`
-	ExpiresAt int64         `json:"expiresAt"`
-}

+ 0 - 36
server/model/sys_base_menu.go

@@ -1,36 +0,0 @@
-package model
-
-import (
-	"gin-vue-admin/global"
-)
-
-type SysBaseMenu struct {
-	global.GVA_MODEL
-	MenuLevel     uint                   `json:"-"`
-	ParentId      string                 `json:"parentId" gorm:"comment:父菜单ID"`     // 父菜单ID
-	Path          string                 `json:"path" gorm:"comment:路由path"`        // 路由path
-	Name          string                 `json:"name" gorm:"comment:路由name"`        // 路由name
-	Hidden        bool                   `json:"hidden" gorm:"comment:是否在列表隐藏"`     // 是否在列表隐藏
-	Component     string                 `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
-	Sort          int                    `json:"sort" gorm:"comment:排序标记"`          // 排序标记
-	Meta          `json:"meta" gorm:"comment:附加属性"`                                 // 附加属性
-	SysAuthoritys []SysAuthority         `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
-	Children      []SysBaseMenu          `json:"children" gorm:"-"`
-	Parameters    []SysBaseMenuParameter `json:"parameters"`
-}
-
-type Meta struct {
-	KeepAlive   bool   `json:"keepAlive" gorm:"comment:是否缓存"`           // 是否缓存
-	DefaultMenu bool   `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
-	Title       string `json:"title" gorm:"comment:菜单名"`                // 菜单名
-	Icon        string `json:"icon" gorm:"comment:菜单图标"`                // 菜单图标
-	CloseTab    bool   `json:"closeTab" gorm:"comment:自动关闭tab"`         // 自动关闭tab
-}
-
-type SysBaseMenuParameter struct {
-	global.GVA_MODEL
-	SysBaseMenuID uint
-	Type          string `json:"type" gorm:"comment:地址栏携带参数为params还是query"` // 地址栏携带参数为params还是query
-	Key           string `json:"key" gorm:"comment:地址栏携带参数的key"`            // 地址栏携带参数的key
-	Value         string `json:"value" gorm:"comment:地址栏携带参数的值"`            // 地址栏携带参数的值
-}

+ 0 - 0
server/model/request/jwt.go → server/model/system/request/jwt.go


+ 6 - 3
server/model/request/sys_api.go → server/model/system/request/sys_api.go

@@ -1,11 +1,14 @@
 package request
 
-import "gin-vue-admin/model"
+import (
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/system"
+)
 
 // api分页条件查询及排序结构体
 type SearchApiParams struct {
-	model.SysApi
-	PageInfo
+	system.SysApi
+	request.PageInfo
 	OrderKey string `json:"orderKey"` // 排序
 	Desc     bool   `json:"desc"`     // 排序方式:升序false(默认)|降序true
 }

+ 3 - 1
server/model/request/sys_autocode.go → server/model/system/request/sys_autocode.go

@@ -1,7 +1,9 @@
 package request
 
+import "gin-vue-admin/model/common/request"
+
 type SysAutoHistory struct {
-	PageInfo
+	request.PageInfo
 }
 
 type AutoHistoryByID struct {

+ 0 - 0
server/model/request/sys_casbin.go → server/model/system/request/sys_casbin.go


+ 11 - 0
server/model/system/request/sys_dictionary.go

@@ -0,0 +1,11 @@
+package request
+
+import (
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/system"
+)
+
+type SysDictionarySearch struct {
+	system.SysDictionary
+	request.PageInfo
+}

+ 11 - 0
server/model/system/request/sys_dictionary_detail.go

@@ -0,0 +1,11 @@
+package request
+
+import (
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/system"
+)
+
+type SysDictionaryDetailSearch struct {
+	system.SysDictionaryDetail
+	request.PageInfo
+}

+ 0 - 0
server/model/request/sys_init.go → server/model/system/request/sys_init.go


+ 5 - 5
server/model/request/sys_menu.go → server/model/system/request/sys_menu.go

@@ -2,24 +2,24 @@ package request
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
+	"gin-vue-admin/model/system"
 )
 
 // Add menu authority info structure
 type AddMenuAuthorityInfo struct {
-	Menus       []model.SysBaseMenu
+	Menus       []system.SysBaseMenu
 	AuthorityId string // 角色ID
 }
 
-func DefaultMenu() []model.SysBaseMenu {
-	return []model.SysBaseMenu{{
+func DefaultMenu() []system.SysBaseMenu {
+	return []system.SysBaseMenu{{
 		GVA_MODEL: global.GVA_MODEL{ID: 1},
 		ParentId:  "0",
 		Path:      "dashboard",
 		Name:      "dashboard",
 		Component: "view/dashboard/index.vue",
 		Sort:      1,
-		Meta: model.Meta{
+		Meta: system.Meta{
 			Title: "仪表盘",
 			Icon:  "setting",
 		},

+ 11 - 0
server/model/system/request/sys_operation_record.go

@@ -0,0 +1,11 @@
+package request
+
+import (
+	"gin-vue-admin/model/common/request"
+	"gin-vue-admin/model/system"
+)
+
+type SysOperationRecordSearch struct {
+	system.SysOperationRecord
+	request.PageInfo
+}

+ 0 - 0
server/model/request/sys_user.go → server/model/system/request/sys_user.go


+ 11 - 0
server/model/system/response/sys_api.go

@@ -0,0 +1,11 @@
+package response
+
+import "gin-vue-admin/model/system"
+
+type SysAPIResponse struct {
+	Api system.SysApi `json:"api"`
+}
+
+type SysAPIListResponse struct {
+	Apis []system.SysApi `json:"apis"`
+}

+ 12 - 0
server/model/system/response/sys_authority.go

@@ -0,0 +1,12 @@
+package response
+
+import "gin-vue-admin/model/system"
+
+type SysAuthorityResponse struct {
+	Authority system.SysAuthority `json:"authority"`
+}
+
+type SysAuthorityCopyResponse struct {
+	Authority      system.SysAuthority `json:"authority"`
+	OldAuthorityId string              `json:"oldAuthorityId"` // 旧角色ID
+}

+ 0 - 0
server/model/response/sys_captcha.go → server/model/system/response/sys_captcha.go


+ 3 - 1
server/model/response/sys_casbin.go → server/model/system/response/sys_casbin.go

@@ -1,6 +1,8 @@
 package response
 
-import "gin-vue-admin/model/request"
+import (
+	"gin-vue-admin/model/system/request"
+)
 
 type PolicyPathResponse struct {
 	Paths []request.CasbinInfo `json:"paths"`

+ 15 - 0
server/model/system/response/sys_menu.go

@@ -0,0 +1,15 @@
+package response
+
+import "gin-vue-admin/model/system"
+
+type SysMenusResponse struct {
+	Menus []system.SysMenu `json:"menus"`
+}
+
+type SysBaseMenusResponse struct {
+	Menus []system.SysBaseMenu `json:"menus"`
+}
+
+type SysBaseMenuResponse struct {
+	Menu system.SysBaseMenu `json:"menu"`
+}

+ 0 - 0
server/model/response/sys_system.go → server/model/system/response/sys_system.go


+ 15 - 0
server/model/system/response/sys_user.go

@@ -0,0 +1,15 @@
+package response
+
+import (
+	"gin-vue-admin/model/system"
+)
+
+type SysUserResponse struct {
+	User system.SysUser `json:"user"`
+}
+
+type LoginResponse struct {
+	User      system.SysUser `json:"user"`
+	Token     string         `json:"token"`
+	ExpiresAt int64          `json:"expiresAt"`
+}

+ 4 - 4
server/model/sys_api.go → server/model/system/sys_api.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import (
 	"gin-vue-admin/global"
@@ -6,8 +6,8 @@ import (
 
 type SysApi struct {
 	global.GVA_MODEL
-	Path        string `json:"path" gorm:"comment:api路径"`                    // api路径
-	Description string `json:"description" gorm:"comment:api中文描述"`           // api中文描述
-	ApiGroup    string `json:"apiGroup" gorm:"comment:api组"`                 // api组
+	Path        string `json:"path" gorm:"comment:api路径"`             // api路径
+	Description string `json:"description" gorm:"comment:api中文描述"`    // api中文描述
+	ApiGroup    string `json:"apiGroup" gorm:"comment:api组"`          // api组
 	Method      string `json:"method" gorm:"default:POST;comment:方法"` // 方法:创建POST(默认)|查看GET|更新PUT|删除DELETE
 }

+ 1 - 1
server/model/sys_authority.go → server/model/system/sys_authority.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import (
 	"time"

+ 1 - 1
server/model/sys_authority_menu.go → server/model/system/sys_authority_menu.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 type SysMenu struct {
 	SysBaseMenu

+ 1 - 1
server/model/sys_auto_code.go → server/model/system/sys_auto_code.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import "errors"
 

+ 1 - 1
server/model/sys_autocode_history.go → server/model/system/sys_autocode_history.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import "gin-vue-admin/global"
 

+ 36 - 0
server/model/system/sys_base_menu.go

@@ -0,0 +1,36 @@
+package system
+
+import (
+	"gin-vue-admin/global"
+)
+
+type SysBaseMenu struct {
+	global.GVA_MODEL
+	MenuLevel     uint                              `json:"-"`
+	ParentId      string                            `json:"parentId" gorm:"comment:父菜单ID"`     // 父菜单ID
+	Path          string                            `json:"path" gorm:"comment:路由path"`        // 路由path
+	Name          string                            `json:"name" gorm:"comment:路由name"`        // 路由name
+	Hidden        bool                              `json:"hidden" gorm:"comment:是否在列表隐藏"`     // 是否在列表隐藏
+	Component     string                            `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
+	Sort          int                               `json:"sort" gorm:"comment:排序标记"`          // 排序标记
+	Meta          `json:"meta" gorm:"comment:附加属性"` // 附加属性
+	SysAuthoritys []SysAuthority                    `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
+	Children      []SysBaseMenu                     `json:"children" gorm:"-"`
+	Parameters    []SysBaseMenuParameter            `json:"parameters"`
+}
+
+type Meta struct {
+	KeepAlive   bool   `json:"keepAlive" gorm:"comment:是否缓存"`           // 是否缓存
+	DefaultMenu bool   `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
+	Title       string `json:"title" gorm:"comment:菜单名"`                // 菜单名
+	Icon        string `json:"icon" gorm:"comment:菜单图标"`                // 菜单图标
+	CloseTab    bool   `json:"closeTab" gorm:"comment:自动关闭tab"`         // 自动关闭tab
+}
+
+type SysBaseMenuParameter struct {
+	global.GVA_MODEL
+	SysBaseMenuID uint
+	Type          string `json:"type" gorm:"comment:地址栏携带参数为params还是query"` // 地址栏携带参数为params还是query
+	Key           string `json:"key" gorm:"comment:地址栏携带参数的key"`            // 地址栏携带参数的key
+	Value         string `json:"value" gorm:"comment:地址栏携带参数的值"`            // 地址栏携带参数的值
+}

+ 1 - 1
server/model/sys_casbin.go → server/model/system/sys_casbin.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 type CasbinModel struct {
 	Ptype       string `json:"ptype" gorm:"column:ptype"`

+ 1 - 1
server/model/sys_dictionary.go → server/model/system/sys_dictionary.go

@@ -1,5 +1,5 @@
 // 自动生成模板SysDictionary
-package model
+package system
 
 import (
 	"gin-vue-admin/global"

+ 1 - 1
server/model/sys_dictionary_detail.go → server/model/system/sys_dictionary_detail.go

@@ -1,5 +1,5 @@
 // 自动生成模板SysDictionaryDetail
-package model
+package system
 
 import (
 	"gin-vue-admin/global"

+ 1 - 1
server/model/sys_initdb.go → server/model/system/sys_initdb.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 type InitDBFunc interface {
 	Init() (err error)

+ 1 - 1
server/model/sys_jwt_blacklist.go → server/model/system/sys_jwt_blacklist.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import (
 	"gin-vue-admin/global"

+ 1 - 1
server/model/sys_operation_record.go → server/model/system/sys_operation_record.go

@@ -1,5 +1,5 @@
 // 自动生成模板SysOperationRecord
-package model
+package system
 
 import (
 	"gin-vue-admin/global"

+ 1 - 1
server/model/sys_system.go → server/model/system/sys_system.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import (
 	"gin-vue-admin/config"

+ 5 - 5
server/model/sys_user.go → server/model/system/sys_user.go

@@ -1,4 +1,4 @@
-package model
+package system
 
 import (
 	"gin-vue-admin/global"
@@ -13,8 +13,8 @@ type SysUser struct {
 	NickName    string       `json:"nickName" gorm:"default:系统用户;comment:用户昵称"`                                     // 用户昵称
 	HeaderImg   string       `json:"headerImg" gorm:"default:http://qmplusimg.henrongyi.top/head.png;comment:用户头像"` // 用户头像
 	Authority   SysAuthority `json:"authority" gorm:"foreignKey:AuthorityId;references:AuthorityId;comment:用户角色"`
-	AuthorityId string       `json:"authorityId" gorm:"default:888;comment:用户角色ID"` // 用户角色ID
-	SideMode	string       `json:"sideMode" gorm:"default:dark;comment:用户角色ID"` // 用户侧边主题
-	ActiveColor	string       `json:"activeColor" gorm:"default:#1890ff;comment:用户角色ID"` // 活跃颜色
-	BaseColor	string       `json:"baseColor" gorm:"default:#fff;comment:用户角色ID"` // 基础颜色
+	AuthorityId string       `json:"authorityId" gorm:"default:888;comment:用户角色ID"`     // 用户角色ID
+	SideMode    string       `json:"sideMode" gorm:"default:dark;comment:用户角色ID"`       // 用户侧边主题
+	ActiveColor string       `json:"activeColor" gorm:"default:#1890ff;comment:用户角色ID"` // 活跃颜色
+	BaseColor   string       `json:"baseColor" gorm:"default:#fff;comment:用户角色ID"`      // 基础颜色
 }

+ 33 - 26
server/resource/template/server/api.go.tpl

@@ -1,28 +1,35 @@
-package v1
+package autocode
 
 import (
 	"gin-vue-admin/global"
-    "gin-vue-admin/model"
-    "gin-vue-admin/model/request"
-    "gin-vue-admin/model/response"
+    "gin-vue-admin/model/autocode"
+    "gin-vue-admin/model/common/request"
+    autocodeReq "gin-vue-admin/model/autocode/request"
+    "gin-vue-admin/model/common/response"
     "gin-vue-admin/service"
     "github.com/gin-gonic/gin"
     "go.uber.org/zap"
 )
 
+type {{.StructName}}Api struct {
+}
+
+var {{.Abbreviation}}Service = service.ServiceGroupApp.AutoCodeServiceGroup.{{.StructName}}Service
+
+
 // Create{{.StructName}} 创建{{.StructName}}
 // @Tags {{.StructName}}
 // @Summary 创建{{.StructName}}
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body model.{{.StructName}} true "创建{{.StructName}}"
+// @Param data body autocode.{{.StructName}} true "创建{{.StructName}}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /{{.Abbreviation}}/create{{.StructName}} [post]
-func Create{{.StructName}}(c *gin.Context) {
-	var {{.Abbreviation}} model.{{.StructName}}
+func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Context) {
+	var {{.Abbreviation}} autocode.{{.StructName}}
 	_ = c.ShouldBindJSON(&{{.Abbreviation}})
-	if err := service.Create{{.StructName}}({{.Abbreviation}}); err != nil {
+	if err := {{.Abbreviation}}Service.Create{{.StructName}}({{.Abbreviation}}); err != nil {
         global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
 		response.FailWithMessage("创建失败", c)
 	} else {
@@ -36,13 +43,13 @@ func Create{{.StructName}}(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body model.{{.StructName}} true "删除{{.StructName}}"
+// @Param data body autocode.{{.StructName}} true "删除{{.StructName}}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
 // @Router /{{.Abbreviation}}/delete{{.StructName}} [delete]
-func Delete{{.StructName}}(c *gin.Context) {
-	var {{.Abbreviation}} model.{{.StructName}}
+func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Context) {
+	var {{.Abbreviation}} autocode.{{.StructName}}
 	_ = c.ShouldBindJSON(&{{.Abbreviation}})
-	if err := service.Delete{{.StructName}}({{.Abbreviation}}); err != nil {
+	if err := {{.Abbreviation}}Service.Delete{{.StructName}}({{.Abbreviation}}); err != nil {
         global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
 		response.FailWithMessage("删除失败", c)
 	} else {
@@ -59,10 +66,10 @@ func Delete{{.StructName}}(c *gin.Context) {
 // @Param data body request.IdsReq true "批量删除{{.StructName}}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}"
 // @Router /{{.Abbreviation}}/delete{{.StructName}}ByIds [delete]
-func Delete{{.StructName}}ByIds(c *gin.Context) {
+func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gin.Context) {
 	var IDS request.IdsReq
     _ = c.ShouldBindJSON(&IDS)
-	if err := service.Delete{{.StructName}}ByIds(IDS); err != nil {
+	if err := {{.Abbreviation}}Service.Delete{{.StructName}}ByIds(IDS); err != nil {
         global.GVA_LOG.Error("批量删除失败!", zap.Any("err", err))
 		response.FailWithMessage("批量删除失败", c)
 	} else {
@@ -76,13 +83,13 @@ func Delete{{.StructName}}ByIds(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body model.{{.StructName}} true "更新{{.StructName}}"
+// @Param data body autocode.{{.StructName}} true "更新{{.StructName}}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
 // @Router /{{.Abbreviation}}/update{{.StructName}} [put]
-func Update{{.StructName}}(c *gin.Context) {
-	var {{.Abbreviation}} model.{{.StructName}}
+func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Context) {
+	var {{.Abbreviation}} autocode.{{.StructName}}
 	_ = c.ShouldBindJSON(&{{.Abbreviation}})
-	if err := service.Update{{.StructName}}({{.Abbreviation}}); err != nil {
+	if err := {{.Abbreviation}}Service.Update{{.StructName}}({{.Abbreviation}}); err != nil {
         global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
 		response.FailWithMessage("更新失败", c)
 	} else {
@@ -96,13 +103,13 @@ func Update{{.StructName}}(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body model.{{.StructName}} true "用id查询{{.StructName}}"
+// @Param data body autocode.{{.StructName}} true "用id查询{{.StructName}}"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
 // @Router /{{.Abbreviation}}/find{{.StructName}} [get]
-func Find{{.StructName}}(c *gin.Context) {
-	var {{.Abbreviation}} model.{{.StructName}}
+func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Context) {
+	var {{.Abbreviation}} autocode.{{.StructName}}
 	_ = c.ShouldBindQuery(&{{.Abbreviation}})
-	if err, re{{.Abbreviation}} := service.Get{{.StructName}}({{.Abbreviation}}.ID); err != nil {
+	if err, re{{.Abbreviation}} := {{.Abbreviation}}Service.Get{{.StructName}}({{.Abbreviation}}.ID); err != nil {
         global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
 		response.FailWithMessage("查询失败", c)
 	} else {
@@ -116,13 +123,13 @@ func Find{{.StructName}}(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.{{.StructName}}Search true "分页获取{{.StructName}}列表"
+// @Param data body autocodeReq.{{.StructName}}Search true "分页获取{{.StructName}}列表"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
-func Get{{.StructName}}List(c *gin.Context) {
-	var pageInfo request.{{.StructName}}Search
+func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Context) {
+	var pageInfo autocodeReq.{{.StructName}}Search
 	_ = c.ShouldBindQuery(&pageInfo)
-	if err, list, total := service.Get{{.StructName}}InfoList(pageInfo); err != nil {
+	if err, list, total := {{.Abbreviation}}Service.Get{{.StructName}}InfoList(pageInfo); err != nil {
 	    global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
         response.FailWithMessage("获取失败", c)
     } else {

+ 2 - 2
server/resource/template/server/model.go.tpl

@@ -1,5 +1,5 @@
 // 自动生成模板{{.StructName}}
-package model
+package autocode
 
 import (
 	"gin-vue-admin/global"
@@ -9,7 +9,7 @@ import (
 // 如果含有time.Time 请自行import time包
 type {{.StructName}} struct {
       global.GVA_MODEL {{- range .Fields}}
-            {{- if eq .FieldType "bool" }}
+            {{- if ne .FieldType "string" }}
       {{.FieldName}}  *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- end }}"`
             {{- else }}
       {{.FieldName}}  {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:{{.Comment}}{{- if .DataType -}};type:{{.DataType}}{{- if eq .FieldType "string" -}}{{- if .DataTypeLong -}}({{.DataTypeLong}}){{- end -}}{{- end -}};{{- if ne .FieldType "string" -}}{{- if .DataTypeLong -}}size:{{.DataTypeLong}};{{- end -}}{{- end -}}{{- end -}}"`

+ 6 - 3
server/resource/template/server/request.go.tpl

@@ -1,8 +1,11 @@
 package request
 
-import "gin-vue-admin/model"
+import (
+	"gin-vue-admin/model/autocode"
+	"gin-vue-admin/model/common/request"
+)
 
 type {{.StructName}}Search struct{
-    model.{{.StructName}}
-    PageInfo
+    autocode.{{.StructName}}
+    request.PageInfo
 }

+ 13 - 9
server/resource/template/server/router.go.tpl

@@ -1,4 +1,4 @@
-package router
+package autocode
 
 import (
 	"gin-vue-admin/api/v1"
@@ -6,15 +6,19 @@ import (
 	"github.com/gin-gonic/gin"
 )
 
+type {{.StructName}}Router struct {
+}
+
 // Init{{.StructName}}Router 初始化 {{.StructName}} 路由信息
-func Init{{.StructName}}Router(Router *gin.RouterGroup) {
-	{{.StructName}}Router := Router.Group("{{.Abbreviation}}").Use(middleware.OperationRecord())
+func (s *{{.StructName}}Router) Init{{.StructName}}Router(Router *gin.RouterGroup) {
+	{{.Abbreviation}}Router := Router.Group("{{.Abbreviation}}").Use(middleware.OperationRecord())
+	var {{.Abbreviation}}Api = v1.ApiGroupApp.AutoCodeApiGroup.{{.StructName}}Api
 	{
-		{{.StructName}}Router.POST("create{{.StructName}}", v1.Create{{.StructName}})   // 新建{{.StructName}}
-		{{.StructName}}Router.DELETE("delete{{.StructName}}", v1.Delete{{.StructName}}) // 删除{{.StructName}}
-		{{.StructName}}Router.DELETE("delete{{.StructName}}ByIds", v1.Delete{{.StructName}}ByIds) // 批量删除{{.StructName}}
-		{{.StructName}}Router.PUT("update{{.StructName}}", v1.Update{{.StructName}})    // 更新{{.StructName}}
-		{{.StructName}}Router.GET("find{{.StructName}}", v1.Find{{.StructName}})        // 根据ID获取{{.StructName}}
-		{{.StructName}}Router.GET("get{{.StructName}}List", v1.Get{{.StructName}}List)  // 获取{{.StructName}}列表
+		{{.Abbreviation}}Router.POST("create{{.StructName}}", {{.Abbreviation}}Api.Create{{.StructName}})   // 新建{{.StructName}}
+		{{.Abbreviation}}Router.DELETE("delete{{.StructName}}", {{.Abbreviation}}Api.Delete{{.StructName}}) // 删除{{.StructName}}
+		{{.Abbreviation}}Router.DELETE("delete{{.StructName}}ByIds", {{.Abbreviation}}Api.Delete{{.StructName}}ByIds) // 批量删除{{.StructName}}
+		{{.Abbreviation}}Router.PUT("update{{.StructName}}", {{.Abbreviation}}Api.Update{{.StructName}})    // 更新{{.StructName}}
+		{{.Abbreviation}}Router.GET("find{{.StructName}}", {{.Abbreviation}}Api.Find{{.StructName}})        // 根据ID获取{{.StructName}}
+		{{.Abbreviation}}Router.GET("get{{.StructName}}List", {{.Abbreviation}}Api.Get{{.StructName}}List)  // 获取{{.StructName}}列表
 	}
 }

+ 19 - 15
server/resource/template/server/service.go.tpl

@@ -1,54 +1,58 @@
-package service
+package autocode
 
 import (
 	"gin-vue-admin/global"
-	"gin-vue-admin/model"
-	"gin-vue-admin/model/request"
+	"gin-vue-admin/model/autocode"
+	"gin-vue-admin/model/common/request"
+    autoCodeReq "gin-vue-admin/model/autocode/request"
 )
 
+type {{.StructName}}Service struct {
+}
+
 // Create{{.StructName}} 创建{{.StructName}}记录
 // Author [piexlmax](https://github.com/piexlmax)
-func Create{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
+func ({{.Abbreviation}}Service *{{.StructName}}Service) Create{{.StructName}}({{.Abbreviation}} autocode.{{.StructName}}) (err error) {
 	err = global.GVA_DB.Create(&{{.Abbreviation}}).Error
 	return err
 }
 
 // Delete{{.StructName}} 删除{{.StructName}}记录
 // Author [piexlmax](https://github.com/piexlmax)
-func Delete{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
+func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}({{.Abbreviation}} autocode.{{.StructName}}) (err error) {
 	err = global.GVA_DB.Delete(&{{.Abbreviation}}).Error
 	return err
 }
 
 // Delete{{.StructName}}ByIds 批量删除{{.StructName}}记录
 // Author [piexlmax](https://github.com/piexlmax)
-func Delete{{.StructName}}ByIds(ids request.IdsReq) (err error) {
-	err = global.GVA_DB.Delete(&[]model.{{.StructName}}{},"id in ?",ids.Ids).Error
+func ({{.Abbreviation}}Service *{{.StructName}}Service)Delete{{.StructName}}ByIds(ids request.IdsReq) (err error) {
+	err = global.GVA_DB.Delete(&[]autocode.{{.StructName}}{},"id in ?",ids.Ids).Error
 	return err
 }
 
 // Update{{.StructName}} 更新{{.StructName}}记录
 // Author [piexlmax](https://github.com/piexlmax)
-func Update{{.StructName}}({{.Abbreviation}} model.{{.StructName}}) (err error) {
+func ({{.Abbreviation}}Service *{{.StructName}}Service)Update{{.StructName}}({{.Abbreviation}} autocode.{{.StructName}}) (err error) {
 	err = global.GVA_DB.Save(&{{.Abbreviation}}).Error
 	return err
 }
 
 // Get{{.StructName}} 根据id获取{{.StructName}}记录
 // Author [piexlmax](https://github.com/piexlmax)
-func Get{{.StructName}}(id uint) (err error, {{.Abbreviation}} model.{{.StructName}}) {
+func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}(id uint) (err error, {{.Abbreviation}} autocode.{{.StructName}}) {
 	err = global.GVA_DB.Where("id = ?", id).First(&{{.Abbreviation}}).Error
 	return
 }
 
 // Get{{.StructName}}InfoList 分页获取{{.StructName}}记录
 // Author [piexlmax](https://github.com/piexlmax)
-func 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
 	offset := info.PageSize * (info.Page - 1)
     // 创建db
-	db := global.GVA_DB.Model(&model.{{.StructName}}{})
-    var {{.Abbreviation}}s []model.{{.StructName}}
+	db := global.GVA_DB.Model(&autocode.{{.StructName}}{})
+    var {{.Abbreviation}}s []autocode.{{.StructName}}
     // 如果有条件搜索 下方会自动创建搜索语句
         {{- range .Fields}}
             {{- if .FieldSearchType}}
@@ -61,15 +65,15 @@ func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error,
         db = db.Where("`{{.ColumnName}}` {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
     }
                 {{- else if eq .FieldType "int" }}
-    if info.{{.FieldName}} != 0 {
+    if info.{{.FieldName}} != nil {
         db = db.Where("`{{.ColumnName}}` {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
     }
                 {{- else if eq .FieldType "float64" }}
-    if info.{{.FieldName}} != 0 {
+    if info.{{.FieldName}} != nil {
         db = db.Where("`{{.ColumnName}}` {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
     }
                 {{- else if eq .FieldType "time.Time" }}
-    if !info.{{.FieldName}}.IsZero() {
+    if !info.{{.FieldName}} != nil {
          db = db.Where("`{{.ColumnName}}` {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
     }
                 {{- end }}

+ 1 - 1
server/resource/template/web/table.vue.tpl

@@ -4,7 +4,7 @@
       <el-form :inline="true" :model="searchInfo" class="demo-form-inline">
            {{- range .Fields}}  {{- if .FieldSearchType}} {{- if eq .FieldType "bool" }}
             <el-form-item label="{{.FieldDesc}}" prop="{{.FieldJson}}">
-            <el-select v-model="searchInfo.{{.FieldJson}}" clear placeholder="请选择">
+            <el-select v-model="searchInfo.{{.FieldJson}}" clearable placeholder="请选择">
                 <el-option
                     key="true"
                     label="是"

+ 22 - 0
server/router/autocode/autocodeExample.go

@@ -0,0 +1,22 @@
+package autocode
+
+import (
+	"gin-vue-admin/api/v1"
+	"gin-vue-admin/middleware"
+	"github.com/gin-gonic/gin"
+)
+
+type AutoCodeExampleRouter struct {
+}
+
+func (s *AutoCodeExampleRouter) InitSysAutoCodeExampleRouter(Router *gin.RouterGroup) {
+	autoCodeExampleRouter := Router.Group("autoCodeExample").Use(middleware.OperationRecord())
+	var autoCodeExampleApi = v1.ApiGroupApp.AutoCodeApiGroup.AutoCodeExampleApi
+	{
+		autoCodeExampleRouter.POST("createSysAutoCodeExample", autoCodeExampleApi.CreateAutoCodeExample)   // 新建AutoCodeExample
+		autoCodeExampleRouter.DELETE("deleteSysAutoCodeExample", autoCodeExampleApi.DeleteAutoCodeExample) // 删除AutoCodeExample
+		autoCodeExampleRouter.PUT("updateSysAutoCodeExample", autoCodeExampleApi.UpdateAutoCodeExample)    // 更新AutoCodeExample
+		autoCodeExampleRouter.GET("findSysAutoCodeExample", autoCodeExampleApi.FindAutoCodeExample)        // 根据ID获取AutoCodeExample
+		autoCodeExampleRouter.GET("getSysAutoCodeExampleList", autoCodeExampleApi.GetAutoCodeExampleList)  // 获取AutoCodeExample列表
+	}
+}

+ 7 - 0
server/router/autocode/enter.go

@@ -0,0 +1,7 @@
+package autocode
+
+type RouterGroup struct {
+	// Code generated by gin-vue-admin Begin; DO NOT EDIT.
+	AutoCodeExampleRouter
+	// Code generated by gin-vue-admin End; DO NOT EDIT.
+}

+ 15 - 0
server/router/enter.go

@@ -0,0 +1,15 @@
+package router
+
+import (
+	"gin-vue-admin/router/autocode"
+	"gin-vue-admin/router/example"
+	"gin-vue-admin/router/system"
+)
+
+type RouterGroup struct {
+	System   system.RouterGroup
+	Example  example.RouterGroup
+	Autocode autocode.RouterGroup
+}
+
+var RouterGroupApp = new(RouterGroup)

+ 0 - 18
server/router/exa_customer.go

@@ -1,18 +0,0 @@
-package router
-
-import (
-	"gin-vue-admin/api/v1"
-	"gin-vue-admin/middleware"
-	"github.com/gin-gonic/gin"
-)
-
-func InitCustomerRouter(Router *gin.RouterGroup) {
-	CustomerRouter := Router.Group("customer").Use(middleware.OperationRecord())
-	{
-		CustomerRouter.POST("customer", v1.CreateExaCustomer)     // 创建客户
-		CustomerRouter.PUT("customer", v1.UpdateExaCustomer)      // 更新客户
-		CustomerRouter.DELETE("customer", v1.DeleteExaCustomer)   // 删除客户
-		CustomerRouter.GET("customer", v1.GetExaCustomer)         // 获取单一客户信息
-		CustomerRouter.GET("customerList", v1.GetExaCustomerList) // 获取客户列表
-	}
-}

+ 0 - 16
server/router/exa_excel.go

@@ -1,16 +0,0 @@
-package router
-
-import (
-	"gin-vue-admin/api/v1"
-	"github.com/gin-gonic/gin"
-)
-
-func InitExcelRouter(Router *gin.RouterGroup) {
-	ExcelRouter := Router.Group("excel")
-	{
-		ExcelRouter.POST("/importExcel", v1.ImportExcel)          // 导入Excel
-		ExcelRouter.GET("/loadExcel", v1.LoadExcel)               // 加载Excel数据
-		ExcelRouter.POST("/exportExcel", v1.ExportExcel)          // 导出Excel
-		ExcelRouter.GET("/downloadTemplate", v1.DownloadTemplate) // 下载模板文件
-	}
-}

+ 0 - 19
server/router/exa_file_upload_and_download.go

@@ -1,19 +0,0 @@
-package router
-
-import (
-	"gin-vue-admin/api/v1"
-	"github.com/gin-gonic/gin"
-)
-
-func InitFileUploadAndDownloadRouter(Router *gin.RouterGroup) {
-	FileUploadAndDownloadRouter := Router.Group("fileUploadAndDownload")
-	{
-		FileUploadAndDownloadRouter.POST("/upload", v1.UploadFile)                                 // 上传文件
-		FileUploadAndDownloadRouter.POST("/getFileList", v1.GetFileList)                           // 获取上传文件列表
-		FileUploadAndDownloadRouter.POST("/deleteFile", v1.DeleteFile)                             // 删除指定文件
-		FileUploadAndDownloadRouter.POST("/breakpointContinue", v1.BreakpointContinue)             // 断点续传
-		FileUploadAndDownloadRouter.GET("/findFile", v1.FindFile)                                  // 查询当前文件成功的切片
-		FileUploadAndDownloadRouter.POST("/breakpointContinueFinish", v1.BreakpointContinueFinish) // 查询当前文件成功的切片
-		FileUploadAndDownloadRouter.POST("/removeChunk", v1.RemoveChunk)                           // 查询当前文件成功的切片
-	}
-}

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff