Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2.7.2版本发布 #1853

Merged
merged 21 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a0b06db
feat: 自动化代码增加json导出和导入功能
pixelmaxQm Aug 10, 2024
a96d2fd
feat: 自动化代码前端可见分为Table和Form分别选中
pixelmaxQm Aug 10, 2024
5650831
feat: 自动化代码前端可见分为Table和Form分别选中
pixelmaxQm Aug 10, 2024
40ac02c
feature: 调整代码预览为左边栏模式的tabs。
pixelmaxQm Aug 10, 2024
aee55ba
feat: 插件模式form.vue自动化模板调整
pixelmaxQm Aug 10, 2024
1c4278f
feature: 修复无法创建form的bug。
pixelmaxQm Aug 10, 2024
cb61061
feat: 增加方法自动添加前端api
pixelmaxQm Aug 11, 2024
804f105
feat: 微调自动生成前端api的js方法的模板
pixelmaxQm Aug 11, 2024
5278c56
feat: 自动化生成前端支持详情功能
pixelmaxQm Aug 11, 2024
d66a344
feat: 调整详情功能模板
pixelmaxQm Aug 11, 2024
204b99f
feat: 调整自动化代码页面前端表格列宽
pixelmaxQm Aug 11, 2024
cf3a08a
feat: 增加自动创建可控权限按钮功能
pixelmaxQm Aug 11, 2024
0f8a1f2
fixed: 顶栏样式菜单样式细节bug修复
pixelmaxQm Aug 11, 2024
0e02508
fixed: 顶栏样式菜单样式细节bug修复
pixelmaxQm Aug 11, 2024
07415ed
fixed: 修改视频地址
pixelmaxQm Aug 11, 2024
d0c3c74
fixed: 自动获取表结构和数据库表列结构保持一致
pixelmaxQm Aug 12, 2024
c50dce0
Merge remote-tracking branch 'refs/remotes/origin/main' into dev272
pixelmaxQm Aug 12, 2024
35dd0e9
My dev272 (#1851)
krank666 Aug 12, 2024
ea39ff0
feat: 复杂数据类型的查询将不会生成查询语句,会以string形式接收参数,用户自行实现复杂查询逻辑。
pixelmaxQm Aug 12, 2024
337bf80
feat: 创建新角色默认携带字典和长传权限。
pixelmaxQm Aug 12, 2024
607690d
feat: 当package或plugin结构异常时候,阻止创建自动化代码。
pixelmaxQm Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/api/v1/system/sys_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) {
err = baseMenuService.DeleteBaseMenu(menu.ID)
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
response.FailWithMessage("删除失败:"+err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
Expand Down
2 changes: 1 addition & 1 deletion server/core/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func RunWindowsServer() {

fmt.Printf(`
欢迎使用 gin-vue-admin
当前版本:v2.7.1
当前版本:v2.7.2
加群方式:微信号:shouzi_1994 QQ群:470239250
项目地址:https://github.com/flipped-aurora/gin-vue-admin
插件市场:https://plugin.gin-vue-admin.com
Expand Down
2 changes: 1 addition & 1 deletion server/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8087,7 +8087,7 @@ const docTemplate = `{

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "v2.7.1",
Version: "v2.7.2",
Host: "",
BasePath: "",
Schemes: []string{},
Expand Down
2 changes: 1 addition & 1 deletion server/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "使用gin+vue进行极速开发的全栈开发基础平台",
"title": "Gin-Vue-Admin Swagger API接口文档",
"contact": {},
"version": "v2.7.1"
"version": "v2.7.2"
},
"paths": {
"/api/createApi": {
Expand Down
2 changes: 1 addition & 1 deletion server/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ info:
contact: {}
description: 使用gin+vue进行极速开发的全栈开发基础平台
title: Gin-Vue-Admin Swagger API接口文档
version: v2.7.1
version: v2.7.2
paths:
/api/createApi:
post:
Expand Down
2 changes: 1 addition & 1 deletion server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
//go:generate go mod download

// @title Gin-Vue-Admin Swagger API接口文档
// @version v2.7.1
// @version v2.7.2
// @description 使用gin+vue进行极速开发的全栈开发基础平台
// @securityDefinitions.apikey ApiKeyAuth
// @in header
Expand Down
31 changes: 15 additions & 16 deletions server/model/system/request/sys_auto_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ type AutoCode struct {
AutoCreateResource bool `json:"autoCreateResource" example:"false"` // 是否自动创建资源标识
AutoCreateApiToSql bool `json:"autoCreateApiToSql" example:"false"` // 是否自动创建api
AutoCreateMenuToSql bool `json:"autoCreateMenuToSql" example:"false"` // 是否自动创建menu
AutoCreateBtnAuth bool `json:"autoCreateBtnAuth" example:"false"` // 是否自动创建按钮权限
Fields []*AutoCodeField `json:"fields"`
DictTypes []string `json:"-"`
FrontFields []*AutoCodeField `json:"-"`
PrimaryField *AutoCodeField `json:"primaryField"`
DataSourceMap map[string]*DataSource `json:"-"`
HasPic bool `json:"-"`
Expand Down Expand Up @@ -114,7 +114,6 @@ func (r *AutoCode) Pretreatment() error {
} // test
length := len(r.Fields)
dict := make(map[string]string, length)
r.FrontFields = make([]*AutoCodeField, 0, length)
r.DataSourceMap = make(map[string]*DataSource, length)
for i := 0; i < length; i++ {
if r.Fields[i].DictType != "" {
Expand All @@ -123,9 +122,6 @@ func (r *AutoCode) Pretreatment() error {
if r.Fields[i].Sort {
r.NeedSort = true
}
if r.Fields[i].Front {
r.FrontFields = append(r.FrontFields, r.Fields[i])
}
switch r.Fields[i].FieldType {
case "file":
r.HasFile = true
Expand Down Expand Up @@ -204,17 +200,20 @@ func (r *AutoCode) History() SysAutoHistoryCreate {
}

type AutoCodeField struct {
FieldName string `json:"fieldName"` // Field名
FieldDesc string `json:"fieldDesc"` // 中文名
FieldType string `json:"fieldType"` // Field数据类型
FieldJson string `json:"fieldJson"` // FieldJson
DataTypeLong string `json:"dataTypeLong"` // 数据库字段长度
Comment string `json:"comment"` // 数据库字段描述
ColumnName string `json:"columnName"` // 数据库字段
FieldSearchType string `json:"fieldSearchType"` // 搜索条件
FieldSearchHide bool `json:"fieldSearchHide"` // 是否隐藏查询条件
DictType string `json:"dictType"` // 字典
Front bool `json:"front"` // 是否前端可见
FieldName string `json:"fieldName"` // Field名
FieldDesc string `json:"fieldDesc"` // 中文名
FieldType string `json:"fieldType"` // Field数据类型
FieldJson string `json:"fieldJson"` // FieldJson
DataTypeLong string `json:"dataTypeLong"` // 数据库字段长度
Comment string `json:"comment"` // 数据库字段描述
ColumnName string `json:"columnName"` // 数据库字段
FieldSearchType string `json:"fieldSearchType"` // 搜索条件
FieldSearchHide bool `json:"fieldSearchHide"` // 是否隐藏查询条件
DictType string `json:"dictType"` // 字典
//Front bool `json:"front"` // 是否前端可见
Form bool `json:"form"` // 是否前端新建/编辑
Table bool `json:"table"` // 是否前端表格列
Desc bool `json:"desc"` // 是否前端详情
Require bool `json:"require"` // 是否必填
DefaultValue string `json:"defaultValue"` // 是否必填
ErrorText string `json:"errorText"` // 校验失败文字
Expand Down
5 changes: 3 additions & 2 deletions server/model/system/request/sys_casbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ func DefaultCasbin() []CasbinInfo {
{Path: "/menu/getMenu", Method: "POST"},
{Path: "/jwt/jsonInBlacklist", Method: "POST"},
{Path: "/base/login", Method: "POST"},
{Path: "/user/admin_register", Method: "POST"},
{Path: "/user/changePassword", Method: "POST"},
{Path: "/user/setUserAuthority", Method: "POST"},
{Path: "/user/setUserInfo", Method: "PUT"},
{Path: "/user/getUserInfo", Method: "GET"},
{Path: "/user/setSelfInfo", Method: "PUT"},
{Path: "/fileUploadAndDownload/upload", Method: "POST"},
{Path: "/sysDictionary/findSysDictionary", Method: "GET"},
}
}
34 changes: 34 additions & 0 deletions server/resource/function/api.js.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{{if .IsPlugin}}
// {{.FuncName}} 等待开发的的{{.Description}}接口
// @Tags {{.StructName}}
// @Summary 等待开发的的{{.Description}}接口
// @accept application/json
// @Produce application/json
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
// @Success 200 {object} response.Response{data=object,msg=string} "获取成功"
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
export const {{.Router}} = () => {
return service({
url: '/{{.Abbreviation}}/{{.Router}}',
method: '{{.Method}}'
})
}

{{- else -}}

// {{.FuncName}} 等待开发的的{{.Description}}接口
// @Tags {{.StructName}}
// @Summary 等待开发的的{{.Description}}接口
// @accept application/json
// @Produce application/json
// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功"
// @Success 200 {object} response.Response{data=object,msg=string} "成功"
// @Router /{{.Abbreviation}}/{{.Router}} [{{.Method}}]
export const {{.Router}} = () => {
return service({
url: '/{{.Abbreviation}}/{{.Router}}',
method: '{{.Method}}'
})
}

{{- end -}}
14 changes: 7 additions & 7 deletions server/resource/package/server/api/api.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Create{{.StructName}}(c *gin.Con
err = {{.Abbreviation}}Service.Create{{.StructName}}(&{{.Abbreviation}})
if err != nil {
global.GVA_LOG.Error("创建失败!", zap.Error(err))
response.FailWithMessage("创建失败", c)
response.FailWithMessage("创建失败:" + err.Error(), c)
return
}
response.OkWithMessage("创建成功", c)
Expand All @@ -59,7 +59,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}(c *gin.Con
err := {{.Abbreviation}}Service.Delete{{.StructName}}({{.PrimaryField.FieldJson}} {{- if .AutoCreateResource -}},userID{{- end -}})
if err != nil {
global.GVA_LOG.Error("删除失败!", zap.Error(err))
response.FailWithMessage("删除失败", c)
response.FailWithMessage("删除失败:" + err.Error(), c)
return
}
response.OkWithMessage("删除成功", c)
Expand All @@ -81,7 +81,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Delete{{.StructName}}ByIds(c *gi
err := {{.Abbreviation}}Service.Delete{{.StructName}}ByIds({{.PrimaryField.FieldJson}}s{{- if .AutoCreateResource }},userID{{- end }})
if err != nil {
global.GVA_LOG.Error("批量删除失败!", zap.Error(err))
response.FailWithMessage("批量删除失败", c)
response.FailWithMessage("批量删除失败:" + err.Error(), c)
return
}
response.OkWithMessage("批量删除成功", c)
Expand Down Expand Up @@ -109,7 +109,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Update{{.StructName}}(c *gin.Con
err = {{.Abbreviation}}Service.Update{{.StructName}}({{.Abbreviation}})
if err != nil {
global.GVA_LOG.Error("更新失败!", zap.Error(err))
response.FailWithMessage("更新失败", c)
response.FailWithMessage("更新失败:" + err.Error(), c)
return
}
response.OkWithMessage("更新成功", c)
Expand All @@ -129,7 +129,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Find{{.StructName}}(c *gin.Conte
re{{.Abbreviation}}, err := {{.Abbreviation}}Service.Get{{.StructName}}({{.PrimaryField.FieldJson}})
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
response.FailWithMessage("查询失败:" + err.Error(), c)
return
}
response.OkWithData(re{{.Abbreviation}}, c)
Expand All @@ -154,7 +154,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}List(c *gin.Co
list, total, err := {{.Abbreviation}}Service.Get{{.StructName}}InfoList(pageInfo)
if err != nil {
global.GVA_LOG.Error("获取失败!", zap.Error(err))
response.FailWithMessage("获取失败", c)
response.FailWithMessage("获取失败:" + err.Error(), c)
return
}
response.OkWithDetailed(response.PageResult{
Expand All @@ -178,7 +178,7 @@ func ({{.Abbreviation}}Api *{{.StructName}}Api) Get{{.StructName}}DataSource(c *
dataSource, err := {{.Abbreviation}}Service.Get{{.StructName}}DataSource()
if err != nil {
global.GVA_LOG.Error("查询失败!", zap.Error(err))
response.FailWithMessage("查询失败", c)
response.FailWithMessage("查询失败:" + err.Error(), c)
return
}
response.OkWithData(dataSource, c)
Expand Down
10 changes: 2 additions & 8 deletions server/resource/package/server/model/request/request.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@ type {{.StructName}}Search struct{
Start{{.FieldName}} *{{.FieldType}} `json:"start{{.FieldName}}" form:"start{{.FieldName}}"`
End{{.FieldName}} *{{.FieldType}} `json:"end{{.FieldName}}" form:"end{{.FieldName}}"`
{{- else }}
{{- if eq .FieldType "enum" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}"`
{{- else if eq .FieldType "picture" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" `
{{- else if eq .FieldType "video" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" `
{{- else if eq .FieldType "richtext" }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" `
{{- if or (eq .FieldType "enum") (eq .FieldType "picture") (eq .FieldType "video") (eq .FieldType "richtext") (eq .FieldType "json") }}
{{.FieldName}} string `json:"{{.FieldJson}}" form:"{{.FieldJson}}" `
{{- else if ne .FieldType "string" }}
{{.FieldName}} *{{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" `
{{- else }}
Expand Down
6 changes: 5 additions & 1 deletion server/resource/package/server/service/service.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ func ({{.Abbreviation}}Service *{{.StructName}}Service)Get{{.StructName}}InfoLis
{{- end }}
{{- range .Fields}}
{{- if .FieldSearchType}}
{{- if or (eq .FieldType "string") (eq .FieldType "enum") (eq .FieldType "picture") (eq .FieldType "video") (eq .FieldType "richtext") }}
{{- if or (eq .FieldType "string") (eq .FieldType "enum") (eq .FieldType "picture") (eq .FieldType "video") (eq .FieldType "richtext") (eq .FieldType "json") }}
if info.{{.FieldName}} != "" {
{{- if or (eq .FieldType "enum") (eq .FieldType "string") }}
db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+ {{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
{{- else}}
// 数据类型为复杂类型,请根据业务需求自行实现复杂类型的查询业务
{{- end}}
}
{{- else if eq .FieldSearchType "BETWEEN" "NOT BETWEEN"}}
if info.Start{{.FieldName}} != nil && info.End{{.FieldName}} != nil {
Expand Down
4 changes: 4 additions & 0 deletions server/resource/package/web/view/form.vue.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<div class="gva-form-box">
<el-form :model="formData" ref="elFormRef" label-position="right" :rules="rule" label-width="80px">
{{- range .Fields}}
{{- if .Form }}
<el-form-item label="{{.FieldDesc}}:" prop="{{.FieldJson}}">
{{- if .CheckDataSource}}
<el-select {{if eq .DataSource.Association 2}} multiple {{ end }} v-model="formData.{{.FieldJson}}" placeholder="请选择{{.FieldDesc}}" style="width:100%" :clearable="{{.Clearable}}" >
Expand Down Expand Up @@ -56,6 +57,7 @@
{{- end }}
{{- end }}
</el-form-item>
{{- end }}
{{- end }}
<el-form-item>
<el-button type="primary" @click="save">保存</el-button>
Expand Down Expand Up @@ -106,6 +108,7 @@ const {{ $element }}Options = ref([])
{{- end }}
const formData = ref({
{{- range .Fields}}
{{- if .Form }}
{{- if eq .FieldType "bool" }}
{{.FieldJson}}: false,
{{- end }}
Expand Down Expand Up @@ -142,6 +145,7 @@ const formData = ref({
{{- if eq .FieldType "array" }}
{{.FieldJson}}: [],
{{- end }}
{{- end }}
{{- end }}
})
// 验证规则
Expand Down
Loading
Loading