Skip to content

Commit 1c07b5e

Browse files
committed
Merge branch 'gva_gormv2_dev' into develop
2 parents e37fdb0 + 496bbeb commit 1c07b5e

File tree

169 files changed

+2057
-1351
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+2057
-1351
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package autocode
2+
3+
import (
4+
"gin-vue-admin/global"
5+
"gin-vue-admin/model/autocode"
6+
autocodeReq "gin-vue-admin/model/autocode/request"
7+
"gin-vue-admin/model/common/response"
8+
"gin-vue-admin/service"
9+
"gin-vue-admin/utils"
10+
"github.com/gin-gonic/gin"
11+
"go.uber.org/zap"
12+
)
13+
14+
type AutoCodeExampleApi struct {
15+
}
16+
17+
var autoCodeExampleService = service.ServiceGroupApp.AutoCodeServiceGroup.AutoCodeExampleService
18+
19+
// @Tags AutoCodeExample
20+
// @Summary 创建AutoCodeExample
21+
// @Security ApiKeyAuth
22+
// @accept application/json
23+
// @Produce application/json
24+
// @Param data body autocode.AutoCodeExample true "AutoCodeExample模型"
25+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
26+
// @Router /autoCodeExample/createAutoCodeExample [post]
27+
func (autoCodeExampleApi *AutoCodeExampleApi) CreateAutoCodeExample(c *gin.Context) {
28+
var autoCodeExample autocode.AutoCodeExample
29+
_ = c.ShouldBindJSON(&autoCodeExample)
30+
if err := autoCodeExampleService.CreateAutoCodeExample(autoCodeExample); err != nil {
31+
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
32+
response.FailWithMessage("创建失败", c)
33+
} else {
34+
response.OkWithMessage("创建成功", c)
35+
}
36+
}
37+
38+
// @Tags AutoCodeExample
39+
// @Summary 删除AutoCodeExample
40+
// @Security ApiKeyAuth
41+
// @accept application/json
42+
// @Produce application/json
43+
// @Param data body autocode.AutoCodeExample true "AutoCodeExample模型"
44+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
45+
// @Router /autoCodeExample/deleteAutoCodeExample [delete]
46+
func (autoCodeExampleApi *AutoCodeExampleApi) DeleteAutoCodeExample(c *gin.Context) {
47+
var autoCodeExample autocode.AutoCodeExample
48+
_ = c.ShouldBindJSON(&autoCodeExample)
49+
if err := autoCodeExampleService.DeleteAutoCodeExample(autoCodeExample); err != nil {
50+
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
51+
response.FailWithMessage("删除失败", c)
52+
} else {
53+
response.OkWithMessage("删除成功", c)
54+
}
55+
}
56+
57+
// @Tags AutoCodeExample
58+
// @Summary 更新AutoCodeExample
59+
// @Security ApiKeyAuth
60+
// @accept application/json
61+
// @Produce application/json
62+
// @Param data body autocode.AutoCodeExample true "更新AutoCodeExample"
63+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
64+
// @Router /autoCodeExample/updateAutoCodeExample [put]
65+
func (autoCodeExampleApi *AutoCodeExampleApi) UpdateAutoCodeExample(c *gin.Context) {
66+
var autoCodeExample autocode.AutoCodeExample
67+
_ = c.ShouldBindJSON(&autoCodeExample)
68+
if err := autoCodeExampleService.UpdateAutoCodeExample(&autoCodeExample); err != nil {
69+
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
70+
response.FailWithMessage("更新失败", c)
71+
} else {
72+
response.OkWithMessage("更新成功", c)
73+
}
74+
}
75+
76+
// @Tags AutoCodeExample
77+
// @Summary 用id查询AutoCodeExample
78+
// @Security ApiKeyAuth
79+
// @accept application/json
80+
// @Produce application/json
81+
// @Param data body autocode.AutoCodeExample true "用id查询AutoCodeExample"
82+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
83+
// @Router /autoCodeExample/findAutoCodeExample [get]
84+
func (autoCodeExampleApi *AutoCodeExampleApi) FindAutoCodeExample(c *gin.Context) {
85+
var autoCodeExample autocode.AutoCodeExample
86+
_ = c.ShouldBindQuery(&autoCodeExample)
87+
if err := utils.Verify(autoCodeExample, utils.IdVerify); err != nil {
88+
response.FailWithMessage(err.Error(), c)
89+
return
90+
}
91+
if err, reAutoCodeExample := autoCodeExampleService.GetAutoCodeExample(autoCodeExample.ID); err != nil {
92+
global.GVA_LOG.Error("查询失败!", zap.Any("err", err))
93+
response.FailWithMessage("查询失败", c)
94+
} else {
95+
response.OkWithDetailed(gin.H{"reAutoCodeExample": reAutoCodeExample}, "查询成功", c)
96+
}
97+
}
98+
99+
// @Tags AutoCodeExample
100+
// @Summary 分页获取AutoCodeExample列表
101+
// @Security ApiKeyAuth
102+
// @accept application/json
103+
// @Produce application/json
104+
// @Param data body autocodeReq.AutoCodeExampleSearch true "页码, 每页大小, 搜索条件"
105+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
106+
// @Router /autoCodeExample/getAutoCodeExampleList [get]
107+
func (autoCodeExampleApi *AutoCodeExampleApi) GetAutoCodeExampleList(c *gin.Context) {
108+
var pageInfo autocodeReq.AutoCodeExampleSearch
109+
_ = c.ShouldBindQuery(&pageInfo)
110+
if err, list, total := autoCodeExampleService.GetAutoCodeExampleInfoList(pageInfo); err != nil {
111+
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
112+
response.FailWithMessage("获取失败", c)
113+
} else {
114+
response.OkWithDetailed(response.PageResult{
115+
List: list,
116+
Total: total,
117+
Page: pageInfo.Page,
118+
PageSize: pageInfo.PageSize,
119+
}, "获取成功", c)
120+
}
121+
}

