Skip to content

Commit 5be3293

Browse files
committed
Merge branch 'main' of github.com:flipped-aurora/gin-vue-admin
2 parents 296c712 + 2378971 commit 5be3293

Some content is hidden

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

67 files changed

+3957
-3583
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ rm_file/
2727
/server/server
2828
/server/latest_log
2929
/server/__debug_bin*
30+
/server/*.local.yaml
3031
server/uploads/
3132

3233
*.iml

server/api/v1/system/sys_dictionary.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/flipped-aurora/gin-vue-admin/server/global"
55
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
66
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
7+
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
78
"github.com/gin-gonic/gin"
89
"go.uber.org/zap"
910
)
@@ -116,10 +117,17 @@ func (s *DictionaryApi) FindSysDictionary(c *gin.Context) {
116117
// @Security ApiKeyAuth
117118
// @accept application/json
118119
// @Produce application/json
120+
// @Param data query request.SysDictionarySearch true "字典 name 或者 type"
119121
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysDictionary列表,返回包括列表,总数,页码,每页数量"
120122
// @Router /sysDictionary/getSysDictionaryList [get]
121123
func (s *DictionaryApi) GetSysDictionaryList(c *gin.Context) {
122-
list, err := dictionaryService.GetSysDictionaryInfoList()
124+
var dictionary request.SysDictionarySearch
125+
err := c.ShouldBindQuery(&dictionary)
126+
if err != nil {
127+
response.FailWithMessage(err.Error(), c)
128+
return
129+
}
130+
list, err := dictionaryService.GetSysDictionaryInfoList(c, dictionary)
123131
if err != nil {
124132
global.GVA_LOG.Error("获取失败!", zap.Error(err))
125133
response.FailWithMessage("获取失败", c)

server/api/v1/system/sys_dictionary_detail.go

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package system
22

33
import (
4+
"strconv"
5+
46
"github.com/flipped-aurora/gin-vue-admin/server/global"
57
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
68
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
@@ -146,3 +148,120 @@ func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) {
146148
PageSize: pageInfo.PageSize,
147149
}, "获取成功", c)
148150
}
151+
152+
// GetDictionaryTreeList
153+
// @Tags SysDictionaryDetail
154+
// @Summary 获取字典详情树形结构
155+
// @Security ApiKeyAuth
156+
// @accept application/json
157+
// @Produce application/json
158+
// @Param sysDictionaryID query int true "字典ID"
159+
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情树形结构"
160+
// @Router /sysDictionaryDetail/getDictionaryTreeList [get]
161+
func (s *DictionaryDetailApi) GetDictionaryTreeList(c *gin.Context) {
162+
sysDictionaryID := c.Query("sysDictionaryID")
163+
if sysDictionaryID == "" {
164+
response.FailWithMessage("字典ID不能为空", c)
165+
return
166+
}
167+
168+
var id uint
169+
if idUint64, err := strconv.ParseUint(sysDictionaryID, 10, 32); err != nil {
170+
response.FailWithMessage("字典ID格式错误", c)
171+
return
172+
} else {
173+
id = uint(idUint64)
174+
}
175+
176+
list, err := dictionaryDetailService.GetDictionaryTreeList(id)
177+
if err != nil {
178+
global.GVA_LOG.Error("获取失败!", zap.Error(err))
179+
response.FailWithMessage("获取失败", c)
180+
return
181+
}
182+
response.OkWithDetailed(gin.H{"list": list}, "获取成功", c)
183+
}
184+
185+
// GetDictionaryTreeListByType
186+
// @Tags SysDictionaryDetail
187+
// @Summary 根据字典类型获取字典详情树形结构
188+
// @Security ApiKeyAuth
189+
// @accept application/json
190+
// @Produce application/json
191+
// @Param type query string true "字典类型"
192+
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情树形结构"
193+
// @Router /sysDictionaryDetail/getDictionaryTreeListByType [get]
194+
func (s *DictionaryDetailApi) GetDictionaryTreeListByType(c *gin.Context) {
195+
dictType := c.Query("type")
196+
if dictType == "" {
197+
response.FailWithMessage("字典类型不能为空", c)
198+
return
199+
}
200+
201+
list, err := dictionaryDetailService.GetDictionaryTreeListByType(dictType)
202+
if err != nil {
203+
global.GVA_LOG.Error("获取失败!", zap.Error(err))
204+
response.FailWithMessage("获取失败", c)
205+
return
206+
}
207+
response.OkWithDetailed(gin.H{"list": list}, "获取成功", c)
208+
}
209+
210+
// GetDictionaryDetailsByParent
211+
// @Tags SysDictionaryDetail
212+
// @Summary 根据父级ID获取字典详情
213+
// @Security ApiKeyAuth
214+
// @accept application/json
215+
// @Produce application/json
216+
// @Param data query request.GetDictionaryDetailsByParentRequest true "查询参数"
217+
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情列表"
218+
// @Router /sysDictionaryDetail/getDictionaryDetailsByParent [get]
219+
func (s *DictionaryDetailApi) GetDictionaryDetailsByParent(c *gin.Context) {
220+
var req request.GetDictionaryDetailsByParentRequest
221+
err := c.ShouldBindQuery(&req)
222+
if err != nil {
223+
response.FailWithMessage(err.Error(), c)
224+
return
225+
}
226+
227+
list, err := dictionaryDetailService.GetDictionaryDetailsByParent(req)
228+
if err != nil {
229+
global.GVA_LOG.Error("获取失败!", zap.Error(err))
230+
response.FailWithMessage("获取失败", c)
231+
return
232+
}
233+
response.OkWithDetailed(gin.H{"list": list}, "获取成功", c)
234+
}
235+
236+
// GetDictionaryPath
237+
// @Tags SysDictionaryDetail
238+
// @Summary 获取字典详情的完整路径
239+
// @Security ApiKeyAuth
240+
// @accept application/json
241+
// @Produce application/json
242+
// @Param id query uint true "字典详情ID"
243+
// @Success 200 {object} response.Response{data=[]system.SysDictionaryDetail,msg=string} "获取字典详情路径"
244+
// @Router /sysDictionaryDetail/getDictionaryPath [get]
245+
func (s *DictionaryDetailApi) GetDictionaryPath(c *gin.Context) {
246+
idStr := c.Query("id")
247+
if idStr == "" {
248+
response.FailWithMessage("字典详情ID不能为空", c)
249+
return
250+
}
251+
252+
var id uint
253+
if idUint64, err := strconv.ParseUint(idStr, 10, 32); err != nil {
254+
response.FailWithMessage("字典详情ID格式错误", c)
255+
return
256+
} else {
257+
id = uint(idUint64)
258+
}
259+
260+
path, err := dictionaryDetailService.GetDictionaryPath(id)
261+
if err != nil {
262+
global.GVA_LOG.Error("获取失败!", zap.Error(err))
263+
response.FailWithMessage("获取失败", c)
264+
return
265+
}
266+
response.OkWithDetailed(gin.H{"path": path}, "获取成功", c)
267+
}

server/config.docker.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,6 @@ mcp:
280280
version: v1.0.0
281281
sse_path: /sse
282282
message_path: /message
283-
url_prefix: ''
283+
url_prefix: ''
284+
addr: 8889
285+
separate: false

server/config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ system:
8787
router-prefix: ""
8888
# 严格角色模式 打开后权限将会存在上下级关系
8989
use-strict-auth: false
90+
# 禁用自动迁移数据库表结构,生产环境建议设为true,手动迁移
91+
disable-auto-migrate: false
9092

9193
# captcha configuration
9294
captcha:
@@ -268,7 +270,6 @@ cors:
268270
allow-headers: Content-Type,AccessToken,X-CSRF-Token, Authorization, Token,X-Token,X-User-Id
269271
allow-methods: POST, GET
270272
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
271-
272273
allow-credentials: true # 布尔值
273274
- allow-origin: example2.com
274275
allow-headers: content-type
@@ -280,4 +281,6 @@ mcp:
280281
version: v1.0.0
281282
sse_path: /sse
282283
message_path: /message
283-
url_prefix: ''
284+
url_prefix: ''
285+
addr: 8889
286+
separate: false

server/config/mcp.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ type MCP struct {
66
SSEPath string `mapstructure:"sse_path" json:"sse_path" yaml:"sse_path"` // SSE路径
77
MessagePath string `mapstructure:"message_path" json:"message_path" yaml:"message_path"` // 消息路径
88
UrlPrefix string `mapstructure:"url_prefix" json:"url_prefix" yaml:"url_prefix"` // URL前缀
9+
Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` // 独立MCP服务端口
10+
Separate bool `mapstructure:"separate" json:"separate" yaml:"separate"` // 是否独立运行MCP服务
911
}

server/config/system.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ type System struct {
1111
UseRedis bool `mapstructure:"use-redis" json:"use-redis" yaml:"use-redis"` // 使用redis
1212
UseMongo bool `mapstructure:"use-mongo" json:"use-mongo" yaml:"use-mongo"` // 使用mongo
1313
UseStrictAuth bool `mapstructure:"use-strict-auth" json:"use-strict-auth" yaml:"use-strict-auth"` // 使用树形角色分配模式
14+
DisableAutoMigrate bool `mapstructure:"disable-auto-migrate" json:"disable-auto-migrate" yaml:"disable-auto-migrate"` // 自动迁移数据库表结构,生产环境建议设为false,手动迁移
1415
}

server/global/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ package global
44
// 目前只有Version正式使用 其余为预留
55
const (
66
// Version 当前版本号
7-
Version = "v2.8.5"
7+
Version = "v2.8.6"
88
// AppName 应用名称
99
AppName = "Gin-Vue-Admin"
1010
// Description 应用描述
1111
Description = "使用gin+vue进行极速开发的全栈开发基础平台"
12-
)
12+
)

server/go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/gookit/color v1.5.4
2121
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible
2222
github.com/jordan-wright/email v4.0.1-0.20210109023952-943e75fe5223+incompatible
23-
github.com/mark3labs/mcp-go v0.31.0
23+
github.com/mark3labs/mcp-go v0.41.1
2424
github.com/mholt/archives v0.1.1
2525
github.com/minio/minio-go/v7 v7.0.84
2626
github.com/mojocn/base64Captcha v1.3.8
@@ -61,10 +61,12 @@ require (
6161
github.com/STARRY-S/zip v0.2.1 // indirect
6262
github.com/alex-ant/gomath v0.0.0-20160516115720-89013a210a82 // indirect
6363
github.com/andybalholm/brotli v1.1.1 // indirect
64+
github.com/bahlo/generic-list-go v0.2.0 // indirect
6465
github.com/bmatcuk/doublestar/v4 v4.8.0 // indirect
6566
github.com/bodgit/plumbing v1.3.0 // indirect
6667
github.com/bodgit/sevenzip v1.6.0 // indirect
6768
github.com/bodgit/windows v1.0.1 // indirect
69+
github.com/buger/jsonparser v1.1.1 // indirect
6870
github.com/bytedance/sonic v1.12.7 // indirect
6971
github.com/bytedance/sonic/loader v0.2.3 // indirect
7072
github.com/casbin/govaluate v1.3.0 // indirect
@@ -99,6 +101,7 @@ require (
99101
github.com/hashicorp/go-multierror v1.1.1 // indirect
100102
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
101103
github.com/hashicorp/hcl v1.0.0 // indirect
104+
github.com/invopop/jsonschema v0.13.0 // indirect
102105
github.com/jackc/pgpassfile v1.0.0 // indirect
103106
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
104107
github.com/jackc/pgx/v5 v5.7.2 // indirect
@@ -153,6 +156,7 @@ require (
153156
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
154157
github.com/ugorji/go/codec v1.2.12 // indirect
155158
github.com/ulikunitz/xz v0.5.12 // indirect
159+
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
156160
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
157161
github.com/xdg-go/scram v1.1.2 // indirect
158162
github.com/xdg-go/stringprep v1.0.4 // indirect

server/go.sum

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7X
5656
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
5757
github.com/aws/aws-sdk-go v1.55.6 h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
5858
github.com/aws/aws-sdk-go v1.55.6/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
59+
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
60+
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
5961
github.com/bmatcuk/doublestar/v4 v4.6.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
6062
github.com/bmatcuk/doublestar/v4 v4.8.0 h1:DSXtrypQddoug1459viM9X9D3dp1Z7993fw36I2kNcQ=
6163
github.com/bmatcuk/doublestar/v4 v4.8.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
@@ -69,6 +71,8 @@ github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
6971
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
7072
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
7173
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
74+
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
75+
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
7276
github.com/bytedance/sonic v1.12.7 h1:CQU8pxOy9HToxhndH0Kx/S1qU/CuS9GnKYrGioDcU1Q=
7377
github.com/bytedance/sonic v1.12.7/go.mod h1:tnbal4mxOMju17EGfknm2XyYcpyCnIROYOEYuemj13I=
7478
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
@@ -247,6 +251,8 @@ github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible h1:XQVXdk+WAJ
247251
github.com/huaweicloud/huaweicloud-sdk-go-obs v3.24.9+incompatible/go.mod h1:l7VUhRbTKCzdOacdT4oWCwATKyvZqUOlOqr0Ous3k4s=
248252
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
249253
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
254+
github.com/invopop/jsonschema v0.13.0 h1:KvpoAJWEjR3uD9Kbm2HWJmqsEaHt8lBUpd0qHcIi21E=
255+
github.com/invopop/jsonschema v0.13.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
250256
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
251257
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
252258
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo=
@@ -315,8 +321,8 @@ github.com/magiconair/properties v1.8.9 h1:nWcCbLq1N2v/cpNsy5WvQ37Fb+YElfq20WJ/a
315321
github.com/magiconair/properties v1.8.9/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
316322
github.com/mailru/easyjson v0.9.0 h1:PrnmzHw7262yW8sTBwxi1PdJA3Iw/EKBa8psRf7d9a4=
317323
github.com/mailru/easyjson v0.9.0/go.mod h1:1+xMtQp2MRNVL/V1bOzuP3aP8VNwRW55fQUto+XFtTU=
318-
github.com/mark3labs/mcp-go v0.31.0 h1:4UxSV8aM770OPmTvaVe/b1rA2oZAjBMhGBfUgOGut+4=
319-
github.com/mark3labs/mcp-go v0.31.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4=
324+
github.com/mark3labs/mcp-go v0.41.1 h1:w78eWfiQam2i8ICL7AL0WFiq7KHNJQ6UB53ZVtH4KGA=
325+
github.com/mark3labs/mcp-go v0.41.1/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g=
320326
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
321327
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
322328
github.com/mattn/go-sqlite3 v1.14.15/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
@@ -473,6 +479,8 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
473479
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
474480
github.com/unrolled/secure v1.17.0 h1:Io7ifFgo99Bnh0J7+Q+qcMzWM6kaDPCA5FroFZEdbWU=
475481
github.com/unrolled/secure v1.17.0/go.mod h1:BmF5hyM6tXczk3MpQkFf1hpKSRqCyhqcbiQtiAF7+40=
482+
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
483+
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
476484
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
477485
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
478486
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=

0 commit comments

Comments
 (0)