Skip to content

Commit bf81654

Browse files
奇淼(piexlmaxdzwvipSliverHorn
authored
增加自动化代码匹配进入业务库功能 (#1249)
* Update api.go.tpl 修复不创建资源标识时 批量删除 方法内 deletedBy 未声明的问题 * 可自动创建业务库 * 自动化业务库回滚适配 * 修复断点续传路径穿越漏洞 * 增加指定菜单亮起功能 * 增加菜单高亮功能,调整版本号 * fixed: 用户后台注册没接收手机号和邮箱 Co-authored-by: dzwvip <[email protected]> Co-authored-by: SliverHorn <[email protected]>
1 parent b0ebf96 commit bf81654

File tree

20 files changed

+140
-64
lines changed

20 files changed

+140
-64
lines changed

server/api/v1/system/sys_auto_code.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,19 @@ func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) {
107107
// @Router /autoCode/getDatabase [get]
108108
func (autoApi *AutoCodeApi) GetDB(c *gin.Context) {
109109
dbs, err := autoCodeService.Database().GetDB()
110+
var dbList []map[string]interface{}
111+
for _, db := range global.GVA_CONFIG.DBList {
112+
var item = make(map[string]interface{})
113+
item["aliasName"] = db.AliasName
114+
item["dbName"] = db.Dbname
115+
item["disable"] = db.Disable
116+
dbList = append(dbList, item)
117+
}
110118
if err != nil {
111119
global.GVA_LOG.Error("获取失败!", zap.Error(err))
112120
response.FailWithMessage("获取失败", c)
113121
} else {
114-
response.OkWithDetailed(gin.H{"dbs": dbs}, "获取成功", c)
122+
response.OkWithDetailed(gin.H{"dbs": dbs, "dbList": dbList}, "获取成功", c)
115123
}
116124
}
117125

@@ -172,6 +180,7 @@ func (autoApi *AutoCodeApi) CreatePackage(c *gin.Context) {
172180
}
173181
err := autoCodeService.CreateAutoCode(&a)
174182
if err != nil {
183+
175184
global.GVA_LOG.Error("创建成功!", zap.Error(err))
176185
response.FailWithMessage("创建失败", c)
177186
} else {

server/api/v1/system/sys_user.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func (b *BaseApi) Register(c *gin.Context) {
137137
AuthorityId: v,
138138
})
139139
}
140-
user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Authorities: authorities, Enable: r.Enable}
140+
user := &system.SysUser{Username: r.Username, NickName: r.NickName, Password: r.Password, HeaderImg: r.HeaderImg, AuthorityId: r.AuthorityId, Authorities: authorities, Enable: r.Enable, Phone: r.Phone, Email: r.Email}
141141
userReturn, err := userService.Register(*user)
142142
if err != nil {
143143
global.GVA_LOG.Error("注册失败!", zap.Error(err))

server/config.docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pgsql:
8181
log-zap: false
8282

8383
db-list:
84-
- disabled: true # 是否启用
84+
- disable: true # 是否禁用
8585
type: "" # 数据库的类型,目前支持mysql、pgsql
8686
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
8787
path: ""

server/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pgsql:
8181
log-zap: false
8282

8383
db-list:
84-
- disabled: true # 是否启用
84+
- disable: true # 是否禁用
8585
type: "" # 数据库的类型,目前支持mysql、pgsql
8686
alias-name: "" # 数据库的名称,注意: alias-name 需要在db-list中唯一
8787
path: ""

server/core/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func RunWindowsServer() {
3737

3838
fmt.Printf(`
3939
欢迎使用 gin-vue-admin
40-
当前版本:v2.5.4
40+
当前版本:v2.5.4b
4141
加群方式:微信号:shouzi_1994 QQ群:622360840
4242
插件市场:https://plugin.gin-vue-admin.com
4343
GVA讨论社区:https://support.qq.com/products/371961

server/model/system/request/sys_user.go

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

3-
import model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
3+
import (
4+
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
5+
)
46

5-
// User register structure
7+
// Register User register structure
68
type Register struct {
7-
Username string `json:"userName"`
8-
Password string `json:"passWord"`
9-
NickName string `json:"nickName" gorm:"default:'QMPlusUser'"`
10-
HeaderImg string `json:"headerImg" gorm:"default:'https://qmplusimg.henrongyi.top/gva_header.jpg'"`
11-
AuthorityId uint `json:"authorityId" gorm:"default:888"`
12-
Enable int `json:"enable"`
13-
AuthorityIds []uint `json:"authorityIds"`
9+
Username string `json:"userName" example:"用户名"`
10+
Password string `json:"passWord" example:"密码"`
11+
NickName string `json:"nickName" example:"昵称"`
12+
HeaderImg string `json:"headerImg" example:"头像链接"`
13+
AuthorityId uint `json:"authorityId" swaggertype:"string" example:"int 角色id"`
14+
Enable int `json:"enable" swaggertype:"string" example:"int 是否启用"`
15+
AuthorityIds []uint `json:"authorityIds" swaggertype:"string" example:"[]uint 角色id"`
16+
Phone string `json:"phone" example:"电话号码"`
17+
Email string `json:"email" example:"电子邮箱"`
1418
}
1519

1620
// User login structure
@@ -40,13 +44,13 @@ type SetUserAuthorities struct {
4044
}
4145

4246
type ChangeUserInfo struct {
43-
ID uint `gorm:"primarykey"` // 主键ID
44-
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
45-
Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
46-
AuthorityIds []uint `json:"authorityIds" gorm:"-"` // 角色ID
47-
Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
48-
HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
49-
SideMode string `json:"sideMode" gorm:"comment:用户侧边主题"` // 用户侧边主题
50-
Enable int `json:"enable" gorm:"comment:冻结用户"` //冻结用户
51-
Authorities []model.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
47+
ID uint `gorm:"primarykey"` // 主键ID
48+
NickName string `json:"nickName" gorm:"default:系统用户;comment:用户昵称"` // 用户昵称
49+
Phone string `json:"phone" gorm:"comment:用户手机号"` // 用户手机号
50+
AuthorityIds []uint `json:"authorityIds" gorm:"-"` // 角色ID
51+
Email string `json:"email" gorm:"comment:用户邮箱"` // 用户邮箱
52+
HeaderImg string `json:"headerImg" gorm:"default:https://qmplusimg.henrongyi.top/gva_header.jpg;comment:用户头像"` // 用户头像
53+
SideMode string `json:"sideMode" gorm:"comment:用户侧边主题"` // 用户侧边主题
54+
Enable int `json:"enable" gorm:"comment:冻结用户"` //冻结用户
55+
Authorities []system.SysAuthority `json:"-" gorm:"many2many:sys_user_authority;"`
5256
}

server/model/system/response/sys_auto_code_history.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type AutoCodeHistory struct {
66
ID uint `json:"ID" gorm:"column:id"`
77
CreatedAt time.Time `json:"CreatedAt" gorm:"column:created_at"`
88
UpdatedAt time.Time `json:"UpdatedAt" gorm:"column:updated_at"`
9+
BusinessDB string `json:"businessDB" gorm:"column:business_db"`
910
TableName string `json:"tableName" gorm:"column:table_name"`
1011
StructName string `json:"structName" gorm:"column:struct_name"`
1112
StructCNName string `json:"structCNName" gorm:"column:struct_cn_name"`

server/model/system/sys_auto_code.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type AutoCodeStruct struct {
1919
AutoCreateApiToSql bool `json:"autoCreateApiToSql"` // 是否自动创建api
2020
AutoCreateResource bool `json:"autoCreateResource"` // 是否自动创建资源标识
2121
AutoMoveFile bool `json:"autoMoveFile"` // 是否自动移动文件
22+
BusinessDB string `json:"businessDB"` // 业务数据库
2223
Fields []*Field `json:"fields,omitempty"`
2324
HasTimer bool
2425
DictTypes []string `json:"-"`

server/model/system/sys_autocode_history.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
type SysAutoCodeHistory struct {
1313
global.GVA_MODEL
1414
Package string `json:"package"`
15+
BusinessDB string `json:"businessDB"`
1516
TableName string `json:"tableName"`
1617
RequestMeta string `gorm:"type:text" json:"requestMeta,omitempty"` // 前端传入的结构化信息
1718
AutoCodePath string `gorm:"type:text" json:"autoCodePath,omitempty"` // 其他meta信息 path;path

server/model/system/sys_base_menu.go

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,34 @@ import (
66

77
type SysBaseMenu struct {
88
global.GVA_MODEL
9-
MenuLevel uint `json:"-"`
10-
ParentId string `json:"parentId" gorm:"comment:父菜单ID"` // 父菜单ID
11-
Path string `json:"path" gorm:"comment:路由path"` // 路由path
12-
Name string `json:"name" gorm:"comment:路由name"` // 路由name
13-
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` // 是否在列表隐藏
14-
Component string `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
15-
Sort int `json:"sort" gorm:"comment:排序标记"` // 排序标记
16-
Meta `json:"meta" gorm:"embedded;comment:附加属性"` // 附加属性
17-
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
18-
Children []SysBaseMenu `json:"children" gorm:"-"`
19-
Parameters []SysBaseMenuParameter `json:"parameters"`
20-
MenuBtn []SysBaseMenuBtn `json:"menuBtn"`
9+
MenuLevel uint `json:"-"`
10+
ParentId string `json:"parentId" gorm:"comment:父菜单ID"` // 父菜单ID
11+
Path string `json:"path" gorm:"comment:路由path"` // 路由path
12+
Name string `json:"name" gorm:"comment:路由name"` // 路由name
13+
Hidden bool `json:"hidden" gorm:"comment:是否在列表隐藏"` // 是否在列表隐藏
14+
Component string `json:"component" gorm:"comment:对应前端文件路径"` // 对应前端文件路径
15+
Sort int `json:"sort" gorm:"comment:排序标记"` // 排序标记
16+
Meta `json:"meta" gorm:"embedded;comment:附加属性"` // 附加属性
17+
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
18+
Children []SysBaseMenu `json:"children" gorm:"-"`
19+
Parameters []SysBaseMenuParameter `json:"parameters"`
20+
MenuBtn []SysBaseMenuBtn `json:"menuBtn"`
2121
}
2222

2323
type Meta struct {
24-
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"` // 是否缓存
24+
ActiveName string `json:"activeName" gorm:"comment:高亮菜单"`
25+
KeepAlive bool `json:"keepAlive" gorm:"comment:是否缓存"` // 是否缓存
2526
DefaultMenu bool `json:"defaultMenu" gorm:"comment:是否是基础路由(开发中)"` // 是否是基础路由(开发中)
26-
Title string `json:"title" gorm:"comment:菜单名"` // 菜单名
27-
Icon string `json:"icon" gorm:"comment:菜单图标"` // 菜单图标
28-
CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` // 自动关闭tab
27+
Title string `json:"title" gorm:"comment:菜单名"` // 菜单名
28+
Icon string `json:"icon" gorm:"comment:菜单图标"` // 菜单图标
29+
CloseTab bool `json:"closeTab" gorm:"comment:自动关闭tab"` // 自动关闭tab
2930
}
3031

3132
type SysBaseMenuParameter struct {
3233
global.GVA_MODEL
3334
SysBaseMenuID uint
3435
Type string `json:"type" gorm:"comment:地址栏携带参数为params还是query"` // 地址栏携带参数为params还是query
35-
Key string `json:"key" gorm:"comment:地址栏携带参数的key"` // 地址栏携带参数的key
36+
Key string `json:"key" gorm:"comment:地址栏携带参数的key"` // 地址栏携带参数的key
3637
Value string `json:"value" gorm:"comment:地址栏携带参数的值"` // 地址栏携带参数的值
3738
}
3839

0 commit comments

Comments
 (0)