server/api/v1/autocode/enter.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package autocode
2+
3+
type ApiGroup struct {
4+
// Code generated by gin-vue-admin Begin; DO NOT EDIT.
5+
AutoCodeExampleApi
6+
// Code generated by gin-vue-admin End; DO NOT EDIT.
7+
}

server/api/v1/enter.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package v1
2+
3+
import (
4+
"gin-vue-admin/api/v1/autocode"
5+
"gin-vue-admin/api/v1/example"
6+
"gin-vue-admin/api/v1/system"
7+
)
8+
9+
type ApiGroup struct {
10+
ExampleApiGroup example.ApiGroup
11+
SystemApiGroup system.ApiGroup
12+
AutoCodeApiGroup autocode.ApiGroup
13+
}
14+
15+
var ApiGroupApp = new(ApiGroup)

server/api/v1/example/enter.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package example
2+
3+
import "gin-vue-admin/service"
4+
5+
type ApiGroup struct {
6+
CustomerApi
7+
ExcelApi
8+
FileUploadAndDownloadApi
9+
SimpleUploaderApi
10+
}
11+
12+
var fileUploadAndDownloadService = service.ServiceGroupApp.ExampleServiceGroup.FileUploadAndDownloadService
13+
var customerService = service.ServiceGroupApp.ExampleServiceGroup.CustomerService
14+
var excelService = service.ServiceGroupApp.ExampleServiceGroup.ExcelService
15+
var simpleUploaderService = service.ServiceGroupApp.ExampleServiceGroup.SimpleUploaderService

server/api/v1/exa_breakpoint_continue.go renamed to server/api/v1/example/exa_breakpoint_continue.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package v1
1+
package example
22

