Skip to content

Commit 1d44c23

Browse files
author
pixel
committed
Merge branch 'gin-vue-admin_v2_dev' of https://github.com/piexlmax/QMPlus into gin-vue-admin_v2_dev
2 parents 32bcd3e + a69a234 commit 1d44c23

Some content is hidden

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

77 files changed

+5461
-887
lines changed

README-zh_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ swag init
145145
## 4. 项目架构
146146
### 4.1 系统架构图
147147

148-
![系统架构图](./docs/gin-vue-admin.png)
148+
![系统架构图](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)
149149

150150
### 4.2 前端详细设计图 (提供者:<a href="https://github.com/baobeisuper">baobeisuper</a>)
151151

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ After executing the above command,`docs` will show in `server/`,then open yo
146146

147147
### 4.1 Architecture Diagram
148148

149-
![Architecture diagram](./docs/gin-vue-admin.png)
149+
![Architecture diagram](http://qmplusimg.henrongyi.top/gva/gin-vue-admin.png)
150150

151151
### 4.2 Front-end Detailed Design Diagram (Contributor: <a href="https://github.com/baobeisuper">baobeisuper</a>)
152152

server/api/v1/sys_auto_code.go

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package v1
22

33
import (
44
"fmt"
5+
"gin-vue-admin/global"
56
"gin-vue-admin/global/response"
67
"gin-vue-admin/model"
78
"gin-vue-admin/service"
@@ -34,7 +35,7 @@ func CreateTemp(c *gin.Context) {
3435
return
3536
}
3637
if a.AutoCreateApiToSql {
37-
apiList := [5]model.SysApi{
38+
apiList := [6]model.SysApi{
3839
{
3940
Path: "/" + a.Abbreviation + "/" + "create" + a.StructName,
4041
Description: "新增" + a.Description,
@@ -47,6 +48,12 @@ func CreateTemp(c *gin.Context) {
4748
ApiGroup: a.Abbreviation,
4849
Method: "DELETE",
4950
},
51+
{
52+
Path: "/" + a.Abbreviation + "/" + "delete" + a.StructName+"ByIds",
53+
Description: "批量删除" + a.Description,
54+
ApiGroup: a.Abbreviation,
55+
Method: "DELETE",
56+
},
5057
{
5158
Path: "/" + a.Abbreviation + "/" + "update" + a.StructName,
5259
Description: "更新" + a.Description,
@@ -87,3 +94,61 @@ func CreateTemp(c *gin.Context) {
8794
os.Remove("./ginvueadmin.zip")
8895
}
8996
}
97+
98+
// @Tags SysApi
99+
// @Summary 获取当前数据库所有表
100+
// @Security ApiKeyAuth
101+
// @accept application/json
102+
// @Produce application/json
103+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
104+
// @Router /autoCode/getTables [get]
105+
106+
func GetTables(c *gin.Context) {
107+
dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
108+
err, tables := service.GetTables(dbName)
109+
if err != nil {
110+
response.FailWithMessage(fmt.Sprintf("查询table失败,%v", err), c)
111+
} else {
112+
response.OkWithData(gin.H{
113+
"tables": tables,
114+
}, c)
115+
}
116+
}
117+
118+
// @Tags SysApi
119+
// @Summary 获取当前所有数据库
120+
// @Security ApiKeyAuth
121+
// @accept application/json
122+
// @Produce application/json
123+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
124+
// @Router /autoCode/getDatabase [get]
125+
func GetDB(c *gin.Context) {
126+
err, dbs := service.GetDB()
127+
if err != nil {
128+
response.FailWithMessage(fmt.Sprintf("查询table失败,%v", err), c)
129+
} else {
130+
response.OkWithData(gin.H{
131+
"dbs": dbs,
132+
}, c)
133+
}
134+
}
135+
136+
// @Tags SysApi
137+
// @Summary 获取当前表所有字段
138+
// @Security ApiKeyAuth
139+
// @accept application/json
140+
// @Produce application/json
141+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}"
142+
// @Router /autoCode/getDatabase [get]
143+
func GetColume(c *gin.Context) {
144+
dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname)
145+
tableName := c.Query("tableName")
146+
err, columes := service.GetColume(tableName, dbName)
147+
if err != nil {
148+
response.FailWithMessage(fmt.Sprintf("查询table失败,%v", err), c)
149+
} else {
150+
response.OkWithData(gin.H{
151+
"columes": columes,
152+
}, c)
153+
}
154+
}

server/api/v1/sys_captcha.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package v1
22

33
import (
4+
"fmt"
45
"gin-vue-admin/global"
56
"gin-vue-admin/global/response"
67
resp "gin-vue-admin/model/response"
7-
"gin-vue-admin/utils"
8-
"github.com/dchest/captcha"
98
"github.com/gin-gonic/gin"
9+
"github.com/mojocn/base64Captcha"
1010
)
1111

12+
var store = base64Captcha.DefaultMemStore
13+
1214
// @Tags base
1315
// @Summary 生成验证码
1416
// @Security ApiKeyAuth
@@ -17,20 +19,17 @@ import (
1719
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
1820
// @Router /base/captcha [post]
1921
func Captcha(c *gin.Context) {
20-
captchaId := captcha.NewLen(global.GVA_CONFIG.Captcha.KeyLong)
21-
response.OkDetailed(resp.SysCaptchaResponse{
22-
CaptchaId: captchaId,
23-
PicPath: "/base/captcha/" + captchaId + ".png",
24-
}, "验证码获取成功", c)
25-
}
26-
27-
// @Tags base
28-
// @Summary 生成验证码图片路径
29-
// @Security ApiKeyAuth
30-
// @accept application/json
31-
// @Produce application/json
32-
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
33-
// @Router /base/captcha/:captchaId [get]
34-
func CaptchaImg(c *gin.Context) {
35-
utils.GinCaptchaServeHTTP(c.Writer, c.Request)
22+
//字符,公式,验证码配置
23+
// 生成默认数字的driver
24+
driver := base64Captcha.NewDriverDigit(global.GVA_CONFIG.Captcha.ImgHeight, global.GVA_CONFIG.Captcha.ImgWidth, global.GVA_CONFIG.Captcha.KeyLong, 0.7, 80)
25+
cp := base64Captcha.NewCaptcha(driver, store)
26+
id, b64s, err := cp.Generate()
27+
if err != nil {
28+
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
29+
} else {
30+
response.OkDetailed(resp.SysCaptchaResponse{
31+
CaptchaId: id,
32+
PicPath: b64s,
33+
}, "验证码获取成功", c)
34+
}
3635
}

server/api/v1/sys_dictionary.go

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
package v1
2+
3+
import (
4+
"fmt"
5+
"gin-vue-admin/global/response"
6+
"gin-vue-admin/model"
7+
"gin-vue-admin/model/request"
8+
resp "gin-vue-admin/model/response"
9+
"gin-vue-admin/service"
10+
"github.com/gin-gonic/gin"
11+
)
12+
13+
// @Tags SysDictionary
14+
// @Summary 创建SysDictionary
15+
// @Security ApiKeyAuth
16+
// @accept application/json
17+
// @Produce application/json
18+
// @Param data body model.SysDictionary true "创建SysDictionary"
19+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
20+
// @Router /sysDictionary/createSysDictionary [post]
21+
func CreateSysDictionary(c *gin.Context) {
22+
var sysDictionary model.SysDictionary
23+
_ = c.ShouldBindJSON(&sysDictionary)
24+
err := service.CreateSysDictionary(sysDictionary)
25+
if err != nil {
26+
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
27+
} else {
28+
response.OkWithMessage("创建成功", c)
29+
}
30+
}
31+
32+
// @Tags SysDictionary
33+
// @Summary 删除SysDictionary
34+
// @Security ApiKeyAuth
35+
// @accept application/json
36+
// @Produce application/json
37+
// @Param data body model.SysDictionary true "删除SysDictionary"
38+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
39+
// @Router /sysDictionary/deleteSysDictionary [delete]
40+
func DeleteSysDictionary(c *gin.Context) {
41+
var sysDictionary model.SysDictionary
42+
_ = c.ShouldBindJSON(&sysDictionary)
43+
err := service.DeleteSysDictionary(sysDictionary)
44+
if err != nil {
45+
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
46+
} else {
47+
response.OkWithMessage("删除成功", c)
48+
}
49+
}
50+
51+
// @Tags SysDictionary
52+
// @Summary 更新SysDictionary
53+
// @Security ApiKeyAuth
54+
// @accept application/json
55+
// @Produce application/json
56+
// @Param data body model.SysDictionary true "更新SysDictionary"
57+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
58+
// @Router /sysDictionary/updateSysDictionary [put]
59+
func UpdateSysDictionary(c *gin.Context) {
60+
var sysDictionary model.SysDictionary
61+
_ = c.ShouldBindJSON(&sysDictionary)
62+
err := service.UpdateSysDictionary(&sysDictionary)
63+
if err != nil {
64+
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
65+
} else {
66+
response.OkWithMessage("更新成功", c)
67+
}
68+
}
69+
70+
// @Tags SysDictionary
71+
// @Summary 用id查询SysDictionary
72+
// @Security ApiKeyAuth
73+
// @accept application/json
74+
// @Produce application/json
75+
// @Param data body model.SysDictionary true "用id查询SysDictionary"
76+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
77+
// @Router /sysDictionary/findSysDictionary [get]
78+
func FindSysDictionary(c *gin.Context) {
79+
var sysDictionary model.SysDictionary
80+
_ = c.ShouldBindQuery(&sysDictionary)
81+
err, resysDictionary := service.GetSysDictionary(sysDictionary.Type, sysDictionary.ID)
82+
if err != nil {
83+
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
84+
} else {
85+
response.OkWithData(gin.H{"resysDictionary": resysDictionary}, c)
86+
}
87+
}
88+
89+
// @Tags SysDictionary
90+
// @Summary 分页获取SysDictionary列表
91+
// @Security ApiKeyAuth
92+
// @accept application/json
93+
// @Produce application/json
94+
// @Param data body request.SysDictionarySearch true "分页获取SysDictionary列表"
95+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
96+
// @Router /sysDictionary/getSysDictionaryList [get]
97+
func GetSysDictionaryList(c *gin.Context) {
98+
var pageInfo request.SysDictionarySearch
99+
_ = c.ShouldBindQuery(&pageInfo)
100+
err, list, total := service.GetSysDictionaryInfoList(pageInfo)
101+
if err != nil {
102+
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
103+
} else {
104+
response.OkWithData(resp.PageResult{
105+
List: list,
106+
Total: total,
107+
Page: pageInfo.Page,
108+
PageSize: pageInfo.PageSize,
109+
}, c)
110+
}
111+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
package v1
2+
3+
import (
4+
"fmt"
5+
"gin-vue-admin/global/response"
6+
"gin-vue-admin/model"
7+
"gin-vue-admin/model/request"
8+
resp "gin-vue-admin/model/response"
9+
"gin-vue-admin/service"
10+
"github.com/gin-gonic/gin"
11+
)
12+
13+
// @Tags SysDictionaryDetail
14+
// @Summary 创建SysDictionaryDetail
15+
// @Security ApiKeyAuth
16+
// @accept application/json
17+
// @Produce application/json
18+
// @Param data body model.SysDictionaryDetail true "创建SysDictionaryDetail"
19+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
20+
// @Router /sysDictionaryDetail/createSysDictionaryDetail [post]
21+
func CreateSysDictionaryDetail(c *gin.Context) {
22+
var sysDictionaryDetail model.SysDictionaryDetail
23+
_ = c.ShouldBindJSON(&sysDictionaryDetail)
24+
err := service.CreateSysDictionaryDetail(sysDictionaryDetail)
25+
if err != nil {
26+
response.FailWithMessage(fmt.Sprintf("创建失败,%v", err), c)
27+
} else {
28+
response.OkWithMessage("创建成功", c)
29+
}
30+
}
31+
32+
// @Tags SysDictionaryDetail
33+
// @Summary 删除SysDictionaryDetail
34+
// @Security ApiKeyAuth
35+
// @accept application/json
36+
// @Produce application/json
37+
// @Param data body model.SysDictionaryDetail true "删除SysDictionaryDetail"
38+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
39+
// @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete]
40+
func DeleteSysDictionaryDetail(c *gin.Context) {
41+
var sysDictionaryDetail model.SysDictionaryDetail
42+
_ = c.ShouldBindJSON(&sysDictionaryDetail)
43+
err := service.DeleteSysDictionaryDetail(sysDictionaryDetail)
44+
if err != nil {
45+
response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c)
46+
} else {
47+
response.OkWithMessage("删除成功", c)
48+
}
49+
}
50+
51+
// @Tags SysDictionaryDetail
52+
// @Summary 更新SysDictionaryDetail
53+
// @Security ApiKeyAuth
54+
// @accept application/json
55+
// @Produce application/json
56+
// @Param data body model.SysDictionaryDetail true "更新SysDictionaryDetail"
57+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}"
58+
// @Router /sysDictionaryDetail/updateSysDictionaryDetail [put]
59+
func UpdateSysDictionaryDetail(c *gin.Context) {
60+
var sysDictionaryDetail model.SysDictionaryDetail
61+
_ = c.ShouldBindJSON(&sysDictionaryDetail)
62+
err := service.UpdateSysDictionaryDetail(&sysDictionaryDetail)
63+
if err != nil {
64+
response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c)
65+
} else {
66+
response.OkWithMessage("更新成功", c)
67+
}
68+
}
69+
70+
// @Tags SysDictionaryDetail
71+
// @Summary 用id查询SysDictionaryDetail
72+
// @Security ApiKeyAuth
73+
// @accept application/json
74+
// @Produce application/json
75+
// @Param data body model.SysDictionaryDetail true "用id查询SysDictionaryDetail"
76+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}"
77+
// @Router /sysDictionaryDetail/findSysDictionaryDetail [get]
78+
func FindSysDictionaryDetail(c *gin.Context) {
79+
var sysDictionaryDetail model.SysDictionaryDetail
80+
_ = c.ShouldBindQuery(&sysDictionaryDetail)
81+
err, resysDictionaryDetail := service.GetSysDictionaryDetail(sysDictionaryDetail.ID)
82+
if err != nil {
83+
response.FailWithMessage(fmt.Sprintf("查询失败,%v", err), c)
84+
} else {
85+
response.OkWithData(gin.H{"resysDictionaryDetail": resysDictionaryDetail}, c)
86+
}
87+
}
88+
89+
// @Tags SysDictionaryDetail
90+
// @Summary 分页获取SysDictionaryDetail列表
91+
// @Security ApiKeyAuth
92+
// @accept application/json
93+
// @Produce application/json
94+
// @Param data body request.SysDictionaryDetailSearch true "分页获取SysDictionaryDetail列表"
95+
// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
96+
// @Router /sysDictionaryDetail/getSysDictionaryDetailList [get]
97+
func GetSysDictionaryDetailList(c *gin.Context) {
98+
var pageInfo request.SysDictionaryDetailSearch
99+
_ = c.ShouldBindQuery(&pageInfo)
100+
err, list, total := service.GetSysDictionaryDetailInfoList(pageInfo)
101+
if err != nil {
102+
response.FailWithMessage(fmt.Sprintf("获取数据失败,%v", err), c)
103+
} else {
104+
response.OkWithData(resp.PageResult{
105+
List: list,
106+
Total: total,
107+
Page: pageInfo.Page,
108+
PageSize: pageInfo.PageSize,
109+
}, c)
110+
}
111+
}

0 commit comments

Comments
 (0)