Skip to content

Commit fde276e

Browse files
author
pixel
committed
增加自动创建搜索功能 增加搜索条件 增加数据库注释 增加插件功能(0.0.1版 请勿用于生产)
1 parent 8173ff6 commit fde276e

20 files changed

+187
-69
lines changed

server/api/v1/sys_auto_code.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,31 +37,31 @@ func CreateTemp(c *gin.Context) {
3737
apiList := [5]model.SysApi{
3838
{
3939
Path: "/" + a.Abbreviation + "/" + "create" + a.StructName,
40-
Description: "新增" + a.StructName,
40+
Description: "新增" + a.Description,
4141
ApiGroup: a.Abbreviation,
4242
Method: "POST",
4343
},
4444
{
4545
Path: "/" + a.Abbreviation + "/" + "delete" + a.StructName,
46-
Description: "删除" + a.StructName,
46+
Description: "删除" + a.Description,
4747
ApiGroup: a.Abbreviation,
4848
Method: "DELETE",
4949
},
5050
{
5151
Path: "/" + a.Abbreviation + "/" + "update" + a.StructName,
52-
Description: "更新" + a.StructName,
52+
Description: "更新" + a.Description,
5353
ApiGroup: a.Abbreviation,
5454
Method: "PUT",
5555
},
5656
{
5757
Path: "/" + a.Abbreviation + "/" + "find" + a.StructName,
58-
Description: "根据ID获取" + a.StructName,
58+
Description: "根据ID获取" + a.Description,
5959
ApiGroup: a.Abbreviation,
6060
Method: "GET",
6161
},
6262
{
6363
Path: "/" + a.Abbreviation + "/" + "get" + a.StructName + "List",
64-
Description: "获取" + a.StructName + "列表",
64+
Description: "获取" + a.Description + "列表",
6565
ApiGroup: a.Abbreviation,
6666
Method: "GET",
6767
},

server/core/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ func RunWindowsServer() {
1616
}
1717
Router := initialize.Routers()
1818
Router.Static("/form-generator", "./resource/page")
19+
20+
// 插件安装 暂时只是后台功能 添加model 添加路由 添加对数据库的操作 详细插件测试模板可看https://github.com/piexlmax/gvaplug 此处不建议投入生产
1921
err := initialize.InstallPlug(global.GVA_DB, Router, gvaplug.GvaPlug{})
2022
if err != nil {
2123
panic(fmt.Sprintf("插件安装失败: %v", err))
2224
}
25+
// end 插件描述
2326

2427
address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
2528
s := &http.Server{

server/model/exa_customer.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66

77
type ExaCustomer struct {
88
gorm.Model
9-
CustomerName string `json:"customerName" form:"customerName"`
10-
CustomerPhoneData string `json:"customerPhoneData" form:"customerPhoneData"`
11-
SysUserID uint `json:"sysUserId" form:"sysUserId"`
12-
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID"`
13-
SysUser SysUser `json:"sysUser" form:"sysUser"`
9+
CustomerName string `json:"customerName" form:"customerName" gorm:"comment:'客户名'"`
10+
CustomerPhoneData string `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:'客户手机号'"`
11+
SysUserID uint `json:"sysUserId" form:"sysUserId" gorm:"comment:'管理ID'"`
12+
SysUserAuthorityID string `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:'管理角色ID'"`
13+
SysUser SysUser `json:"sysUser" form:"sysUser" gorm:"comment:'管理详情'"`
1414
}

server/model/exa_file_upload_download.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
type ExaFileUploadAndDownload struct {
88
gorm.Model
9-
Name string `json:"name"`
10-
Url string `json:"url"`
11-
Tag string `json:"tag"`
12-
Key string `json:"key"`
9+
Name string `json:"name" gorm:"comment:'文件名'"`
10+
Url string `json:"url" gorm:"comment:'文件地址'"`
11+
Tag string `json:"tag" gorm:"comment:'文件标签'"`
12+
Key string `json:"key" gorm:"comment:'编号'"`
1313
}

server/model/sys_api.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
type SysApi struct {
88
gorm.Model
9-
Path string `json:"path"`
10-
Description string `json:"description"`
11-
ApiGroup string `json:"apiGroup"`
12-
Method string `json:"method" gorm:"default:'POST'"`
9+
Path string `json:"path" gorm:"comment:'api路径'"`
10+
Description string `json:"description" gorm:"comment:'api中文描述'"`
11+
ApiGroup string `json:"apiGroup" gorm:"comment:'api组'"`
12+
Method string `json:"method" gorm:"default:'POST'" gorm:"comment:'方法'"`
1313
}

server/model/sys_authority.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ type SysAuthority struct {
88
CreatedAt time.Time
99
UpdatedAt time.Time
1010
DeletedAt *time.Time `sql:"index"`
11-
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key"`
12-
AuthorityName string `json:"authorityName"`
13-
ParentId string `json:"parentId"`
11+
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key" gorm:"comment:'角色ID'"`
12+
AuthorityName string `json:"authorityName" gorm:"comment:'角色名'"`
13+
ParentId string `json:"parentId" gorm:"comment:'父角色ID'"`
1414
DataAuthorityId []SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;association_jointable_foreignkey:data_authority_id"`
1515
Children []SysAuthority `json:"children"`
1616
SysBaseMenus []SysBaseMenu `json:"menus" gorm:"many2many:sys_authority_menus;"`

server/model/sys_authority_menu.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package model
22

33
type SysMenu struct {
44
SysBaseMenu
5-
MenuId string `json:"menuId"`
6-
AuthorityId string `json:"-"`
5+
MenuId string `json:"menuId" gorm:"comment:'菜单ID'"`
6+
AuthorityId string `json:"-" gorm:"comment:'角色ID'"`
77
Children []SysMenu `json:"children"`
88
}

server/model/sys_auto_code.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ type AutoCodeStruct struct {
55
StructName string `json:"structName"`
66
PackageName string `json:"packageName"`
77
Abbreviation string `json:"abbreviation"`
8+
Description string `json:"description"`
89
AutoCreateApiToSql bool `json:"autoCreateApiToSql"`
910
Fields []Field `json:"fields"`
1011
}
@@ -14,5 +15,7 @@ type Field struct {
1415
FieldDesc string `json:"fieldDesc"`
1516
FieldType string `json:"fieldType"`
1617
FieldJson string `json:"fieldJson"`
18+
Comment string `json:"comment"`
1719
ColumnName string `json:"columnName"`
18-
}
20+
FieldSearchType string `json:"fieldSearchType"`
21+
}

server/model/sys_base_menu.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ import (
77
type SysBaseMenu struct {
88
gorm.Model
99
MenuLevel uint `json:"-"`
10-
ParentId string `json:"parentId"`
11-
Path string `json:"path"`
12-
Name string `json:"name"`
13-
Hidden bool `json:"hidden"`
14-
Component string `json:"component"`
15-
Sort int `json:"sort"`
16-
Meta `json:"meta"`
10+
ParentId string `json:"parentId" gorm:"comment:'父菜单ID'"`
11+
Path string `json:"path" gorm:"comment:'路由path'"`
12+
Name string `json:"name" gorm:"comment:'路由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:"comment:'附加属性'"`
1717
SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
1818
Children []SysBaseMenu `json:"children"`
1919
}
2020

2121
type Meta struct {
22-
KeepAlive bool `json:"keepAlive"`
23-
DefaultMenu bool `json:"defaultMenu"`
24-
Title string `json:"title"`
25-
Icon string `json:"icon"`
22+
KeepAlive bool `json:"keepAlive" gorm:"comment:'是否缓存'"`
23+
DefaultMenu bool `json:"defaultMenu" gorm:"comment:'是否是基础路由(开发中)'"`
24+
Title string `json:"title" gorm:"comment:'菜单名'"`
25+
Icon string `json:"icon" gorm:"comment:'菜单图标'"`
2626
}

server/model/sys_jwt_blacklist.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import (
66

77
type JwtBlacklist struct {
88
gorm.Model
9-
Jwt string `gorm:"type:text"`
9+
Jwt string `gorm:"type:text;comment:'jwt'"`
1010
}

0 commit comments

Comments
 (0)