33
import (
44
"gin-vue-admin/global"
5-
"gin-vue-admin/model/response"
6-
"gin-vue-admin/service"
5+
"gin-vue-admin/model/common/response"
6+
exampleRes "gin-vue-admin/model/example/response"
77
"gin-vue-admin/utils"
88
"github.com/gin-gonic/gin"
99
"go.uber.org/zap"
@@ -19,7 +19,7 @@ import (
1919
// @Param file formData file true "an example for breakpoint resume, 断点续传示例"
2020
// @Success 200 {string} string "{"success":true,"data":{},"msg":"切片创建成功"}"
2121
// @Router /fileUploadAndDownload/breakpointContinue [post]
22-
func BreakpointContinue(c *gin.Context) {
22+
func (u *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) {
2323
fileMd5 := c.Request.FormValue("fileMd5")
2424
fileName := c.Request.FormValue("fileName")
2525
chunkMd5 := c.Request.FormValue("chunkMd5")
@@ -44,7 +44,7 @@ func BreakpointContinue(c *gin.Context) {
4444
response.FailWithMessage("检查md5失败", c)
4545
return
4646
}
47-
err, file := service.FindOrCreateFile(fileMd5, fileName, chunkTotal)
47+
err, file := fileUploadAndDownloadService.FindOrCreateFile(fileMd5, fileName, chunkTotal)
4848
if err != nil {
4949
global.GVA_LOG.Error("查找或创建记录失败!", zap.Any("err", err))
5050
response.FailWithMessage("查找或创建记录失败", c)
@@ -57,7 +57,7 @@ func BreakpointContinue(c *gin.Context) {
5757
return
5858
}
5959

60-
if err = service.CreateFileChunk(file.ID, pathc, chunkNumber); err != nil {
60+
if err = fileUploadAndDownloadService.CreateFileChunk(file.ID, pathc, chunkNumber); err != nil {
6161
global.GVA_LOG.Error("创建文件记录失败!", zap.Any("err", err))
6262
response.FailWithMessage("创建文件记录失败", c)
6363
return
@@ -73,16 +73,16 @@ func BreakpointContinue(c *gin.Context) {
7373
// @Param file formData file true "Find the file, 查找文件"
7474
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查找成功"}"
7575
// @Router /fileUploadAndDownload/findFile [post]
76-
func FindFile(c *gin.Context) {
76+
func (u *FileUploadAndDownloadApi) FindFile(c *gin.Context) {
7777
fileMd5 := c.Query("fileMd5")
7878
fileName := c.Query("fileName")
7979
chunkTotal, _ := strconv.Atoi(c.Query("chunkTotal"))
80-
err, file := service.FindOrCreateFile(fileMd5, fileName, chunkTotal)
80+
err, file := fileUploadAndDownloadService.FindOrCreateFile(fileMd5, fileName, chunkTotal)
8181
if err != nil {
8282
global.GVA_LOG.Error("查找失败!", zap.Any("err", err))
8383
response.FailWithMessage("查找失败", c)
8484
} else {
85-
response.OkWithDetailed(response.FileResponse{File: file}, "查找成功", c)
85+
response.OkWithDetailed(exampleRes.FileResponse{File: file}, "查找成功", c)
8686
}
8787
}
8888

@@ -94,15 +94,15 @@ func FindFile(c *gin.Context) {
9494
// @Param file formData file true "上传文件完成"
9595
// @Success 200 {string} string "{"success":true,"data":{},"msg":"file uploaded, 文件创建成功"}"
9696
// @Router /fileUploadAndDownload/findFile [post]
97-
func BreakpointContinueFinish(c *gin.Context) {
97+
func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) {
9898
fileMd5 := c.Query("fileMd5")
9999
fileName := c.Query("fileName")
100100
err, filePath := utils.MakeFile(fileName, fileMd5)
101101
if err != nil {
102102
global.GVA_LOG.Error("文件创建失败!", zap.Any("err", err))
103-
response.FailWithDetailed(response.FilePathResponse{FilePath: filePath}, "文件创建失败", c)
103+
response.FailWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "文件创建失败", c)
104104
} else {
105-
response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "文件创建成功", c)
105+
response.OkWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "文件创建成功", c)
106106
}
107107
}
108108

@@ -114,16 +114,16 @@ func BreakpointContinueFinish(c *gin.Context) {
114114
// @Param file formData file true "删除缓存切片"
115115
// @Success 200 {string} string "{"success":true,"data":{},"msg":"缓存切片删除成功"}"
116116
// @Router /fileUploadAndDownload/removeChunk [post]
117-
func RemoveChunk(c *gin.Context) {
117+
func (u *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) {
118118
fileMd5 := c.Query("fileMd5")
119119
fileName := c.Query("fileName")
120120
filePath := c.Query("filePath")
121121
err := utils.RemoveChunk(fileMd5)
122-
err = service.DeleteFileChunk(fileMd5, fileName, filePath)
122+
err = fileUploadAndDownloadService.DeleteFileChunk(fileMd5, fileName, filePath)
123123
if err != nil {
124124
global.GVA_LOG.Error("缓存切片删除失败!", zap.Any("err", err))
125-
response.FailWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除失败", c)
125+
response.FailWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "缓存切片删除失败", c)
126126
} else {
127-
response.OkWithDetailed(response.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
127+
response.OkWithDetailed(exampleRes.FilePathResponse{FilePath: filePath}, "缓存切片删除成功", c)
128128
}
129129
}

server/api/v1/exa_customer.go renamed to server/api/v1/example/exa_customer.go

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
package v1
1+
package example
22

33
import (
44
"gin-vue-admin/global"
5-
"gin-vue-admin/model"
6-
"gin-vue-admin/model/request"
7-
"gin-vue-admin/model/response"
8-
"gin-vue-admin/service"
5+
"gin-vue-admin/model/common/request"
6+
"gin-vue-admin/model/common/response"
7+
"gin-vue-admin/model/example"
8+
exampleRes "gin-vue-admin/model/example/response"
99
"gin-vue-admin/utils"
1010
"github.com/gin-gonic/gin"
1111
"go.uber.org/zap"
1212
)
1313

14+
type CustomerApi struct {
15+
}
16+
1417
// @Tags ExaCustomer
1518
// @Summary 创建客户
1619
// @Security ApiKeyAuth
@@ -19,16 +22,16 @@ import (
1922
// @Param data body model.ExaCustomer true "客户用户名, 客户手机号码"
2023
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
2124
// @Router /customer/customer [post]
22-
func CreateExaCustomer(c *gin.Context) {
23-
var customer model.ExaCustomer
25+
func (e *CustomerApi) CreateExaCustomer(c *gin.Context) {
26+
var customer example.ExaCustomer
2427
_ = c.ShouldBindJSON(&customer)
2528
if err := utils.Verify(customer, utils.CustomerVerify); err != nil {
2629
response.FailWithMessage(err.Error(), c)
2730
return
2831
}
29-
customer.SysUserID = getUserID(c)
30-
customer.SysUserAuthorityID = getUserAuthorityId(c)
31-
if err := service.CreateExaCustomer(customer); err != nil {
32+
customer.SysUserID = utils.GetUserID(c)
33+
customer.SysUserAuthorityID = utils.GetUserAuthorityId(c)
34+
if err := customerService.CreateExaCustomer(customer); err != nil {
3235
global.GVA_LOG.Error("创建失败!", zap.Any("err", err))
3336
response.FailWithMessage("创建失败", c)
3437
} else {
@@ -44,14 +47,14 @@ func CreateExaCustomer(c *gin.Context) {
4447
// @Param data body model.ExaCustomer true "客户ID"
4548
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
4649
// @Router /customer/customer [delete]
47-
func DeleteExaCustomer(c *gin.Context) {
48-
var customer model.ExaCustomer
50+
func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) {
51+
var customer example.ExaCustomer
4952
_ = c.ShouldBindJSON(&customer)
5053
if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
5154
response.FailWithMessage(err.Error(), c)
5255
return
5356
}
54-
if err := service.DeleteExaCustomer(customer); err != nil {
57+
if err := customerService.DeleteExaCustomer(customer); err != nil {
5558
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
5659
response.FailWithMessage("删除失败", c)
5760
} else {
@@ -67,8 +70,8 @@ func DeleteExaCustomer(c *gin.Context) {
6770
// @Param data body model.ExaCustomer true "客户ID, 客户信息"
6871
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
6972
// @Router /customer/customer [put]
70-
func UpdateExaCustomer(c *gin.Context) {
71-
var customer model.ExaCustomer
73+
func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) {
74+
var customer example.ExaCustomer
7275
_ = c.ShouldBindJSON(&customer)
7376
if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
7477
response.FailWithMessage(err.Error(), c)
@@ -78,7 +81,7 @@ func UpdateExaCustomer(c *gin.Context) {
7881
response.FailWithMessage(err.Error(), c)
7982
return
8083
}
81-
if err := service.UpdateExaCustomer(&customer); err != nil {
84+
if err := customerService.UpdateExaCustomer(&customer); err != nil {
8285
global.GVA_LOG.Error("更新失败!", zap.Any("err", err))
8386
response.FailWithMessage("更新失败", c)
8487
} else {
@@ -94,19 +97,19 @@ func UpdateExaCustomer(c *gin.Context) {
9497
// @Param data body model.ExaCustomer true "客户ID"
9598
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
9699
// @Router /customer/customer [get]
97-
func GetExaCustomer(c *gin.Context) {
98-
var customer model.ExaCustomer
100+
func (e *CustomerApi) GetExaCustomer(c *gin.Context) {
101+
var customer example.ExaCustomer
99102
_ = c.ShouldBindQuery(&customer)
100103
if err := utils.Verify(customer.GVA_MODEL, utils.IdVerify); err != nil {
101104
response.FailWithMessage(err.Error(), c)
102105
return
103106
}
104-
err, data := service.GetExaCustomer(customer.ID)
107+
err, data := customerService.GetExaCustomer(customer.ID)
105108
if err != nil {
106109
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
107110
response.FailWithMessage("获取失败", c)
108111
} else {
109-
response.OkWithDetailed(response.ExaCustomerResponse{Customer: data}, "获取成功", c)
112+
response.OkWithDetailed(exampleRes.ExaCustomerResponse{Customer: data}, "获取成功", c)
110113
}
111114
}
112115

@@ -118,14 +121,14 @@ func GetExaCustomer(c *gin.Context) {
118121
// @Param data body request.PageInfo true "页码, 每页大小"
119122
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
120123
// @Router /customer/customerList [get]
121-
func GetExaCustomerList(c *gin.Context) {
124+
func (e *CustomerApi) GetExaCustomerList(c *gin.Context) {
122125
var pageInfo request.PageInfo
123126
_ = c.ShouldBindQuery(&pageInfo)
124127
if err := utils.Verify(pageInfo, utils.PageInfoVerify); err != nil {
125128
response.FailWithMessage(err.Error(), c)
126129
return
127130
}
128-
err, customerList, total := service.GetCustomerInfoList(getUserAuthorityId(c), pageInfo)
131+
err, customerList, total := customerService.GetCustomerInfoList(utils.GetUserAuthorityId(c), pageInfo)
129132
if err != nil {
130133
global.GVA_LOG.Error("获取失败!", zap.Any("err", err))
131134
response.FailWithMessage("获取失败"+err.Error(), c)

0 commit comments

Comments
 (0)