diff --git a/server/api/v1/example/exa_breakpoint_continue.go b/server/api/v1/example/exa_breakpoint_continue.go index 5ceba06b02..7e884ed3bc 100644 --- a/server/api/v1/example/exa_breakpoint_continue.go +++ b/server/api/v1/example/exa_breakpoint_continue.go @@ -17,14 +17,15 @@ import ( ) // BreakpointContinue -// @Tags ExaFileUploadAndDownload -// @Summary 断点续传到服务器 -// @Security ApiKeyAuth -// @accept multipart/form-data -// @Produce application/json -// @Param file formData file true "an example for breakpoint resume, 断点续传示例" -// @Success 200 {object} response.Response{msg=string} "断点续传到服务器" -// @Router /fileUploadAndDownload/breakpointContinue [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 断点续传到服务器 +// @Security ApiKeyAuth +// @accept multipart/form-data +// @Produce application/json +// @Param file formData file true "an example for breakpoint resume, 断点续传示例" +// @Success 200 {object} response.Response{msg=string} "断点续传到服务器" +// @Router /fileUploadAndDownload/breakpointContinue [post] func (b *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) { fileMd5 := c.Request.FormValue("fileMd5") fileName := c.Request.FormValue("fileName") @@ -77,14 +78,15 @@ func (b *FileUploadAndDownloadApi) BreakpointContinue(c *gin.Context) { } // FindFile -// @Tags ExaFileUploadAndDownload -// @Summary 查找文件 -// @Security ApiKeyAuth -// @accept multipart/form-data -// @Produce application/json -// @Param file formData file true "Find the file, 查找文件" -// @Success 200 {object} response.Response{data=exampleRes.FileResponse,msg=string} "查找文件,返回包括文件详情" -// @Router /fileUploadAndDownload/findFile [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 查找文件 +// @Security ApiKeyAuth +// @accept multipart/form-data +// @Produce application/json +// @Param file formData file true "Find the file, 查找文件" +// @Success 200 {object} response.Response{data=exampleRes.FileResponse,msg=string} "查找文件,返回包括文件详情" +// @Router /fileUploadAndDownload/findFile [post] func (b *FileUploadAndDownloadApi) FindFile(c *gin.Context) { fileMd5 := c.Query("fileMd5") fileName := c.Query("fileName") @@ -99,14 +101,15 @@ func (b *FileUploadAndDownloadApi) FindFile(c *gin.Context) { } // BreakpointContinueFinish -// @Tags ExaFileUploadAndDownload -// @Summary 创建文件 -// @Security ApiKeyAuth -// @accept multipart/form-data -// @Produce application/json -// @Param file formData file true "上传文件完成" -// @Success 200 {object} response.Response{data=exampleRes.FilePathResponse,msg=string} "创建文件,返回包括文件路径" -// @Router /fileUploadAndDownload/findFile [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 创建文件 +// @Security ApiKeyAuth +// @accept multipart/form-data +// @Produce application/json +// @Param file formData file true "上传文件完成" +// @Success 200 {object} response.Response{data=exampleRes.FilePathResponse,msg=string} "创建文件,返回包括文件路径" +// @Router /fileUploadAndDownload/findFile [post] func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) { fileMd5 := c.Query("fileMd5") fileName := c.Query("fileName") @@ -120,14 +123,15 @@ func (b *FileUploadAndDownloadApi) BreakpointContinueFinish(c *gin.Context) { } // RemoveChunk -// @Tags ExaFileUploadAndDownload -// @Summary 删除切片 -// @Security ApiKeyAuth -// @accept multipart/form-data -// @Produce application/json -// @Param file formData file true "删除缓存切片" -// @Success 200 {object} response.Response{msg=string} "删除切片" -// @Router /fileUploadAndDownload/removeChunk [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 删除切片 +// @Security ApiKeyAuth +// @accept multipart/form-data +// @Produce application/json +// @Param file formData file true "删除缓存切片" +// @Success 200 {object} response.Response{msg=string} "删除切片" +// @Router /fileUploadAndDownload/removeChunk [post] func (b *FileUploadAndDownloadApi) RemoveChunk(c *gin.Context) { var file example.ExaFile err := c.ShouldBindJSON(&file) diff --git a/server/api/v1/example/exa_customer.go b/server/api/v1/example/exa_customer.go index 5d9ef1c026..65ded0858a 100644 --- a/server/api/v1/example/exa_customer.go +++ b/server/api/v1/example/exa_customer.go @@ -14,14 +14,15 @@ import ( type CustomerApi struct{} // CreateExaCustomer -// @Tags ExaCustomer -// @Summary 创建客户 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body example.ExaCustomer true "客户用户名, 客户手机号码" -// @Success 200 {object} response.Response{msg=string} "创建客户" -// @Router /customer/customer [post] +// +// @Tags ExaCustomer +// @Summary 创建客户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body example.ExaCustomer true "客户用户名, 客户手机号码" +// @Success 200 {object} response.Response{msg=string} "创建客户" +// @Router /customer/customer [post] func (e *CustomerApi) CreateExaCustomer(c *gin.Context) { var customer example.ExaCustomer err := c.ShouldBindJSON(&customer) @@ -46,14 +47,15 @@ func (e *CustomerApi) CreateExaCustomer(c *gin.Context) { } // DeleteExaCustomer -// @Tags ExaCustomer -// @Summary 删除客户 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body example.ExaCustomer true "客户ID" -// @Success 200 {object} response.Response{msg=string} "删除客户" -// @Router /customer/customer [delete] +// +// @Tags ExaCustomer +// @Summary 删除客户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body example.ExaCustomer true "客户ID" +// @Success 200 {object} response.Response{msg=string} "删除客户" +// @Router /customer/customer [delete] func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) { var customer example.ExaCustomer err := c.ShouldBindJSON(&customer) @@ -76,14 +78,15 @@ func (e *CustomerApi) DeleteExaCustomer(c *gin.Context) { } // UpdateExaCustomer -// @Tags ExaCustomer -// @Summary 更新客户信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body example.ExaCustomer true "客户ID, 客户信息" -// @Success 200 {object} response.Response{msg=string} "更新客户信息" -// @Router /customer/customer [put] +// +// @Tags ExaCustomer +// @Summary 更新客户信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body example.ExaCustomer true "客户ID, 客户信息" +// @Success 200 {object} response.Response{msg=string} "更新客户信息" +// @Router /customer/customer [put] func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) { var customer example.ExaCustomer err := c.ShouldBindJSON(&customer) @@ -111,14 +114,15 @@ func (e *CustomerApi) UpdateExaCustomer(c *gin.Context) { } // GetExaCustomer -// @Tags ExaCustomer -// @Summary 获取单一客户信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query example.ExaCustomer true "客户ID" -// @Success 200 {object} response.Response{data=exampleRes.ExaCustomerResponse,msg=string} "获取单一客户信息,返回包括客户详情" -// @Router /customer/customer [get] +// +// @Tags ExaCustomer +// @Summary 获取单一客户信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query example.ExaCustomer true "客户ID" +// @Success 200 {object} response.Response{data=exampleRes.ExaCustomerResponse,msg=string} "获取单一客户信息,返回包括客户详情" +// @Router /customer/customer [get] func (e *CustomerApi) GetExaCustomer(c *gin.Context) { var customer example.ExaCustomer err := c.ShouldBindQuery(&customer) @@ -141,14 +145,15 @@ func (e *CustomerApi) GetExaCustomer(c *gin.Context) { } // GetExaCustomerList -// @Tags ExaCustomer -// @Summary 分页获取权限客户列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query request.PageInfo true "页码, 每页大小" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取权限客户列表,返回包括列表,总数,页码,每页数量" -// @Router /customer/customerList [get] +// +// @Tags ExaCustomer +// @Summary 分页获取权限客户列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query request.PageInfo true "页码, 每页大小" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取权限客户列表,返回包括列表,总数,页码,每页数量" +// @Router /customer/customerList [get] func (e *CustomerApi) GetExaCustomerList(c *gin.Context) { var pageInfo request.PageInfo err := c.ShouldBindQuery(&pageInfo) diff --git a/server/api/v1/example/exa_file_upload_download.go b/server/api/v1/example/exa_file_upload_download.go index 18d1251240..2fe2a5e40d 100644 --- a/server/api/v1/example/exa_file_upload_download.go +++ b/server/api/v1/example/exa_file_upload_download.go @@ -13,14 +13,15 @@ import ( type FileUploadAndDownloadApi struct{} // UploadFile -// @Tags ExaFileUploadAndDownload -// @Summary 上传文件示例 -// @Security ApiKeyAuth -// @accept multipart/form-data -// @Produce application/json -// @Param file formData file true "上传文件示例" -// @Success 200 {object} response.Response{data=exampleRes.ExaFileResponse,msg=string} "上传文件示例,返回包括文件详情" -// @Router /fileUploadAndDownload/upload [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 上传文件示例 +// @Security ApiKeyAuth +// @accept multipart/form-data +// @Produce application/json +// @Param file formData file true "上传文件示例" +// @Success 200 {object} response.Response{data=exampleRes.ExaFileResponse,msg=string} "上传文件示例,返回包括文件详情" +// @Router /fileUploadAndDownload/upload [post] func (b *FileUploadAndDownloadApi) UploadFile(c *gin.Context) { var file example.ExaFileUploadAndDownload noSave := c.DefaultQuery("noSave", "0") @@ -57,13 +58,14 @@ func (b *FileUploadAndDownloadApi) EditFileName(c *gin.Context) { } // DeleteFile -// @Tags ExaFileUploadAndDownload -// @Summary 删除文件 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body example.ExaFileUploadAndDownload true "传入文件里面id即可" -// @Success 200 {object} response.Response{msg=string} "删除文件" -// @Router /fileUploadAndDownload/deleteFile [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 删除文件 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body example.ExaFileUploadAndDownload true "传入文件里面id即可" +// @Success 200 {object} response.Response{msg=string} "删除文件" +// @Router /fileUploadAndDownload/deleteFile [post] func (b *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) { var file example.ExaFileUploadAndDownload err := c.ShouldBindJSON(&file) @@ -80,14 +82,15 @@ func (b *FileUploadAndDownloadApi) DeleteFile(c *gin.Context) { } // GetFileList -// @Tags ExaFileUploadAndDownload -// @Summary 分页文件列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页文件列表,返回包括列表,总数,页码,每页数量" -// @Router /fileUploadAndDownload/getFileList [post] +// +// @Tags ExaFileUploadAndDownload +// @Summary 分页文件列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.PageInfo true "页码, 每页大小" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页文件列表,返回包括列表,总数,页码,每页数量" +// @Router /fileUploadAndDownload/getFileList [post] func (b *FileUploadAndDownloadApi) GetFileList(c *gin.Context) { var pageInfo request.PageInfo err := c.ShouldBindJSON(&pageInfo) diff --git a/server/api/v1/system/sys_api.go b/server/api/v1/system/sys_api.go index 1a61d3b029..a5da9dd5e1 100644 --- a/server/api/v1/system/sys_api.go +++ b/server/api/v1/system/sys_api.go @@ -16,14 +16,15 @@ import ( type SystemApiApi struct{} // CreateApi -// @Tags SysApi -// @Summary 创建基础api -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysApi true "api路径, api中文描述, api组, 方法" -// @Success 200 {object} response.Response{msg=string} "创建基础api" -// @Router /api/createApi [post] +// +// @Tags SysApi +// @Summary 创建基础api +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysApi true "api路径, api中文描述, api组, 方法" +// @Success 200 {object} response.Response{msg=string} "创建基础api" +// @Router /api/createApi [post] func (s *SystemApiApi) CreateApi(c *gin.Context) { var api system.SysApi err := c.ShouldBindJSON(&api) @@ -46,14 +47,15 @@ func (s *SystemApiApi) CreateApi(c *gin.Context) { } // DeleteApi -// @Tags SysApi -// @Summary 删除api -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysApi true "ID" -// @Success 200 {object} response.Response{msg=string} "删除api" -// @Router /api/deleteApi [post] +// +// @Tags SysApi +// @Summary 删除api +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysApi true "ID" +// @Success 200 {object} response.Response{msg=string} "删除api" +// @Router /api/deleteApi [post] func (s *SystemApiApi) DeleteApi(c *gin.Context) { var api system.SysApi err := c.ShouldBindJSON(&api) @@ -76,14 +78,15 @@ func (s *SystemApiApi) DeleteApi(c *gin.Context) { } // GetApiList -// @Tags SysApi -// @Summary 分页获取API列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body systemReq.SearchApiParams true "分页获取API列表" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取API列表,返回包括列表,总数,页码,每页数量" -// @Router /api/getApiList [post] +// +// @Tags SysApi +// @Summary 分页获取API列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.SearchApiParams true "分页获取API列表" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取API列表,返回包括列表,总数,页码,每页数量" +// @Router /api/getApiList [post] func (s *SystemApiApi) GetApiList(c *gin.Context) { var pageInfo systemReq.SearchApiParams err := c.ShouldBindJSON(&pageInfo) @@ -111,14 +114,15 @@ func (s *SystemApiApi) GetApiList(c *gin.Context) { } // GetApiById -// @Tags SysApi -// @Summary 根据id获取api -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetById true "根据id获取api" -// @Success 200 {object} response.Response{data=systemRes.SysAPIResponse} "根据id获取api,返回包括api详情" -// @Router /api/getApiById [post] +// +// @Tags SysApi +// @Summary 根据id获取api +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetById true "根据id获取api" +// @Success 200 {object} response.Response{data=systemRes.SysAPIResponse} "根据id获取api,返回包括api详情" +// @Router /api/getApiById [post] func (s *SystemApiApi) GetApiById(c *gin.Context) { var idInfo request.GetById err := c.ShouldBindJSON(&idInfo) @@ -141,14 +145,15 @@ func (s *SystemApiApi) GetApiById(c *gin.Context) { } // UpdateApi -// @Tags SysApi -// @Summary 修改基础api -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysApi true "api路径, api中文描述, api组, 方法" -// @Success 200 {object} response.Response{msg=string} "修改基础api" -// @Router /api/updateApi [post] +// +// @Tags SysApi +// @Summary 修改基础api +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysApi true "api路径, api中文描述, api组, 方法" +// @Success 200 {object} response.Response{msg=string} "修改基础api" +// @Router /api/updateApi [post] func (s *SystemApiApi) UpdateApi(c *gin.Context) { var api system.SysApi err := c.ShouldBindJSON(&api) @@ -171,13 +176,14 @@ func (s *SystemApiApi) UpdateApi(c *gin.Context) { } // GetAllApis -// @Tags SysApi -// @Summary 获取所有的Api 不分页 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=systemRes.SysAPIListResponse,msg=string} "获取所有的Api 不分页,返回包括api列表" -// @Router /api/getAllApis [post] +// +// @Tags SysApi +// @Summary 获取所有的Api 不分页 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=systemRes.SysAPIListResponse,msg=string} "获取所有的Api 不分页,返回包括api列表" +// @Router /api/getAllApis [post] func (s *SystemApiApi) GetAllApis(c *gin.Context) { apis, err := apiService.GetAllApis() if err != nil { @@ -189,14 +195,15 @@ func (s *SystemApiApi) GetAllApis(c *gin.Context) { } // DeleteApisByIds -// @Tags SysApi -// @Summary 删除选中Api -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.IdsReq true "ID" -// @Success 200 {object} response.Response{msg=string} "删除选中Api" -// @Router /api/deleteApisByIds [delete] +// +// @Tags SysApi +// @Summary 删除选中Api +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "ID" +// @Success 200 {object} response.Response{msg=string} "删除选中Api" +// @Router /api/deleteApisByIds [delete] func (s *SystemApiApi) DeleteApisByIds(c *gin.Context) { var ids request.IdsReq err := c.ShouldBindJSON(&ids) @@ -214,12 +221,13 @@ func (s *SystemApiApi) DeleteApisByIds(c *gin.Context) { } // FreshCasbin -// @Tags SysApi -// @Summary 刷新casbin缓存 -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{msg=string} "刷新成功" -// @Router /api/freshCasbin [get] +// +// @Tags SysApi +// @Summary 刷新casbin缓存 +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{msg=string} "刷新成功" +// @Router /api/freshCasbin [get] func (s *SystemApiApi) FreshCasbin(c *gin.Context) { err := casbinService.FreshCasbin() if err != nil { diff --git a/server/api/v1/system/sys_authority.go b/server/api/v1/system/sys_authority.go index 9fcbddee58..fd3bf05b19 100644 --- a/server/api/v1/system/sys_authority.go +++ b/server/api/v1/system/sys_authority.go @@ -5,6 +5,7 @@ import ( "github.com/flipped-aurora/gin-vue-admin/server/model/common/request" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" "github.com/flipped-aurora/gin-vue-admin/server/model/system" + systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request" systemRes "github.com/flipped-aurora/gin-vue-admin/server/model/system/response" "github.com/flipped-aurora/gin-vue-admin/server/utils" @@ -15,14 +16,15 @@ import ( type AuthorityApi struct{} // CreateAuthority -// @Tags Authority -// @Summary 创建角色 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id" -// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "创建角色,返回包括系统角色详情" -// @Router /authority/createAuthority [post] +// +// @Tags Authority +// @Summary 创建角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id" +// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "创建角色,返回包括系统角色详情" +// @Router /authority/createAuthority [post] func (a *AuthorityApi) CreateAuthority(c *gin.Context) { var authority, authBack system.SysAuthority var err error @@ -52,49 +54,51 @@ func (a *AuthorityApi) CreateAuthority(c *gin.Context) { } // CopyAuthority -// @Tags Authority -// @Summary 拷贝角色 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body response.SysAuthorityCopyResponse true "旧角色id, 新权限id, 新权限名, 新父角色id" -// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "拷贝角色,返回包括系统角色详情" -// @Router /authority/copyAuthority [post] +// +// @Tags Authority +// @Summary 拷贝角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.AuthorityCopy true "旧角色id, 新权限id, 新权限名, 新父角色id" +// @Success 200 {object} response.Response{msg=string} "拷贝角色,返回包括系统角色详情" +// @Router /authority/copyAuthority [post] func (a *AuthorityApi) CopyAuthority(c *gin.Context) { - var copyInfo systemRes.SysAuthorityCopyResponse - err := c.ShouldBindJSON(©Info) + var info systemReq.AuthorityCopy + err := c.ShouldBindJSON(&info) if err != nil { response.FailWithMessage(err.Error(), c) return } - err = utils.Verify(copyInfo, utils.OldAuthorityVerify) + err = utils.Verify(info, utils.OldAuthorityVerify) if err != nil { response.FailWithMessage(err.Error(), c) return } - err = utils.Verify(copyInfo.Authority, utils.AuthorityVerify) + err = utils.Verify(info.Authority, utils.AuthorityVerify) if err != nil { response.FailWithMessage(err.Error(), c) return } - authBack, err := authorityService.CopyAuthority(copyInfo) + err = authorityService.Copy(c.Request.Context(), info) if err != nil { global.GVA_LOG.Error("拷贝失败!", zap.Error(err)) response.FailWithMessage("拷贝失败"+err.Error(), c) return } - response.OkWithDetailed(systemRes.SysAuthorityResponse{Authority: authBack}, "拷贝成功", c) + response.OkWithMessage("拷贝成功", c) } // DeleteAuthority -// @Tags Authority -// @Summary 删除角色 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAuthority true "删除角色" -// @Success 200 {object} response.Response{msg=string} "删除角色" -// @Router /authority/deleteAuthority [post] +// +// @Tags Authority +// @Summary 删除角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAuthority true "删除角色" +// @Success 200 {object} response.Response{msg=string} "删除角色" +// @Router /authority/deleteAuthority [post] func (a *AuthorityApi) DeleteAuthority(c *gin.Context) { var authority system.SysAuthority var err error @@ -117,14 +121,15 @@ func (a *AuthorityApi) DeleteAuthority(c *gin.Context) { } // UpdateAuthority -// @Tags Authority -// @Summary 更新角色信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id" -// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "更新角色信息,返回包括系统角色详情" -// @Router /authority/updateAuthority [post] +// +// @Tags Authority +// @Summary 更新角色信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAuthority true "权限id, 权限名, 父角色id" +// @Success 200 {object} response.Response{data=systemRes.SysAuthorityResponse,msg=string} "更新角色信息,返回包括系统角色详情" +// @Router /authority/updateAuthority [post] func (a *AuthorityApi) UpdateAuthority(c *gin.Context) { var auth system.SysAuthority err := c.ShouldBindJSON(&auth) @@ -147,14 +152,15 @@ func (a *AuthorityApi) UpdateAuthority(c *gin.Context) { } // GetAuthorityList -// @Tags Authority -// @Summary 分页获取角色列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取角色列表,返回包括列表,总数,页码,每页数量" -// @Router /authority/getAuthorityList [post] +// +// @Tags Authority +// @Summary 分页获取角色列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.PageInfo true "页码, 每页大小" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取角色列表,返回包括列表,总数,页码,每页数量" +// @Router /authority/getAuthorityList [post] func (a *AuthorityApi) GetAuthorityList(c *gin.Context) { var pageInfo request.PageInfo err := c.ShouldBindJSON(&pageInfo) @@ -182,14 +188,15 @@ func (a *AuthorityApi) GetAuthorityList(c *gin.Context) { } // SetDataAuthority -// @Tags Authority -// @Summary 设置角色资源权限 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAuthority true "设置角色资源权限" -// @Success 200 {object} response.Response{msg=string} "设置角色资源权限" -// @Router /authority/setDataAuthority [post] +// +// @Tags Authority +// @Summary 设置角色资源权限 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAuthority true "设置角色资源权限" +// @Success 200 {object} response.Response{msg=string} "设置角色资源权限" +// @Router /authority/setDataAuthority [post] func (a *AuthorityApi) SetDataAuthority(c *gin.Context) { var auth system.SysAuthority err := c.ShouldBindJSON(&auth) diff --git a/server/api/v1/system/sys_authority_btn.go b/server/api/v1/system/sys_authority_btn.go index 94f02a00e2..0e07e9cb36 100644 --- a/server/api/v1/system/sys_authority_btn.go +++ b/server/api/v1/system/sys_authority_btn.go @@ -11,14 +11,15 @@ import ( type AuthorityBtnApi struct{} // GetAuthorityBtn -// @Tags AuthorityBtn -// @Summary 获取权限按钮 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.SysAuthorityBtnReq true "菜单id, 角色id, 选中的按钮id" -// @Success 200 {object} response.Response{data=response.SysAuthorityBtnRes,msg=string} "返回列表成功" -// @Router /authorityBtn/getAuthorityBtn [post] +// +// @Tags AuthorityBtn +// @Summary 获取权限按钮 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.SysAuthorityBtnReq true "菜单id, 角色id, 选中的按钮id" +// @Success 200 {object} response.Response{data=response.SysAuthorityBtnRes,msg=string} "返回列表成功" +// @Router /authorityBtn/getAuthorityBtn [post] func (a *AuthorityBtnApi) GetAuthorityBtn(c *gin.Context) { var req request.SysAuthorityBtnReq err := c.ShouldBindJSON(&req) @@ -36,14 +37,15 @@ func (a *AuthorityBtnApi) GetAuthorityBtn(c *gin.Context) { } // SetAuthorityBtn -// @Tags AuthorityBtn -// @Summary 设置权限按钮 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.SysAuthorityBtnReq true "菜单id, 角色id, 选中的按钮id" -// @Success 200 {object} response.Response{msg=string} "返回列表成功" -// @Router /authorityBtn/setAuthorityBtn [post] +// +// @Tags AuthorityBtn +// @Summary 设置权限按钮 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.SysAuthorityBtnReq true "菜单id, 角色id, 选中的按钮id" +// @Success 200 {object} response.Response{msg=string} "返回列表成功" +// @Router /authorityBtn/setAuthorityBtn [post] func (a *AuthorityBtnApi) SetAuthorityBtn(c *gin.Context) { var req request.SysAuthorityBtnReq err := c.ShouldBindJSON(&req) @@ -61,13 +63,14 @@ func (a *AuthorityBtnApi) SetAuthorityBtn(c *gin.Context) { } // CanRemoveAuthorityBtn -// @Tags AuthorityBtn -// @Summary 设置权限按钮 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{msg=string} "删除成功" -// @Router /authorityBtn/canRemoveAuthorityBtn [post] +// +// @Tags AuthorityBtn +// @Summary 设置权限按钮 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{msg=string} "删除成功" +// @Router /authorityBtn/canRemoveAuthorityBtn [post] func (a *AuthorityBtnApi) CanRemoveAuthorityBtn(c *gin.Context) { id := c.Query("id") err := authorityBtnService.CanRemoveAuthorityBtn(id) diff --git a/server/api/v1/system/sys_auto_code.go b/server/api/v1/system/sys_auto_code.go index 7f2d365e0c..2b4e0a0dd3 100644 --- a/server/api/v1/system/sys_auto_code.go +++ b/server/api/v1/system/sys_auto_code.go @@ -17,14 +17,15 @@ import ( type AutoCodeApi struct{} // PreviewTemp -// @Tags AutoCode -// @Summary 预览创建后的代码 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.AutoCodeStruct true "预览创建代码" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "预览创建后的代码" -// @Router /autoCode/preview [post] +// +// @Tags AutoCode +// @Summary 预览创建后的代码 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.AutoCodeStruct true "预览创建代码" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "预览创建后的代码" +// @Router /autoCode/preview [post] func (autoApi *AutoCodeApi) PreviewTemp(c *gin.Context) { var a system.AutoCodeStruct _ = c.ShouldBindJSON(&a) @@ -44,14 +45,15 @@ func (autoApi *AutoCodeApi) PreviewTemp(c *gin.Context) { } // CreateTemp -// @Tags AutoCode -// @Summary 自动代码模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.AutoCodeStruct true "创建自动代码" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" -// @Router /autoCode/createTemp [post] +// +// @Tags AutoCode +// @Summary 自动代码模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.AutoCodeStruct true "创建自动代码" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Router /autoCode/createTemp [post] func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) { var a system.AutoCodeStruct _ = c.ShouldBindJSON(&a) @@ -93,13 +95,14 @@ func (autoApi *AutoCodeApi) CreateTemp(c *gin.Context) { } // GetDB -// @Tags AutoCode -// @Summary 获取当前所有数据库 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前所有数据库" -// @Router /autoCode/getDatabase [get] +// +// @Tags AutoCode +// @Summary 获取当前所有数据库 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前所有数据库" +// @Router /autoCode/getDatabase [get] func (autoApi *AutoCodeApi) GetDB(c *gin.Context) { businessDB := c.Query("businessDB") dbs, err := autoCodeService.Database(businessDB).GetDB(businessDB) @@ -121,13 +124,14 @@ func (autoApi *AutoCodeApi) GetDB(c *gin.Context) { } // GetTables -// @Tags AutoCode -// @Summary 获取当前数据库所有表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前数据库所有表" -// @Router /autoCode/getTables [get] +// +// @Tags AutoCode +// @Summary 获取当前数据库所有表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前数据库所有表" +// @Router /autoCode/getTables [get] func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) businessDB := c.Query("businessDB") @@ -141,13 +145,14 @@ func (autoApi *AutoCodeApi) GetTables(c *gin.Context) { } // GetColumn -// @Tags AutoCode -// @Summary 获取当前表所有字段 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前表所有字段" -// @Router /autoCode/getColumn [get] +// +// @Tags AutoCode +// @Summary 获取当前表所有字段 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取当前表所有字段" +// @Router /autoCode/getColumn [get] func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) { businessDB := c.Query("businessDB") dbName := c.DefaultQuery("dbName", global.GVA_CONFIG.Mysql.Dbname) @@ -162,14 +167,15 @@ func (autoApi *AutoCodeApi) GetColumn(c *gin.Context) { } // CreatePackage -// @Tags AutoCode -// @Summary 创建package -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAutoCode true "创建package" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功" -// @Router /autoCode/createPackage [post] +// +// @Tags AutoCode +// @Summary 创建package +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAutoCode true "创建package" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功" +// @Router /autoCode/createPackage [post] func (autoApi *AutoCodeApi) CreatePackage(c *gin.Context) { var a system.SysAutoCode _ = c.ShouldBindJSON(&a) @@ -194,13 +200,14 @@ func (autoApi *AutoCodeApi) CreatePackage(c *gin.Context) { } // GetPackage -// @Tags AutoCode -// @Summary 获取package -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功" -// @Router /autoCode/getPackage [post] +// +// @Tags AutoCode +// @Summary 获取package +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建package成功" +// @Router /autoCode/getPackage [post] func (autoApi *AutoCodeApi) GetPackage(c *gin.Context) { pkgs, err := autoCodeService.GetPackage() if err != nil { @@ -212,14 +219,15 @@ func (autoApi *AutoCodeApi) GetPackage(c *gin.Context) { } // DelPackage -// @Tags AutoCode -// @Summary 删除package -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAutoCode true "创建package" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "删除package成功" -// @Router /autoCode/delPackage [post] +// +// @Tags AutoCode +// @Summary 删除package +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAutoCode true "创建package" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "删除package成功" +// @Router /autoCode/delPackage [post] func (autoApi *AutoCodeApi) DelPackage(c *gin.Context) { var a system.SysAutoCode _ = c.ShouldBindJSON(&a) @@ -233,14 +241,15 @@ func (autoApi *AutoCodeApi) DelPackage(c *gin.Context) { } // AutoPlug -// @Tags AutoCode -// @Summary 创建插件模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAutoCode true "创建插件模板" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建插件模板成功" -// @Router /autoCode/createPlug [post] +// +// @Tags AutoCode +// @Summary 创建插件模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAutoCode true "创建插件模板" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "创建插件模板成功" +// @Router /autoCode/createPlug [post] func (autoApi *AutoCodeApi) AutoPlug(c *gin.Context) { var a system.AutoPlugReq err := c.ShouldBindJSON(&a) @@ -265,14 +274,15 @@ func (autoApi *AutoCodeApi) AutoPlug(c *gin.Context) { } // InstallPlugin -// @Tags AutoCode -// @Summary 安装插件 -// @Security ApiKeyAuth -// @accept multipart/form-data -// @Produce application/json -// @Param plug formData file true "this is a test file" -// @Success 200 {object} response.Response{data=[]interface{},msg=string} "安装插件成功" -// @Router /autoCode/installPlugin [post] +// +// @Tags AutoCode +// @Summary 安装插件 +// @Security ApiKeyAuth +// @accept multipart/form-data +// @Produce application/json +// @Param plug formData file true "this is a test file" +// @Success 200 {object} response.Response{data=[]interface{},msg=string} "安装插件成功" +// @Router /autoCode/installPlugin [post] func (autoApi *AutoCodeApi) InstallPlugin(c *gin.Context) { header, err := c.FormFile("plug") if err != nil { @@ -304,14 +314,15 @@ func (autoApi *AutoCodeApi) InstallPlugin(c *gin.Context) { } // PubPlug -// @Tags AutoCode -// @Summary 打包插件 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysAutoCode true "打包插件" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功" -// @Router /autoCode/pubPlug [get] +// +// @Tags AutoCode +// @Summary 打包插件 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysAutoCode true "打包插件" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "打包插件成功" +// @Router /autoCode/pubPlug [get] func (autoApi *AutoCodeApi) PubPlug(c *gin.Context) { plugName := c.Query("plugName") zipPath, err := autoCodeService.PubPlug(plugName) diff --git a/server/api/v1/system/sys_auto_code_history.go b/server/api/v1/system/sys_auto_code_history.go index 4ad6b5e470..18024a04ae 100644 --- a/server/api/v1/system/sys_auto_code_history.go +++ b/server/api/v1/system/sys_auto_code_history.go @@ -12,14 +12,15 @@ import ( type AutoCodeHistoryApi struct{} // First -// @Tags AutoCode -// @Summary 获取meta信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetById true "请求参数" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取meta信息" -// @Router /autoCode/getMeta [post] +// +// @Tags AutoCode +// @Summary 获取meta信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetById true "请求参数" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取meta信息" +// @Router /autoCode/getMeta [post] func (a *AutoCodeHistoryApi) First(c *gin.Context) { var info request.GetById err := c.ShouldBindJSON(&info) @@ -36,14 +37,15 @@ func (a *AutoCodeHistoryApi) First(c *gin.Context) { } // Delete -// @Tags AutoCode -// @Summary 删除回滚记录 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetById true "请求参数" -// @Success 200 {object} response.Response{msg=string} "删除回滚记录" -// @Router /autoCode/delSysHistory [post] +// +// @Tags AutoCode +// @Summary 删除回滚记录 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetById true "请求参数" +// @Success 200 {object} response.Response{msg=string} "删除回滚记录" +// @Router /autoCode/delSysHistory [post] func (a *AutoCodeHistoryApi) Delete(c *gin.Context) { var info request.GetById err := c.ShouldBindJSON(&info) @@ -61,14 +63,15 @@ func (a *AutoCodeHistoryApi) Delete(c *gin.Context) { } // RollBack -// @Tags AutoCode -// @Summary 回滚自动生成代码 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body systemReq.RollBack true "请求参数" -// @Success 200 {object} response.Response{msg=string} "回滚自动生成代码" -// @Router /autoCode/rollback [post] +// +// @Tags AutoCode +// @Summary 回滚自动生成代码 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.RollBack true "请求参数" +// @Success 200 {object} response.Response{msg=string} "回滚自动生成代码" +// @Router /autoCode/rollback [post] func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) { var info systemReq.RollBack err := c.ShouldBindJSON(&info) @@ -85,14 +88,15 @@ func (a *AutoCodeHistoryApi) RollBack(c *gin.Context) { } // GetList -// @Tags AutoCode -// @Summary 查询回滚记录 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body systemReq.SysAutoHistory true "请求参数" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "查询回滚记录,返回包括列表,总数,页码,每页数量" -// @Router /autoCode/getSysHistory [post] +// +// @Tags AutoCode +// @Summary 查询回滚记录 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.SysAutoHistory true "请求参数" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "查询回滚记录,返回包括列表,总数,页码,每页数量" +// @Router /autoCode/getSysHistory [post] func (a *AutoCodeHistoryApi) GetList(c *gin.Context) { var search systemReq.SysAutoHistory err := c.ShouldBindJSON(&search) diff --git a/server/api/v1/system/sys_captcha.go b/server/api/v1/system/sys_captcha.go index b9f2110ecf..f275df9ab2 100644 --- a/server/api/v1/system/sys_captcha.go +++ b/server/api/v1/system/sys_captcha.go @@ -18,13 +18,14 @@ var store = base64Captcha.DefaultMemStore type BaseApi struct{} // Captcha -// @Tags Base -// @Summary 生成验证码 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=systemRes.SysCaptchaResponse,msg=string} "生成验证码,返回包括随机数id,base64,验证码长度,是否开启验证码" -// @Router /base/captcha [post] +// +// @Tags Base +// @Summary 生成验证码 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=systemRes.SysCaptchaResponse,msg=string} "生成验证码,返回包括随机数id,base64,验证码长度,是否开启验证码" +// @Router /base/captcha [post] func (b *BaseApi) Captcha(c *gin.Context) { // 判断验证码是否开启 openCaptcha := global.GVA_CONFIG.Captcha.OpenCaptcha // 是否开启防爆次数 diff --git a/server/api/v1/system/sys_casbin.go b/server/api/v1/system/sys_casbin.go index 632718e2cf..0e639a28d8 100644 --- a/server/api/v1/system/sys_casbin.go +++ b/server/api/v1/system/sys_casbin.go @@ -13,14 +13,15 @@ import ( type CasbinApi struct{} // UpdateCasbin -// @Tags Casbin -// @Summary 更新角色api权限 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.CasbinInReceive true "权限id, 权限模型列表" -// @Success 200 {object} response.Response{msg=string} "更新角色api权限" -// @Router /casbin/UpdateCasbin [post] +// +// @Tags Casbin +// @Summary 更新角色api权限 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.CasbinInReceive true "权限id, 权限模型列表" +// @Success 200 {object} response.Response{msg=string} "更新角色api权限" +// @Router /casbin/UpdateCasbin [post] func (cas *CasbinApi) UpdateCasbin(c *gin.Context) { var cmr request.CasbinInReceive err := c.ShouldBindJSON(&cmr) @@ -43,14 +44,15 @@ func (cas *CasbinApi) UpdateCasbin(c *gin.Context) { } // GetPolicyPathByAuthorityId -// @Tags Casbin -// @Summary 获取权限列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.CasbinInReceive true "权限id, 权限模型列表" -// @Success 200 {object} response.Response{data=systemRes.PolicyPathResponse,msg=string} "获取权限列表,返回包括casbin详情列表" -// @Router /casbin/getPolicyPathByAuthorityId [post] +// +// @Tags Casbin +// @Summary 获取权限列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.CasbinInReceive true "权限id, 权限模型列表" +// @Success 200 {object} response.Response{data=systemRes.PolicyPathResponse,msg=string} "获取权限列表,返回包括casbin详情列表" +// @Router /casbin/getPolicyPathByAuthorityId [post] func (cas *CasbinApi) GetPolicyPathByAuthorityId(c *gin.Context) { var casbin request.CasbinInReceive err := c.ShouldBindJSON(&casbin) diff --git a/server/api/v1/system/sys_dictionary.go b/server/api/v1/system/sys_dictionary.go index 1dfe9d0899..d92e46b0d7 100644 --- a/server/api/v1/system/sys_dictionary.go +++ b/server/api/v1/system/sys_dictionary.go @@ -11,14 +11,15 @@ import ( type DictionaryApi struct{} // CreateSysDictionary -// @Tags SysDictionary -// @Summary 创建SysDictionary -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysDictionary true "SysDictionary模型" -// @Success 200 {object} response.Response{msg=string} "创建SysDictionary" -// @Router /sysDictionary/createSysDictionary [post] +// +// @Tags SysDictionary +// @Summary 创建SysDictionary +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysDictionary true "SysDictionary模型" +// @Success 200 {object} response.Response{msg=string} "创建SysDictionary" +// @Router /sysDictionary/createSysDictionary [post] func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) { var dictionary system.SysDictionary err := c.ShouldBindJSON(&dictionary) @@ -36,14 +37,15 @@ func (s *DictionaryApi) CreateSysDictionary(c *gin.Context) { } // DeleteSysDictionary -// @Tags SysDictionary -// @Summary 删除SysDictionary -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysDictionary true "SysDictionary模型" -// @Success 200 {object} response.Response{msg=string} "删除SysDictionary" -// @Router /sysDictionary/deleteSysDictionary [delete] +// +// @Tags SysDictionary +// @Summary 删除SysDictionary +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysDictionary true "SysDictionary模型" +// @Success 200 {object} response.Response{msg=string} "删除SysDictionary" +// @Router /sysDictionary/deleteSysDictionary [delete] func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) { var dictionary system.SysDictionary err := c.ShouldBindJSON(&dictionary) @@ -61,14 +63,15 @@ func (s *DictionaryApi) DeleteSysDictionary(c *gin.Context) { } // UpdateSysDictionary -// @Tags SysDictionary -// @Summary 更新SysDictionary -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysDictionary true "SysDictionary模型" -// @Success 200 {object} response.Response{msg=string} "更新SysDictionary" -// @Router /sysDictionary/updateSysDictionary [put] +// +// @Tags SysDictionary +// @Summary 更新SysDictionary +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysDictionary true "SysDictionary模型" +// @Success 200 {object} response.Response{msg=string} "更新SysDictionary" +// @Router /sysDictionary/updateSysDictionary [put] func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) { var dictionary system.SysDictionary err := c.ShouldBindJSON(&dictionary) @@ -86,14 +89,15 @@ func (s *DictionaryApi) UpdateSysDictionary(c *gin.Context) { } // FindSysDictionary -// @Tags SysDictionary -// @Summary 用id查询SysDictionary -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query system.SysDictionary true "ID或字典英名" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "用id查询SysDictionary" -// @Router /sysDictionary/findSysDictionary [get] +// +// @Tags SysDictionary +// @Summary 用id查询SysDictionary +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query system.SysDictionary true "ID或字典英名" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "用id查询SysDictionary" +// @Router /sysDictionary/findSysDictionary [get] func (s *DictionaryApi) FindSysDictionary(c *gin.Context) { var dictionary system.SysDictionary err := c.ShouldBindQuery(&dictionary) @@ -111,13 +115,14 @@ func (s *DictionaryApi) FindSysDictionary(c *gin.Context) { } // GetSysDictionaryList -// @Tags SysDictionary -// @Summary 分页获取SysDictionary列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysDictionary列表,返回包括列表,总数,页码,每页数量" -// @Router /sysDictionary/getSysDictionaryList [get] +// +// @Tags SysDictionary +// @Summary 分页获取SysDictionary列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysDictionary列表,返回包括列表,总数,页码,每页数量" +// @Router /sysDictionary/getSysDictionaryList [get] func (s *DictionaryApi) GetSysDictionaryList(c *gin.Context) { list, err := dictionaryService.GetSysDictionaryInfoList() if err != nil { diff --git a/server/api/v1/system/sys_dictionary_detail.go b/server/api/v1/system/sys_dictionary_detail.go index 754af1be6a..ffe5365280 100644 --- a/server/api/v1/system/sys_dictionary_detail.go +++ b/server/api/v1/system/sys_dictionary_detail.go @@ -13,14 +13,15 @@ import ( type DictionaryDetailApi struct{} // CreateSysDictionaryDetail -// @Tags SysDictionaryDetail -// @Summary 创建SysDictionaryDetail -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysDictionaryDetail true "SysDictionaryDetail模型" -// @Success 200 {object} response.Response{msg=string} "创建SysDictionaryDetail" -// @Router /sysDictionaryDetail/createSysDictionaryDetail [post] +// +// @Tags SysDictionaryDetail +// @Summary 创建SysDictionaryDetail +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysDictionaryDetail true "SysDictionaryDetail模型" +// @Success 200 {object} response.Response{msg=string} "创建SysDictionaryDetail" +// @Router /sysDictionaryDetail/createSysDictionaryDetail [post] func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail err := c.ShouldBindJSON(&detail) @@ -38,14 +39,15 @@ func (s *DictionaryDetailApi) CreateSysDictionaryDetail(c *gin.Context) { } // DeleteSysDictionaryDetail -// @Tags SysDictionaryDetail -// @Summary 删除SysDictionaryDetail -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysDictionaryDetail true "SysDictionaryDetail模型" -// @Success 200 {object} response.Response{msg=string} "删除SysDictionaryDetail" -// @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete] +// +// @Tags SysDictionaryDetail +// @Summary 删除SysDictionaryDetail +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysDictionaryDetail true "SysDictionaryDetail模型" +// @Success 200 {object} response.Response{msg=string} "删除SysDictionaryDetail" +// @Router /sysDictionaryDetail/deleteSysDictionaryDetail [delete] func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail err := c.ShouldBindJSON(&detail) @@ -63,14 +65,15 @@ func (s *DictionaryDetailApi) DeleteSysDictionaryDetail(c *gin.Context) { } // UpdateSysDictionaryDetail -// @Tags SysDictionaryDetail -// @Summary 更新SysDictionaryDetail -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysDictionaryDetail true "更新SysDictionaryDetail" -// @Success 200 {object} response.Response{msg=string} "更新SysDictionaryDetail" -// @Router /sysDictionaryDetail/updateSysDictionaryDetail [put] +// +// @Tags SysDictionaryDetail +// @Summary 更新SysDictionaryDetail +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysDictionaryDetail true "更新SysDictionaryDetail" +// @Success 200 {object} response.Response{msg=string} "更新SysDictionaryDetail" +// @Router /sysDictionaryDetail/updateSysDictionaryDetail [put] func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail err := c.ShouldBindJSON(&detail) @@ -88,14 +91,15 @@ func (s *DictionaryDetailApi) UpdateSysDictionaryDetail(c *gin.Context) { } // FindSysDictionaryDetail -// @Tags SysDictionaryDetail -// @Summary 用id查询SysDictionaryDetail -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query system.SysDictionaryDetail true "用id查询SysDictionaryDetail" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "用id查询SysDictionaryDetail" -// @Router /sysDictionaryDetail/findSysDictionaryDetail [get] +// +// @Tags SysDictionaryDetail +// @Summary 用id查询SysDictionaryDetail +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query system.SysDictionaryDetail true "用id查询SysDictionaryDetail" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "用id查询SysDictionaryDetail" +// @Router /sysDictionaryDetail/findSysDictionaryDetail [get] func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) { var detail system.SysDictionaryDetail err := c.ShouldBindQuery(&detail) @@ -118,14 +122,15 @@ func (s *DictionaryDetailApi) FindSysDictionaryDetail(c *gin.Context) { } // GetSysDictionaryDetailList -// @Tags SysDictionaryDetail -// @Summary 分页获取SysDictionaryDetail列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query request.SysDictionaryDetailSearch true "页码, 每页大小, 搜索条件" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysDictionaryDetail列表,返回包括列表,总数,页码,每页数量" -// @Router /sysDictionaryDetail/getSysDictionaryDetailList [get] +// +// @Tags SysDictionaryDetail +// @Summary 分页获取SysDictionaryDetail列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query request.SysDictionaryDetailSearch true "页码, 每页大小, 搜索条件" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysDictionaryDetail列表,返回包括列表,总数,页码,每页数量" +// @Router /sysDictionaryDetail/getSysDictionaryDetailList [get] func (s *DictionaryDetailApi) GetSysDictionaryDetailList(c *gin.Context) { var pageInfo request.SysDictionaryDetailSearch err := c.ShouldBindQuery(&pageInfo) diff --git a/server/api/v1/system/sys_export_template.go b/server/api/v1/system/sys_export_template.go index 38b22965be..458301eac6 100644 --- a/server/api/v1/system/sys_export_template.go +++ b/server/api/v1/system/sys_export_template.go @@ -21,14 +21,15 @@ type SysExportTemplateApi struct { var sysExportTemplateService = service.ServiceGroupApp.SystemServiceGroup.SysExportTemplateService // CreateSysExportTemplate 创建导出模板 -// @Tags SysExportTemplate -// @Summary 创建导出模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysExportTemplate true "创建导出模板" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" -// @Router /sysExportTemplate/createSysExportTemplate [post] +// +// @Tags SysExportTemplate +// @Summary 创建导出模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysExportTemplate true "创建导出模板" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"创建成功"}" +// @Router /sysExportTemplate/createSysExportTemplate [post] func (sysExportTemplateApi *SysExportTemplateApi) CreateSysExportTemplate(c *gin.Context) { var sysExportTemplate system.SysExportTemplate err := c.ShouldBindJSON(&sysExportTemplate) @@ -52,14 +53,15 @@ func (sysExportTemplateApi *SysExportTemplateApi) CreateSysExportTemplate(c *gin } // DeleteSysExportTemplate 删除导出模板 -// @Tags SysExportTemplate -// @Summary 删除导出模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysExportTemplate true "删除导出模板" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" -// @Router /sysExportTemplate/deleteSysExportTemplate [delete] +// +// @Tags SysExportTemplate +// @Summary 删除导出模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysExportTemplate true "删除导出模板" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}" +// @Router /sysExportTemplate/deleteSysExportTemplate [delete] func (sysExportTemplateApi *SysExportTemplateApi) DeleteSysExportTemplate(c *gin.Context) { var sysExportTemplate system.SysExportTemplate err := c.ShouldBindJSON(&sysExportTemplate) @@ -76,14 +78,15 @@ func (sysExportTemplateApi *SysExportTemplateApi) DeleteSysExportTemplate(c *gin } // DeleteSysExportTemplateByIds 批量删除导出模板 -// @Tags SysExportTemplate -// @Summary 批量删除导出模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.IdsReq true "批量删除导出模板" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}" -// @Router /sysExportTemplate/deleteSysExportTemplateByIds [delete] +// +// @Tags SysExportTemplate +// @Summary 批量删除导出模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "批量删除导出模板" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"批量删除成功"}" +// @Router /sysExportTemplate/deleteSysExportTemplateByIds [delete] func (sysExportTemplateApi *SysExportTemplateApi) DeleteSysExportTemplateByIds(c *gin.Context) { var IDS request.IdsReq err := c.ShouldBindJSON(&IDS) @@ -100,14 +103,15 @@ func (sysExportTemplateApi *SysExportTemplateApi) DeleteSysExportTemplateByIds(c } // UpdateSysExportTemplate 更新导出模板 -// @Tags SysExportTemplate -// @Summary 更新导出模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysExportTemplate true "更新导出模板" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" -// @Router /sysExportTemplate/updateSysExportTemplate [put] +// +// @Tags SysExportTemplate +// @Summary 更新导出模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysExportTemplate true "更新导出模板" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"更新成功"}" +// @Router /sysExportTemplate/updateSysExportTemplate [put] func (sysExportTemplateApi *SysExportTemplateApi) UpdateSysExportTemplate(c *gin.Context) { var sysExportTemplate system.SysExportTemplate err := c.ShouldBindJSON(&sysExportTemplate) @@ -131,14 +135,15 @@ func (sysExportTemplateApi *SysExportTemplateApi) UpdateSysExportTemplate(c *gin } // FindSysExportTemplate 用id查询导出模板 -// @Tags SysExportTemplate -// @Summary 用id查询导出模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query system.SysExportTemplate true "用id查询导出模板" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" -// @Router /sysExportTemplate/findSysExportTemplate [get] +// +// @Tags SysExportTemplate +// @Summary 用id查询导出模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query system.SysExportTemplate true "用id查询导出模板" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"查询成功"}" +// @Router /sysExportTemplate/findSysExportTemplate [get] func (sysExportTemplateApi *SysExportTemplateApi) FindSysExportTemplate(c *gin.Context) { var sysExportTemplate system.SysExportTemplate err := c.ShouldBindQuery(&sysExportTemplate) @@ -155,14 +160,15 @@ func (sysExportTemplateApi *SysExportTemplateApi) FindSysExportTemplate(c *gin.C } // GetSysExportTemplateList 分页获取导出模板列表 -// @Tags SysExportTemplate -// @Summary 分页获取导出模板列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query systemReq.SysExportTemplateSearch true "分页获取导出模板列表" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" -// @Router /sysExportTemplate/getSysExportTemplateList [get] +// +// @Tags SysExportTemplate +// @Summary 分页获取导出模板列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query systemReq.SysExportTemplateSearch true "分页获取导出模板列表" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" +// @Router /sysExportTemplate/getSysExportTemplateList [get] func (sysExportTemplateApi *SysExportTemplateApi) GetSysExportTemplateList(c *gin.Context) { var pageInfo systemReq.SysExportTemplateSearch err := c.ShouldBindQuery(&pageInfo) @@ -184,12 +190,13 @@ func (sysExportTemplateApi *SysExportTemplateApi) GetSysExportTemplateList(c *gi } // ExportExcel 导出表格 -// @Tags SysExportTemplate -// @Summary 导出表格 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Router /sysExportTemplate/exportExcel [get] +// +// @Tags SysExportTemplate +// @Summary 导出表格 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Router /sysExportTemplate/exportExcel [get] func (sysExportTemplateApi *SysExportTemplateApi) ExportExcel(c *gin.Context) { templateID := c.Query("templateID") queryParams := c.Request.URL.Query() @@ -208,12 +215,13 @@ func (sysExportTemplateApi *SysExportTemplateApi) ExportExcel(c *gin.Context) { } // ExportTemplate 导出表格模板 -// @Tags SysExportTemplate -// @Summary 导出表格模板 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Router /sysExportTemplate/exportExcel [get] +// +// @Tags SysExportTemplate +// @Summary 导出表格模板 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Router /sysExportTemplate/exportExcel [get] func (sysExportTemplateApi *SysExportTemplateApi) ExportTemplate(c *gin.Context) { templateID := c.Query("templateID") if templateID == "" { @@ -231,12 +239,13 @@ func (sysExportTemplateApi *SysExportTemplateApi) ExportTemplate(c *gin.Context) } // ImportExcel 导入表格 -// @Tags SysImportTemplate -// @Summary 导入表格 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Router /sysExportTemplate/importExcel [post] +// +// @Tags SysImportTemplate +// @Summary 导入表格 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Router /sysExportTemplate/importExcel [post] func (sysExportTemplateApi *SysExportTemplateApi) ImportExcel(c *gin.Context) { templateID := c.Query("templateID") if templateID == "" { diff --git a/server/api/v1/system/sys_initdb.go b/server/api/v1/system/sys_initdb.go index 5f740c6dc0..54c788baec 100644 --- a/server/api/v1/system/sys_initdb.go +++ b/server/api/v1/system/sys_initdb.go @@ -12,12 +12,13 @@ import ( type DBApi struct{} // InitDB -// @Tags InitDB -// @Summary 初始化用户数据库 -// @Produce application/json -// @Param data body request.InitDB true "初始化数据库参数" -// @Success 200 {object} response.Response{data=string} "初始化用户数据库" -// @Router /init/initdb [post] +// +// @Tags InitDB +// @Summary 初始化用户数据库 +// @Produce application/json +// @Param data body request.InitDB true "初始化数据库参数" +// @Success 200 {object} response.Response{data=string} "初始化用户数据库" +// @Router /init/initdb [post] func (i *DBApi) InitDB(c *gin.Context) { if global.GVA_DB != nil { global.GVA_LOG.Error("已存在数据库配置!") @@ -39,11 +40,12 @@ func (i *DBApi) InitDB(c *gin.Context) { } // CheckDB -// @Tags CheckDB -// @Summary 初始化用户数据库 -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "初始化用户数据库" -// @Router /init/checkdb [post] +// +// @Tags CheckDB +// @Summary 初始化用户数据库 +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "初始化用户数据库" +// @Router /init/checkdb [post] func (i *DBApi) CheckDB(c *gin.Context) { var ( message = "前往初始化数据库" diff --git a/server/api/v1/system/sys_jwt_blacklist.go b/server/api/v1/system/sys_jwt_blacklist.go index f66c155c78..1077450c9a 100644 --- a/server/api/v1/system/sys_jwt_blacklist.go +++ b/server/api/v1/system/sys_jwt_blacklist.go @@ -12,13 +12,14 @@ import ( type JwtApi struct{} // JsonInBlacklist -// @Tags Jwt -// @Summary jwt加入黑名单 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{msg=string} "jwt加入黑名单" -// @Router /jwt/jsonInBlacklist [post] +// +// @Tags Jwt +// @Summary jwt加入黑名单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{msg=string} "jwt加入黑名单" +// @Router /jwt/jsonInBlacklist [post] func (j *JwtApi) JsonInBlacklist(c *gin.Context) { token := utils.GetToken(c) jwt := system.JwtBlacklist{Jwt: token} diff --git a/server/api/v1/system/sys_menu.go b/server/api/v1/system/sys_menu.go index 8889ae7f7b..55948bfc91 100644 --- a/server/api/v1/system/sys_menu.go +++ b/server/api/v1/system/sys_menu.go @@ -16,13 +16,14 @@ import ( type AuthorityMenuApi struct{} // GetMenu -// @Tags AuthorityMenu -// @Summary 获取用户动态路由 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body request.Empty true "空" -// @Success 200 {object} response.Response{data=systemRes.SysMenusResponse,msg=string} "获取用户动态路由,返回包括系统菜单详情列表" -// @Router /menu/getMenu [post] +// +// @Tags AuthorityMenu +// @Summary 获取用户动态路由 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body request.Empty true "空" +// @Success 200 {object} response.Response{data=systemRes.SysMenusResponse,msg=string} "获取用户动态路由,返回包括系统菜单详情列表" +// @Router /menu/getMenu [post] func (a *AuthorityMenuApi) GetMenu(c *gin.Context) { menus, err := menuService.GetMenuTree(utils.GetUserAuthorityId(c)) if err != nil { @@ -37,13 +38,14 @@ func (a *AuthorityMenuApi) GetMenu(c *gin.Context) { } // GetBaseMenuTree -// @Tags AuthorityMenu -// @Summary 获取用户动态路由 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body request.Empty true "空" -// @Success 200 {object} response.Response{data=systemRes.SysBaseMenusResponse,msg=string} "获取用户动态路由,返回包括系统菜单列表" -// @Router /menu/getBaseMenuTree [post] +// +// @Tags AuthorityMenu +// @Summary 获取用户动态路由 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body request.Empty true "空" +// @Success 200 {object} response.Response{data=systemRes.SysBaseMenusResponse,msg=string} "获取用户动态路由,返回包括系统菜单列表" +// @Router /menu/getBaseMenuTree [post] func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) { menus, err := menuService.GetBaseMenuTree() if err != nil { @@ -55,14 +57,15 @@ func (a *AuthorityMenuApi) GetBaseMenuTree(c *gin.Context) { } // AddMenuAuthority -// @Tags AuthorityMenu -// @Summary 增加menu和角色关联关系 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body systemReq.AddMenuAuthorityInfo true "角色ID" -// @Success 200 {object} response.Response{msg=string} "增加menu和角色关联关系" -// @Router /menu/addMenuAuthority [post] +// +// @Tags AuthorityMenu +// @Summary 增加menu和角色关联关系 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.AddMenuAuthorityInfo true "角色ID" +// @Success 200 {object} response.Response{msg=string} "增加menu和角色关联关系" +// @Router /menu/addMenuAuthority [post] func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) { var authorityMenu systemReq.AddMenuAuthorityInfo err := c.ShouldBindJSON(&authorityMenu) @@ -83,14 +86,15 @@ func (a *AuthorityMenuApi) AddMenuAuthority(c *gin.Context) { } // GetMenuAuthority -// @Tags AuthorityMenu -// @Summary 获取指定角色menu -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetAuthorityId true "角色ID" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取指定角色menu" -// @Router /menu/getMenuAuthority [post] +// +// @Tags AuthorityMenu +// @Summary 获取指定角色menu +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetAuthorityId true "角色ID" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取指定角色menu" +// @Router /menu/getMenuAuthority [post] func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) { var param request.GetAuthorityId err := c.ShouldBindJSON(¶m) @@ -113,14 +117,15 @@ func (a *AuthorityMenuApi) GetMenuAuthority(c *gin.Context) { } // AddBaseMenu -// @Tags Menu -// @Summary 新增菜单 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记" -// @Success 200 {object} response.Response{msg=string} "新增菜单" -// @Router /menu/addBaseMenu [post] +// +// @Tags Menu +// @Summary 新增菜单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记" +// @Success 200 {object} response.Response{msg=string} "新增菜单" +// @Router /menu/addBaseMenu [post] func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) { var menu system.SysBaseMenu err := c.ShouldBindJSON(&menu) @@ -148,14 +153,15 @@ func (a *AuthorityMenuApi) AddBaseMenu(c *gin.Context) { } // DeleteBaseMenu -// @Tags Menu -// @Summary 删除菜单 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetById true "菜单id" -// @Success 200 {object} response.Response{msg=string} "删除菜单" -// @Router /menu/deleteBaseMenu [post] +// +// @Tags Menu +// @Summary 删除菜单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetById true "菜单id" +// @Success 200 {object} response.Response{msg=string} "删除菜单" +// @Router /menu/deleteBaseMenu [post] func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) { var menu request.GetById err := c.ShouldBindJSON(&menu) @@ -178,14 +184,15 @@ func (a *AuthorityMenuApi) DeleteBaseMenu(c *gin.Context) { } // UpdateBaseMenu -// @Tags Menu -// @Summary 更新菜单 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记" -// @Success 200 {object} response.Response{msg=string} "更新菜单" -// @Router /menu/updateBaseMenu [post] +// +// @Tags Menu +// @Summary 更新菜单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysBaseMenu true "路由path, 父菜单ID, 路由name, 对应前端文件路径, 排序标记" +// @Success 200 {object} response.Response{msg=string} "更新菜单" +// @Router /menu/updateBaseMenu [post] func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) { var menu system.SysBaseMenu err := c.ShouldBindJSON(&menu) @@ -213,14 +220,15 @@ func (a *AuthorityMenuApi) UpdateBaseMenu(c *gin.Context) { } // GetBaseMenuById -// @Tags Menu -// @Summary 根据id获取菜单 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetById true "菜单id" -// @Success 200 {object} response.Response{data=systemRes.SysBaseMenuResponse,msg=string} "根据id获取菜单,返回包括系统菜单列表" -// @Router /menu/getBaseMenuById [post] +// +// @Tags Menu +// @Summary 根据id获取菜单 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetById true "菜单id" +// @Success 200 {object} response.Response{data=systemRes.SysBaseMenuResponse,msg=string} "根据id获取菜单,返回包括系统菜单列表" +// @Router /menu/getBaseMenuById [post] func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) { var idInfo request.GetById err := c.ShouldBindJSON(&idInfo) @@ -243,14 +251,15 @@ func (a *AuthorityMenuApi) GetBaseMenuById(c *gin.Context) { } // GetMenuList -// @Tags Menu -// @Summary 分页获取基础menu列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取基础menu列表,返回包括列表,总数,页码,每页数量" -// @Router /menu/getMenuList [post] +// +// @Tags Menu +// @Summary 分页获取基础menu列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.PageInfo true "页码, 每页大小" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取基础menu列表,返回包括列表,总数,页码,每页数量" +// @Router /menu/getMenuList [post] func (a *AuthorityMenuApi) GetMenuList(c *gin.Context) { var pageInfo request.PageInfo err := c.ShouldBindJSON(&pageInfo) diff --git a/server/api/v1/system/sys_operation_record.go b/server/api/v1/system/sys_operation_record.go index 40daeb98db..aa46493fb5 100644 --- a/server/api/v1/system/sys_operation_record.go +++ b/server/api/v1/system/sys_operation_record.go @@ -14,14 +14,15 @@ import ( type OperationRecordApi struct{} // CreateSysOperationRecord -// @Tags SysOperationRecord -// @Summary 创建SysOperationRecord -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysOperationRecord true "创建SysOperationRecord" -// @Success 200 {object} response.Response{msg=string} "创建SysOperationRecord" -// @Router /sysOperationRecord/createSysOperationRecord [post] +// +// @Tags SysOperationRecord +// @Summary 创建SysOperationRecord +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysOperationRecord true "创建SysOperationRecord" +// @Success 200 {object} response.Response{msg=string} "创建SysOperationRecord" +// @Router /sysOperationRecord/createSysOperationRecord [post] func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord err := c.ShouldBindJSON(&sysOperationRecord) @@ -39,14 +40,15 @@ func (s *OperationRecordApi) CreateSysOperationRecord(c *gin.Context) { } // DeleteSysOperationRecord -// @Tags SysOperationRecord -// @Summary 删除SysOperationRecord -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysOperationRecord true "SysOperationRecord模型" -// @Success 200 {object} response.Response{msg=string} "删除SysOperationRecord" -// @Router /sysOperationRecord/deleteSysOperationRecord [delete] +// +// @Tags SysOperationRecord +// @Summary 删除SysOperationRecord +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysOperationRecord true "SysOperationRecord模型" +// @Success 200 {object} response.Response{msg=string} "删除SysOperationRecord" +// @Router /sysOperationRecord/deleteSysOperationRecord [delete] func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord err := c.ShouldBindJSON(&sysOperationRecord) @@ -64,14 +66,15 @@ func (s *OperationRecordApi) DeleteSysOperationRecord(c *gin.Context) { } // DeleteSysOperationRecordByIds -// @Tags SysOperationRecord -// @Summary 批量删除SysOperationRecord -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.IdsReq true "批量删除SysOperationRecord" -// @Success 200 {object} response.Response{msg=string} "批量删除SysOperationRecord" -// @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete] +// +// @Tags SysOperationRecord +// @Summary 批量删除SysOperationRecord +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.IdsReq true "批量删除SysOperationRecord" +// @Success 200 {object} response.Response{msg=string} "批量删除SysOperationRecord" +// @Router /sysOperationRecord/deleteSysOperationRecordByIds [delete] func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) { var IDS request.IdsReq err := c.ShouldBindJSON(&IDS) @@ -89,14 +92,15 @@ func (s *OperationRecordApi) DeleteSysOperationRecordByIds(c *gin.Context) { } // FindSysOperationRecord -// @Tags SysOperationRecord -// @Summary 用id查询SysOperationRecord -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query system.SysOperationRecord true "Id" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "用id查询SysOperationRecord" -// @Router /sysOperationRecord/findSysOperationRecord [get] +// +// @Tags SysOperationRecord +// @Summary 用id查询SysOperationRecord +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query system.SysOperationRecord true "Id" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "用id查询SysOperationRecord" +// @Router /sysOperationRecord/findSysOperationRecord [get] func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) { var sysOperationRecord system.SysOperationRecord err := c.ShouldBindQuery(&sysOperationRecord) @@ -119,14 +123,15 @@ func (s *OperationRecordApi) FindSysOperationRecord(c *gin.Context) { } // GetSysOperationRecordList -// @Tags SysOperationRecord -// @Summary 分页获取SysOperationRecord列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data query request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量" -// @Router /sysOperationRecord/getSysOperationRecordList [get] +// +// @Tags SysOperationRecord +// @Summary 分页获取SysOperationRecord列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data query request.SysOperationRecordSearch true "页码, 每页大小, 搜索条件" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量" +// @Router /sysOperationRecord/getSysOperationRecordList [get] func (s *OperationRecordApi) GetSysOperationRecordList(c *gin.Context) { var pageInfo systemReq.SysOperationRecordSearch err := c.ShouldBindQuery(&pageInfo) diff --git a/server/api/v1/system/sys_system.go b/server/api/v1/system/sys_system.go index aa41c2f469..c0d478595f 100644 --- a/server/api/v1/system/sys_system.go +++ b/server/api/v1/system/sys_system.go @@ -13,12 +13,13 @@ import ( type SystemApi struct{} // GetSystemConfig -// @Tags System -// @Summary 获取配置文件内容 -// @Security ApiKeyAuth -// @Produce application/json -// @Success 200 {object} response.Response{data=systemRes.SysConfigResponse,msg=string} "获取配置文件内容,返回包括系统配置" -// @Router /system/getSystemConfig [post] +// +// @Tags System +// @Summary 获取配置文件内容 +// @Security ApiKeyAuth +// @Produce application/json +// @Success 200 {object} response.Response{data=systemRes.SysConfigResponse,msg=string} "获取配置文件内容,返回包括系统配置" +// @Router /system/getSystemConfig [post] func (s *SystemApi) GetSystemConfig(c *gin.Context) { config, err := systemConfigService.GetSystemConfig() if err != nil { @@ -30,13 +31,14 @@ func (s *SystemApi) GetSystemConfig(c *gin.Context) { } // SetSystemConfig -// @Tags System -// @Summary 设置配置文件内容 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body system.System true "设置配置文件内容" -// @Success 200 {object} response.Response{data=string} "设置配置文件内容" -// @Router /system/setSystemConfig [post] +// +// @Tags System +// @Summary 设置配置文件内容 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body system.System true "设置配置文件内容" +// @Success 200 {object} response.Response{data=string} "设置配置文件内容" +// @Router /system/setSystemConfig [post] func (s *SystemApi) SetSystemConfig(c *gin.Context) { var sys system.System err := c.ShouldBindJSON(&sys) @@ -54,12 +56,13 @@ func (s *SystemApi) SetSystemConfig(c *gin.Context) { } // ReloadSystem -// @Tags System -// @Summary 重启系统 -// @Security ApiKeyAuth -// @Produce application/json -// @Success 200 {object} response.Response{msg=string} "重启系统" -// @Router /system/reloadSystem [post] +// +// @Tags System +// @Summary 重启系统 +// @Security ApiKeyAuth +// @Produce application/json +// @Success 200 {object} response.Response{msg=string} "重启系统" +// @Router /system/reloadSystem [post] func (s *SystemApi) ReloadSystem(c *gin.Context) { err := utils.Reload() if err != nil { @@ -71,12 +74,13 @@ func (s *SystemApi) ReloadSystem(c *gin.Context) { } // GetServerInfo -// @Tags System -// @Summary 获取服务器信息 -// @Security ApiKeyAuth -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取服务器信息" -// @Router /system/getServerInfo [post] +// +// @Tags System +// @Summary 获取服务器信息 +// @Security ApiKeyAuth +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取服务器信息" +// @Router /system/getServerInfo [post] func (s *SystemApi) GetServerInfo(c *gin.Context) { server, err := systemConfigService.GetServerInfo() if err != nil { diff --git a/server/api/v1/system/sys_user.go b/server/api/v1/system/sys_user.go index 77ba26f623..81d03a5b4c 100644 --- a/server/api/v1/system/sys_user.go +++ b/server/api/v1/system/sys_user.go @@ -18,12 +18,13 @@ import ( ) // Login -// @Tags Base -// @Summary 用户登录 -// @Produce application/json -// @Param data body systemReq.Login true "用户名, 密码, 验证码" -// @Success 200 {object} response.Response{data=systemRes.LoginResponse,msg=string} "返回包括用户信息,token,过期时间" -// @Router /base/login [post] +// +// @Tags Base +// @Summary 用户登录 +// @Produce application/json +// @Param data body systemReq.Login true "用户名, 密码, 验证码" +// @Success 200 {object} response.Response{data=systemRes.LoginResponse,msg=string} "返回包括用户信息,token,过期时间" +// @Router /base/login [post] func (b *BaseApi) Login(c *gin.Context) { var l systemReq.Login err := c.ShouldBindJSON(&l) @@ -136,12 +137,13 @@ func (b *BaseApi) TokenNext(c *gin.Context, user system.SysUser) { } // Register -// @Tags SysUser -// @Summary 用户注册账号 -// @Produce application/json -// @Param data body systemReq.Register true "用户名, 昵称, 密码, 角色ID" -// @Success 200 {object} response.Response{data=systemRes.SysUserResponse,msg=string} "用户注册账号,返回包括用户信息" -// @Router /user/admin_register [post] +// +// @Tags SysUser +// @Summary 用户注册账号 +// @Produce application/json +// @Param data body systemReq.Register true "用户名, 昵称, 密码, 角色ID" +// @Success 200 {object} response.Response{data=systemRes.SysUserResponse,msg=string} "用户注册账号,返回包括用户信息" +// @Router /user/admin_register [post] func (b *BaseApi) Register(c *gin.Context) { var r systemReq.Register err := c.ShouldBindJSON(&r) @@ -171,13 +173,14 @@ func (b *BaseApi) Register(c *gin.Context) { } // ChangePassword -// @Tags SysUser -// @Summary 用户修改密码 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body systemReq.ChangePasswordReq true "用户名, 原密码, 新密码" -// @Success 200 {object} response.Response{msg=string} "用户修改密码" -// @Router /user/changePassword [post] +// +// @Tags SysUser +// @Summary 用户修改密码 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body systemReq.ChangePasswordReq true "用户名, 原密码, 新密码" +// @Success 200 {object} response.Response{msg=string} "用户修改密码" +// @Router /user/changePassword [post] func (b *BaseApi) ChangePassword(c *gin.Context) { var req systemReq.ChangePasswordReq err := c.ShouldBindJSON(&req) @@ -202,14 +205,15 @@ func (b *BaseApi) ChangePassword(c *gin.Context) { } // GetUserList -// @Tags SysUser -// @Summary 分页获取用户列表 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.PageInfo true "页码, 每页大小" -// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取用户列表,返回包括列表,总数,页码,每页数量" -// @Router /user/getUserList [post] +// +// @Tags SysUser +// @Summary 分页获取用户列表 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.PageInfo true "页码, 每页大小" +// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "分页获取用户列表,返回包括列表,总数,页码,每页数量" +// @Router /user/getUserList [post] func (b *BaseApi) GetUserList(c *gin.Context) { var pageInfo request.PageInfo err := c.ShouldBindJSON(&pageInfo) @@ -237,14 +241,15 @@ func (b *BaseApi) GetUserList(c *gin.Context) { } // SetUserAuthority -// @Tags SysUser -// @Summary 更改用户权限 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body systemReq.SetUserAuth true "用户UUID, 角色ID" -// @Success 200 {object} response.Response{msg=string} "设置用户权限" -// @Router /user/setUserAuthority [post] +// +// @Tags SysUser +// @Summary 更改用户权限 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.SetUserAuth true "用户UUID, 角色ID" +// @Success 200 {object} response.Response{msg=string} "设置用户权限" +// @Router /user/setUserAuthority [post] func (b *BaseApi) SetUserAuthority(c *gin.Context) { var sua systemReq.SetUserAuth err := c.ShouldBindJSON(&sua) @@ -278,14 +283,15 @@ func (b *BaseApi) SetUserAuthority(c *gin.Context) { } // SetUserAuthorities -// @Tags SysUser -// @Summary 设置用户权限 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body systemReq.SetUserAuthorities true "用户UUID, 角色ID" -// @Success 200 {object} response.Response{msg=string} "设置用户权限" -// @Router /user/setUserAuthorities [post] +// +// @Tags SysUser +// @Summary 设置用户权限 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body systemReq.SetUserAuthorities true "用户UUID, 角色ID" +// @Success 200 {object} response.Response{msg=string} "设置用户权限" +// @Router /user/setUserAuthorities [post] func (b *BaseApi) SetUserAuthorities(c *gin.Context) { var sua systemReq.SetUserAuthorities err := c.ShouldBindJSON(&sua) @@ -303,14 +309,15 @@ func (b *BaseApi) SetUserAuthorities(c *gin.Context) { } // DeleteUser -// @Tags SysUser -// @Summary 删除用户 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body request.GetById true "用户ID" -// @Success 200 {object} response.Response{msg=string} "删除用户" -// @Router /user/deleteUser [delete] +// +// @Tags SysUser +// @Summary 删除用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.GetById true "用户ID" +// @Success 200 {object} response.Response{msg=string} "删除用户" +// @Router /user/deleteUser [delete] func (b *BaseApi) DeleteUser(c *gin.Context) { var reqId request.GetById err := c.ShouldBindJSON(&reqId) @@ -338,14 +345,15 @@ func (b *BaseApi) DeleteUser(c *gin.Context) { } // SetUserInfo -// @Tags SysUser -// @Summary 设置用户信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysUser true "ID, 用户名, 昵称, 头像链接" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "设置用户信息" -// @Router /user/setUserInfo [put] +// +// @Tags SysUser +// @Summary 设置用户信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysUser true "ID, 用户名, 昵称, 头像链接" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "设置用户信息" +// @Router /user/setUserInfo [put] func (b *BaseApi) SetUserInfo(c *gin.Context) { var user systemReq.ChangeUserInfo err := c.ShouldBindJSON(&user) @@ -387,14 +395,15 @@ func (b *BaseApi) SetUserInfo(c *gin.Context) { } // SetSelfInfo -// @Tags SysUser -// @Summary 设置用户信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Param data body system.SysUser true "ID, 用户名, 昵称, 头像链接" -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "设置用户信息" -// @Router /user/SetSelfInfo [put] +// +// @Tags SysUser +// @Summary 设置用户信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body system.SysUser true "ID, 用户名, 昵称, 头像链接" +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "设置用户信息" +// @Router /user/SetSelfInfo [put] func (b *BaseApi) SetSelfInfo(c *gin.Context) { var user systemReq.ChangeUserInfo err := c.ShouldBindJSON(&user) @@ -423,13 +432,14 @@ func (b *BaseApi) SetSelfInfo(c *gin.Context) { } // GetUserInfo -// @Tags SysUser -// @Summary 获取用户信息 -// @Security ApiKeyAuth -// @accept application/json -// @Produce application/json -// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取用户信息" -// @Router /user/getUserInfo [get] +// +// @Tags SysUser +// @Summary 获取用户信息 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Success 200 {object} response.Response{data=map[string]interface{},msg=string} "获取用户信息" +// @Router /user/getUserInfo [get] func (b *BaseApi) GetUserInfo(c *gin.Context) { uuid := utils.GetUserUuid(c) ReqUser, err := userService.GetUserInfo(uuid) @@ -442,13 +452,14 @@ func (b *BaseApi) GetUserInfo(c *gin.Context) { } // ResetPassword -// @Tags SysUser -// @Summary 重置用户密码 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body system.SysUser true "ID" -// @Success 200 {object} response.Response{msg=string} "重置用户密码" -// @Router /user/resetPassword [post] +// +// @Tags SysUser +// @Summary 重置用户密码 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body system.SysUser true "ID" +// @Success 200 {object} response.Response{msg=string} "重置用户密码" +// @Router /user/resetPassword [post] func (b *BaseApi) ResetPassword(c *gin.Context) { var user system.SysUser err := c.ShouldBindJSON(&user) diff --git a/server/docs/docs.go b/server/docs/docs.go index ff9a5c2613..881f16ed07 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -418,7 +418,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/response.SysAuthorityCopyResponse" + "$ref": "#/definitions/request.AuthorityCopy" } } ], @@ -433,9 +433,6 @@ const docTemplate = `{ { "type": "object", "properties": { - "data": { - "$ref": "#/definitions/response.SysAuthorityResponse" - }, "msg": { "type": "string" } @@ -3450,7 +3447,7 @@ const docTemplate = `{ "in": "query" }, { - "type": "integer", + "type": "string", "description": "字典值", "name": "value", "in": "query" @@ -3567,7 +3564,7 @@ const docTemplate = `{ "in": "query" }, { - "type": "integer", + "type": "string", "description": "字典值", "name": "value", "in": "query" @@ -3648,7 +3645,7 @@ const docTemplate = `{ } } }, - "/sysOperationRecord/createSysOperationRecord": { + "/sysExportTemplate/createSysExportTemplate": { "post": { "security": [ { @@ -3662,43 +3659,31 @@ const docTemplate = `{ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "创建SysOperationRecord", + "summary": "创建导出模板", "parameters": [ { - "description": "创建SysOperationRecord", + "description": "创建导出模板", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/system.SysOperationRecord" + "$ref": "#/definitions/system.SysExportTemplate" } } ], "responses": { "200": { - "description": "创建SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/deleteSysOperationRecord": { + "/sysExportTemplate/deleteSysExportTemplate": { "delete": { "security": [ { @@ -3712,43 +3697,31 @@ const docTemplate = `{ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "删除SysOperationRecord", + "summary": "删除导出模板", "parameters": [ { - "description": "SysOperationRecord模型", + "description": "删除导出模板", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/system.SysOperationRecord" + "$ref": "#/definitions/system.SysExportTemplate" } } ], "responses": { "200": { - "description": "删除SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/deleteSysOperationRecordByIds": { + "/sysExportTemplate/deleteSysExportTemplateByIds": { "delete": { "security": [ { @@ -3762,12 +3735,12 @@ const docTemplate = `{ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "批量删除SysOperationRecord", + "summary": "批量删除导出模板", "parameters": [ { - "description": "批量删除SysOperationRecord", + "description": "批量删除导出模板", "name": "data", "in": "body", "required": true, @@ -3778,27 +3751,15 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "批量删除SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"批量删除成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/findSysOperationRecord": { + "/sysExportTemplate/exportExcel": { "get": { "security": [ { @@ -3812,9 +3773,29 @@ const docTemplate = `{ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "用id查询SysOperationRecord", + "summary": "导出表格模板", + "responses": {} + } + }, + "/sysExportTemplate/findSysExportTemplate": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysExportTemplate" + ], + "summary": "用id查询导出模板", "parameters": [ { "type": "integer", @@ -3822,18 +3803,6 @@ const docTemplate = `{ "name": "ID", "in": "query" }, - { - "type": "string", - "description": "代理", - "name": "agent", - "in": "query" - }, - { - "type": "string", - "description": "请求Body", - "name": "body", - "in": "query" - }, { "type": "string", "description": "创建时间", @@ -3842,44 +3811,42 @@ const docTemplate = `{ }, { "type": "string", - "description": "错误信息", - "name": "error_message", + "description": "数据库名称", + "name": "dbName", "in": "query" }, { - "type": "string", - "description": "请求ip", - "name": "ip", + "type": "integer", + "name": "limit", "in": "query" }, { "type": "string", - "description": "延迟", - "name": "latency", + "description": "模板名称", + "name": "name", "in": "query" }, { "type": "string", - "description": "请求方法", - "name": "method", + "name": "order", "in": "query" }, { "type": "string", - "description": "请求路径", - "name": "path", + "description": "表名称", + "name": "tableName", "in": "query" }, { "type": "string", - "description": "响应Body", - "name": "resp", + "description": "模板标识", + "name": "templateID", "in": "query" }, { - "type": "integer", - "description": "请求状态", - "name": "status", + "type": "string", + "description": "模板信息", + "name": "templateInfo", "in": "query" }, { @@ -3887,41 +3854,19 @@ const docTemplate = `{ "description": "更新时间", "name": "updatedAt", "in": "query" - }, - { - "type": "integer", - "description": "用户id", - "name": "user_id", - "in": "query" } ], "responses": { "200": { - "description": "用id查询SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "additionalProperties": true - }, - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/getSysOperationRecordList": { + "/sysExportTemplate/getSysExportTemplateList": { "get": { "security": [ { @@ -3935,9 +3880,9 @@ const docTemplate = `{ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "分页获取SysOperationRecord列表", + "summary": "分页获取导出模板列表", "parameters": [ { "type": "integer", @@ -3945,18 +3890,6 @@ const docTemplate = `{ "name": "ID", "in": "query" }, - { - "type": "string", - "description": "代理", - "name": "agent", - "in": "query" - }, - { - "type": "string", - "description": "请求Body", - "name": "body", - "in": "query" - }, { "type": "string", "description": "创建时间", @@ -3965,14 +3898,13 @@ const docTemplate = `{ }, { "type": "string", - "description": "错误信息", - "name": "error_message", + "description": "数据库名称", + "name": "dbName", "in": "query" }, { "type": "string", - "description": "请求ip", - "name": "ip", + "name": "endCreatedAt", "in": "query" }, { @@ -3981,16 +3913,20 @@ const docTemplate = `{ "name": "keyword", "in": "query" }, + { + "type": "integer", + "name": "limit", + "in": "query" + }, { "type": "string", - "description": "延迟", - "name": "latency", + "description": "模板名称", + "name": "name", "in": "query" }, { "type": "string", - "description": "请求方法", - "name": "method", + "name": "order", "in": "query" }, { @@ -4007,122 +3943,577 @@ const docTemplate = `{ }, { "type": "string", - "description": "请求路径", - "name": "path", + "name": "startCreatedAt", "in": "query" }, { "type": "string", - "description": "响应Body", - "name": "resp", + "description": "表名称", + "name": "tableName", "in": "query" }, { - "type": "integer", - "description": "请求状态", - "name": "status", + "type": "string", + "description": "模板标识", + "name": "templateID", "in": "query" }, { "type": "string", - "description": "更新时间", - "name": "updatedAt", + "description": "模板信息", + "name": "templateInfo", "in": "query" }, { - "type": "integer", - "description": "用户id", - "name": "user_id", + "type": "string", + "description": "更新时间", + "name": "updatedAt", "in": "query" } ], "responses": { "200": { - "description": "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量", + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/response.PageResult" - }, - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/system/getServerInfo": { + "/sysExportTemplate/importExcel": { "post": { "security": [ { "ApiKeyAuth": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "System" + "SysImportTemplate" ], - "summary": "获取服务器信息", - "responses": { - "200": { - "description": "获取服务器信息", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "additionalProperties": true - }, - "msg": { - "type": "string" - } - } - } - ] - } - } - } + "summary": "导入表格", + "responses": {} } }, - "/system/getSystemConfig": { - "post": { + "/sysExportTemplate/updateSysExportTemplate": { + "put": { "security": [ { "ApiKeyAuth": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "System" + "SysExportTemplate" + ], + "summary": "更新导出模板", + "parameters": [ + { + "description": "更新导出模板", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.SysExportTemplate" + } + } ], - "summary": "获取配置文件内容", "responses": { "200": { - "description": "获取配置文件内容,返回包括系统配置", + "description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, + "type": "string" + } + } + } + } + }, + "/sysOperationRecord/createSysOperationRecord": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "创建SysOperationRecord", + "parameters": [ + { + "description": "创建SysOperationRecord", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.SysOperationRecord" + } + } + ], + "responses": { + "200": { + "description": "创建SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/deleteSysOperationRecord": { + "delete": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "删除SysOperationRecord", + "parameters": [ + { + "description": "SysOperationRecord模型", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.SysOperationRecord" + } + } + ], + "responses": { + "200": { + "description": "删除SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/deleteSysOperationRecordByIds": { + "delete": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "批量删除SysOperationRecord", + "parameters": [ + { + "description": "批量删除SysOperationRecord", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "批量删除SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/findSysOperationRecord": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "用id查询SysOperationRecord", + "parameters": [ + { + "type": "integer", + "description": "主键ID", + "name": "ID", + "in": "query" + }, + { + "type": "string", + "description": "代理", + "name": "agent", + "in": "query" + }, + { + "type": "string", + "description": "请求Body", + "name": "body", + "in": "query" + }, + { + "type": "string", + "description": "创建时间", + "name": "createdAt", + "in": "query" + }, + { + "type": "string", + "description": "错误信息", + "name": "error_message", + "in": "query" + }, + { + "type": "string", + "description": "请求ip", + "name": "ip", + "in": "query" + }, + { + "type": "string", + "description": "延迟", + "name": "latency", + "in": "query" + }, + { + "type": "string", + "description": "请求方法", + "name": "method", + "in": "query" + }, + { + "type": "string", + "description": "请求路径", + "name": "path", + "in": "query" + }, + { + "type": "string", + "description": "响应Body", + "name": "resp", + "in": "query" + }, + { + "type": "integer", + "description": "请求状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "更新时间", + "name": "updatedAt", + "in": "query" + }, + { + "type": "integer", + "description": "用户id", + "name": "user_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "用id查询SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": true + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/getSysOperationRecordList": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "分页获取SysOperationRecord列表", + "parameters": [ + { + "type": "integer", + "description": "主键ID", + "name": "ID", + "in": "query" + }, + { + "type": "string", + "description": "代理", + "name": "agent", + "in": "query" + }, + { + "type": "string", + "description": "请求Body", + "name": "body", + "in": "query" + }, + { + "type": "string", + "description": "创建时间", + "name": "createdAt", + "in": "query" + }, + { + "type": "string", + "description": "错误信息", + "name": "error_message", + "in": "query" + }, + { + "type": "string", + "description": "请求ip", + "name": "ip", + "in": "query" + }, + { + "type": "string", + "description": "关键字", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "延迟", + "name": "latency", + "in": "query" + }, + { + "type": "string", + "description": "请求方法", + "name": "method", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "每页大小", + "name": "pageSize", + "in": "query" + }, + { + "type": "string", + "description": "请求路径", + "name": "path", + "in": "query" + }, + { + "type": "string", + "description": "响应Body", + "name": "resp", + "in": "query" + }, + { + "type": "integer", + "description": "请求状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "更新时间", + "name": "updatedAt", + "in": "query" + }, + { + "type": "integer", + "description": "用户id", + "name": "user_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/system/getServerInfo": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "System" + ], + "summary": "获取服务器信息", + "responses": { + "200": { + "description": "获取服务器信息", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": true + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/system/getSystemConfig": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "System" + ], + "summary": "获取配置文件内容", + "responses": { + "200": { + "description": "获取配置文件内容,返回包括系统配置", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, { "type": "object", "properties": { @@ -4879,6 +5270,14 @@ const docTemplate = `{ } } }, + "config.DiskList": { + "type": "object", + "properties": { + "mount-point": { + "type": "string" + } + } + }, "config.Excel": { "type": "object", "properties": { @@ -4944,6 +5343,10 @@ const docTemplate = `{ "config.Mongo": { "type": "object", "properties": { + "auth-source": { + "description": "验证数据库", + "type": "string" + }, "coll": { "description": "collection name", "type": "string" @@ -5266,13 +5669,24 @@ const docTemplate = `{ "description": "服务器地址:端口", "type": "string" }, + "clusterAddrs": { + "description": "集群模式下的节点地址列表", + "type": "array", + "items": { + "type": "string" + } + }, "db": { - "description": "redis的哪个数据库", + "description": "单实例模式下redis的哪个数据库", "type": "integer" }, "password": { "description": "密码", "type": "string" + }, + "useCluster": { + "description": "是否使用集群模式", + "type": "boolean" } } }, @@ -5310,6 +5724,12 @@ const docTemplate = `{ "$ref": "#/definitions/config.SpecializedDB" } }, + "disk-list": { + "type": "array", + "items": { + "$ref": "#/definitions/config.DiskList" + } + }, "email": { "$ref": "#/definitions/github_com_flipped-aurora_gin-vue-admin_server_config.Email" }, @@ -5500,10 +5920,6 @@ const docTemplate = `{ "description": "数据库类型:mysql(默认)|sqlite|sqlserver|postgresql", "type": "string" }, - "env": { - "description": "环境值", - "type": "string" - }, "iplimit-count": { "type": "integer" }, @@ -5518,7 +5934,7 @@ const docTemplate = `{ "type": "string" }, "use-mongo": { - "description": "使用redis", + "description": "使用mongo", "type": "boolean" }, "use-multipoint": { @@ -5577,10 +5993,6 @@ const docTemplate = `{ "description": "输出控制台", "type": "boolean" }, - "max-age": { - "description": "日志留存时间", - "type": "integer" - }, "prefix": { "description": "日志前缀", "type": "string" @@ -5781,6 +6193,17 @@ const docTemplate = `{ } } }, + "request.AuthorityCopy": { + "type": "object", + "properties": { + "authority": { + "$ref": "#/definitions/system.SysAuthority" + }, + "oldAuthorityId": { + "type": "integer" + } + } + }, "request.CasbinInReceive": { "type": "object", "properties": { @@ -5857,9 +6280,13 @@ const docTemplate = `{ "request.InitDB": { "type": "object", "required": [ + "adminPassword", "dbName" ], "properties": { + "adminPassword": { + "type": "string" + }, "dbName": { "description": "数据库名", "type": "string" @@ -6224,18 +6651,6 @@ const docTemplate = `{ } } }, - "response.SysAuthorityCopyResponse": { - "type": "object", - "properties": { - "authority": { - "$ref": "#/definitions/system.SysAuthority" - }, - "oldAuthorityId": { - "description": "旧角色ID", - "type": "integer" - } - } - }, "response.SysAuthorityResponse": { "type": "object", "properties": { @@ -6318,12 +6733,12 @@ const docTemplate = `{ "description": "是否自动创建api", "type": "boolean" }, - "autoCreateResource": { - "description": "是否自动创建资源标识", + "autoCreateMenuToSql": { + "description": "是否自动创建menu", "type": "boolean" }, - "autoMoveFile": { - "description": "是否自动移动文件", + "autoCreateResource": { + "description": "是否自动创建资源标识", "type": "boolean" }, "businessDB": { @@ -6340,7 +6755,8 @@ const docTemplate = `{ "$ref": "#/definitions/system.Field" } }, - "hasTimer": { + "gvaModel": { + "description": "是否使用gva默认Model", "type": "boolean" }, "humpPackageName": { @@ -6354,6 +6770,9 @@ const docTemplate = `{ "description": "文件名称", "type": "string" }, + "primaryField": { + "$ref": "#/definitions/system.Field" + }, "structName": { "description": "Struct名称", "type": "string" @@ -6364,9 +6783,60 @@ const docTemplate = `{ } } }, + "system.Condition": { + "type": "object", + "properties": { + "ID": { + "description": "主键ID", + "type": "integer" + }, + "column": { + "type": "string" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "from": { + "type": "string" + }, + "operator": { + "type": "string" + }, + "templateID": { + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, + "system.DataSource": { + "type": "object", + "properties": { + "association": { + "description": "关联关系 1 一对一 2 一对多", + "type": "integer" + }, + "label": { + "type": "string" + }, + "table": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, "system.Field": { "type": "object", "properties": { + "checkDataSource": { + "description": "是否检查数据源", + "type": "boolean" + }, "clearable": { "description": "是否可清空", "type": "boolean" @@ -6379,10 +6849,22 @@ const docTemplate = `{ "description": "数据库字段描述", "type": "string" }, + "dataSource": { + "description": "数据源", + "allOf": [ + { + "$ref": "#/definitions/system.DataSource" + } + ] + }, "dataTypeLong": { "description": "数据库字段长度", "type": "string" }, + "defaultValue": { + "description": "是否必填", + "type": "string" + }, "dictType": { "description": "字典", "type": "string" @@ -6403,6 +6885,10 @@ const docTemplate = `{ "description": "Field名", "type": "string" }, + "fieldSearchHide": { + "description": "是否隐藏查询条件", + "type": "boolean" + }, "fieldSearchType": { "description": "搜索条件", "type": "string" @@ -6411,6 +6897,14 @@ const docTemplate = `{ "description": "Field数据类型", "type": "string" }, + "front": { + "description": "是否前端可见", + "type": "boolean" + }, + "primaryKey": { + "description": "是否主键", + "type": "boolean" + }, "require": { "description": "是否必填", "type": "boolean" @@ -6421,6 +6915,35 @@ const docTemplate = `{ } } }, + "system.JoinTemplate": { + "type": "object", + "properties": { + "ID": { + "description": "主键ID", + "type": "integer" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "joins": { + "type": "string" + }, + "on": { + "type": "string" + }, + "table": { + "type": "string" + }, + "templateID": { + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, "system.Meta": { "type": "object", "properties": { @@ -6615,7 +7138,7 @@ const docTemplate = `{ }, "parentId": { "description": "父菜单ID", - "type": "string" + "type": "integer" }, "path": { "description": "路由path", @@ -6765,7 +7288,62 @@ const docTemplate = `{ }, "value": { "description": "字典值", + "type": "string" + } + } + }, + "system.SysExportTemplate": { + "type": "object", + "properties": { + "ID": { + "description": "主键ID", + "type": "integer" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Condition" + } + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "dbName": { + "description": "数据库名称", + "type": "string" + }, + "joinTemplate": { + "type": "array", + "items": { + "$ref": "#/definitions/system.JoinTemplate" + } + }, + "limit": { "type": "integer" + }, + "name": { + "description": "模板名称", + "type": "string" + }, + "order": { + "type": "string" + }, + "tableName": { + "description": "表名称", + "type": "string" + }, + "templateID": { + "description": "模板标识", + "type": "string" + }, + "templateInfo": { + "description": "模板信息", + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" } } }, @@ -6813,7 +7391,7 @@ const docTemplate = `{ } }, "menuId": { - "type": "string" + "type": "integer" }, "meta": { "description": "附加属性", @@ -6835,7 +7413,7 @@ const docTemplate = `{ }, "parentId": { "description": "父菜单ID", - "type": "string" + "type": "integer" }, "path": { "description": "路由path", diff --git a/server/docs/swagger.json b/server/docs/swagger.json index 360a346023..81f89f847e 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -410,7 +410,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/response.SysAuthorityCopyResponse" + "$ref": "#/definitions/request.AuthorityCopy" } } ], @@ -425,9 +425,6 @@ { "type": "object", "properties": { - "data": { - "$ref": "#/definitions/response.SysAuthorityResponse" - }, "msg": { "type": "string" } @@ -3442,7 +3439,7 @@ "in": "query" }, { - "type": "integer", + "type": "string", "description": "字典值", "name": "value", "in": "query" @@ -3559,7 +3556,7 @@ "in": "query" }, { - "type": "integer", + "type": "string", "description": "字典值", "name": "value", "in": "query" @@ -3640,7 +3637,7 @@ } } }, - "/sysOperationRecord/createSysOperationRecord": { + "/sysExportTemplate/createSysExportTemplate": { "post": { "security": [ { @@ -3654,43 +3651,31 @@ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "创建SysOperationRecord", + "summary": "创建导出模板", "parameters": [ { - "description": "创建SysOperationRecord", + "description": "创建导出模板", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/system.SysOperationRecord" + "$ref": "#/definitions/system.SysExportTemplate" } } ], "responses": { "200": { - "description": "创建SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/deleteSysOperationRecord": { + "/sysExportTemplate/deleteSysExportTemplate": { "delete": { "security": [ { @@ -3704,43 +3689,31 @@ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "删除SysOperationRecord", + "summary": "删除导出模板", "parameters": [ { - "description": "SysOperationRecord模型", + "description": "删除导出模板", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/system.SysOperationRecord" + "$ref": "#/definitions/system.SysExportTemplate" } } ], "responses": { "200": { - "description": "删除SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"删除成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/deleteSysOperationRecordByIds": { + "/sysExportTemplate/deleteSysExportTemplateByIds": { "delete": { "security": [ { @@ -3754,12 +3727,12 @@ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "批量删除SysOperationRecord", + "summary": "批量删除导出模板", "parameters": [ { - "description": "批量删除SysOperationRecord", + "description": "批量删除导出模板", "name": "data", "in": "body", "required": true, @@ -3770,27 +3743,15 @@ ], "responses": { "200": { - "description": "批量删除SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"批量删除成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/findSysOperationRecord": { + "/sysExportTemplate/exportExcel": { "get": { "security": [ { @@ -3804,9 +3765,29 @@ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "用id查询SysOperationRecord", + "summary": "导出表格模板", + "responses": {} + } + }, + "/sysExportTemplate/findSysExportTemplate": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysExportTemplate" + ], + "summary": "用id查询导出模板", "parameters": [ { "type": "integer", @@ -3814,18 +3795,6 @@ "name": "ID", "in": "query" }, - { - "type": "string", - "description": "代理", - "name": "agent", - "in": "query" - }, - { - "type": "string", - "description": "请求Body", - "name": "body", - "in": "query" - }, { "type": "string", "description": "创建时间", @@ -3834,44 +3803,42 @@ }, { "type": "string", - "description": "错误信息", - "name": "error_message", + "description": "数据库名称", + "name": "dbName", "in": "query" }, { - "type": "string", - "description": "请求ip", - "name": "ip", + "type": "integer", + "name": "limit", "in": "query" }, { "type": "string", - "description": "延迟", - "name": "latency", + "description": "模板名称", + "name": "name", "in": "query" }, { "type": "string", - "description": "请求方法", - "name": "method", + "name": "order", "in": "query" }, { "type": "string", - "description": "请求路径", - "name": "path", + "description": "表名称", + "name": "tableName", "in": "query" }, { "type": "string", - "description": "响应Body", - "name": "resp", + "description": "模板标识", + "name": "templateID", "in": "query" }, { - "type": "integer", - "description": "请求状态", - "name": "status", + "type": "string", + "description": "模板信息", + "name": "templateInfo", "in": "query" }, { @@ -3879,41 +3846,19 @@ "description": "更新时间", "name": "updatedAt", "in": "query" - }, - { - "type": "integer", - "description": "用户id", - "name": "user_id", - "in": "query" } ], "responses": { "200": { - "description": "用id查询SysOperationRecord", + "description": "{\"success\":true,\"data\":{},\"msg\":\"查询成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "additionalProperties": true - }, - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/sysOperationRecord/getSysOperationRecordList": { + "/sysExportTemplate/getSysExportTemplateList": { "get": { "security": [ { @@ -3927,9 +3872,9 @@ "application/json" ], "tags": [ - "SysOperationRecord" + "SysExportTemplate" ], - "summary": "分页获取SysOperationRecord列表", + "summary": "分页获取导出模板列表", "parameters": [ { "type": "integer", @@ -3937,18 +3882,6 @@ "name": "ID", "in": "query" }, - { - "type": "string", - "description": "代理", - "name": "agent", - "in": "query" - }, - { - "type": "string", - "description": "请求Body", - "name": "body", - "in": "query" - }, { "type": "string", "description": "创建时间", @@ -3957,14 +3890,13 @@ }, { "type": "string", - "description": "错误信息", - "name": "error_message", + "description": "数据库名称", + "name": "dbName", "in": "query" }, { "type": "string", - "description": "请求ip", - "name": "ip", + "name": "endCreatedAt", "in": "query" }, { @@ -3973,16 +3905,20 @@ "name": "keyword", "in": "query" }, + { + "type": "integer", + "name": "limit", + "in": "query" + }, { "type": "string", - "description": "延迟", - "name": "latency", + "description": "模板名称", + "name": "name", "in": "query" }, { "type": "string", - "description": "请求方法", - "name": "method", + "name": "order", "in": "query" }, { @@ -3999,122 +3935,577 @@ }, { "type": "string", - "description": "请求路径", - "name": "path", + "name": "startCreatedAt", "in": "query" }, { "type": "string", - "description": "响应Body", - "name": "resp", + "description": "表名称", + "name": "tableName", "in": "query" }, { - "type": "integer", - "description": "请求状态", - "name": "status", + "type": "string", + "description": "模板标识", + "name": "templateID", "in": "query" }, { "type": "string", - "description": "更新时间", - "name": "updatedAt", + "description": "模板信息", + "name": "templateInfo", "in": "query" }, { - "type": "integer", - "description": "用户id", - "name": "user_id", + "type": "string", + "description": "更新时间", + "name": "updatedAt", "in": "query" } ], "responses": { "200": { - "description": "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量", + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "data": { - "$ref": "#/definitions/response.PageResult" - }, - "msg": { - "type": "string" - } - } - } - ] + "type": "string" } } } } }, - "/system/getServerInfo": { + "/sysExportTemplate/importExcel": { "post": { "security": [ { "ApiKeyAuth": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "System" + "SysImportTemplate" ], - "summary": "获取服务器信息", - "responses": { - "200": { - "description": "获取服务器信息", - "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, - { - "type": "object", - "properties": { - "data": { - "type": "object", - "additionalProperties": true - }, - "msg": { - "type": "string" - } - } - } - ] - } - } - } + "summary": "导入表格", + "responses": {} } }, - "/system/getSystemConfig": { - "post": { + "/sysExportTemplate/updateSysExportTemplate": { + "put": { "security": [ { "ApiKeyAuth": [] } ], + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], "tags": [ - "System" + "SysExportTemplate" + ], + "summary": "更新导出模板", + "parameters": [ + { + "description": "更新导出模板", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.SysExportTemplate" + } + } ], - "summary": "获取配置文件内容", "responses": { "200": { - "description": "获取配置文件内容,返回包括系统配置", + "description": "{\"success\":true,\"data\":{},\"msg\":\"更新成功\"}", "schema": { - "allOf": [ - { - "$ref": "#/definitions/response.Response" - }, + "type": "string" + } + } + } + } + }, + "/sysOperationRecord/createSysOperationRecord": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "创建SysOperationRecord", + "parameters": [ + { + "description": "创建SysOperationRecord", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.SysOperationRecord" + } + } + ], + "responses": { + "200": { + "description": "创建SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/deleteSysOperationRecord": { + "delete": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "删除SysOperationRecord", + "parameters": [ + { + "description": "SysOperationRecord模型", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/system.SysOperationRecord" + } + } + ], + "responses": { + "200": { + "description": "删除SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/deleteSysOperationRecordByIds": { + "delete": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "批量删除SysOperationRecord", + "parameters": [ + { + "description": "批量删除SysOperationRecord", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.IdsReq" + } + } + ], + "responses": { + "200": { + "description": "批量删除SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/findSysOperationRecord": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "用id查询SysOperationRecord", + "parameters": [ + { + "type": "integer", + "description": "主键ID", + "name": "ID", + "in": "query" + }, + { + "type": "string", + "description": "代理", + "name": "agent", + "in": "query" + }, + { + "type": "string", + "description": "请求Body", + "name": "body", + "in": "query" + }, + { + "type": "string", + "description": "创建时间", + "name": "createdAt", + "in": "query" + }, + { + "type": "string", + "description": "错误信息", + "name": "error_message", + "in": "query" + }, + { + "type": "string", + "description": "请求ip", + "name": "ip", + "in": "query" + }, + { + "type": "string", + "description": "延迟", + "name": "latency", + "in": "query" + }, + { + "type": "string", + "description": "请求方法", + "name": "method", + "in": "query" + }, + { + "type": "string", + "description": "请求路径", + "name": "path", + "in": "query" + }, + { + "type": "string", + "description": "响应Body", + "name": "resp", + "in": "query" + }, + { + "type": "integer", + "description": "请求状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "更新时间", + "name": "updatedAt", + "in": "query" + }, + { + "type": "integer", + "description": "用户id", + "name": "user_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "用id查询SysOperationRecord", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": true + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/sysOperationRecord/getSysOperationRecordList": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysOperationRecord" + ], + "summary": "分页获取SysOperationRecord列表", + "parameters": [ + { + "type": "integer", + "description": "主键ID", + "name": "ID", + "in": "query" + }, + { + "type": "string", + "description": "代理", + "name": "agent", + "in": "query" + }, + { + "type": "string", + "description": "请求Body", + "name": "body", + "in": "query" + }, + { + "type": "string", + "description": "创建时间", + "name": "createdAt", + "in": "query" + }, + { + "type": "string", + "description": "错误信息", + "name": "error_message", + "in": "query" + }, + { + "type": "string", + "description": "请求ip", + "name": "ip", + "in": "query" + }, + { + "type": "string", + "description": "关键字", + "name": "keyword", + "in": "query" + }, + { + "type": "string", + "description": "延迟", + "name": "latency", + "in": "query" + }, + { + "type": "string", + "description": "请求方法", + "name": "method", + "in": "query" + }, + { + "type": "integer", + "description": "页码", + "name": "page", + "in": "query" + }, + { + "type": "integer", + "description": "每页大小", + "name": "pageSize", + "in": "query" + }, + { + "type": "string", + "description": "请求路径", + "name": "path", + "in": "query" + }, + { + "type": "string", + "description": "响应Body", + "name": "resp", + "in": "query" + }, + { + "type": "integer", + "description": "请求状态", + "name": "status", + "in": "query" + }, + { + "type": "string", + "description": "更新时间", + "name": "updatedAt", + "in": "query" + }, + { + "type": "integer", + "description": "用户id", + "name": "user_id", + "in": "query" + } + ], + "responses": { + "200": { + "description": "分页获取SysOperationRecord列表,返回包括列表,总数,页码,每页数量", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "$ref": "#/definitions/response.PageResult" + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/system/getServerInfo": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "System" + ], + "summary": "获取服务器信息", + "responses": { + "200": { + "description": "获取服务器信息", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, + { + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": true + }, + "msg": { + "type": "string" + } + } + } + ] + } + } + } + } + }, + "/system/getSystemConfig": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "produces": [ + "application/json" + ], + "tags": [ + "System" + ], + "summary": "获取配置文件内容", + "responses": { + "200": { + "description": "获取配置文件内容,返回包括系统配置", + "schema": { + "allOf": [ + { + "$ref": "#/definitions/response.Response" + }, { "type": "object", "properties": { @@ -4871,6 +5262,14 @@ } } }, + "config.DiskList": { + "type": "object", + "properties": { + "mount-point": { + "type": "string" + } + } + }, "config.Excel": { "type": "object", "properties": { @@ -4936,6 +5335,10 @@ "config.Mongo": { "type": "object", "properties": { + "auth-source": { + "description": "验证数据库", + "type": "string" + }, "coll": { "description": "collection name", "type": "string" @@ -5258,13 +5661,24 @@ "description": "服务器地址:端口", "type": "string" }, + "clusterAddrs": { + "description": "集群模式下的节点地址列表", + "type": "array", + "items": { + "type": "string" + } + }, "db": { - "description": "redis的哪个数据库", + "description": "单实例模式下redis的哪个数据库", "type": "integer" }, "password": { "description": "密码", "type": "string" + }, + "useCluster": { + "description": "是否使用集群模式", + "type": "boolean" } } }, @@ -5302,6 +5716,12 @@ "$ref": "#/definitions/config.SpecializedDB" } }, + "disk-list": { + "type": "array", + "items": { + "$ref": "#/definitions/config.DiskList" + } + }, "email": { "$ref": "#/definitions/github_com_flipped-aurora_gin-vue-admin_server_config.Email" }, @@ -5492,10 +5912,6 @@ "description": "数据库类型:mysql(默认)|sqlite|sqlserver|postgresql", "type": "string" }, - "env": { - "description": "环境值", - "type": "string" - }, "iplimit-count": { "type": "integer" }, @@ -5510,7 +5926,7 @@ "type": "string" }, "use-mongo": { - "description": "使用redis", + "description": "使用mongo", "type": "boolean" }, "use-multipoint": { @@ -5569,10 +5985,6 @@ "description": "输出控制台", "type": "boolean" }, - "max-age": { - "description": "日志留存时间", - "type": "integer" - }, "prefix": { "description": "日志前缀", "type": "string" @@ -5773,6 +6185,17 @@ } } }, + "request.AuthorityCopy": { + "type": "object", + "properties": { + "authority": { + "$ref": "#/definitions/system.SysAuthority" + }, + "oldAuthorityId": { + "type": "integer" + } + } + }, "request.CasbinInReceive": { "type": "object", "properties": { @@ -5849,9 +6272,13 @@ "request.InitDB": { "type": "object", "required": [ + "adminPassword", "dbName" ], "properties": { + "adminPassword": { + "type": "string" + }, "dbName": { "description": "数据库名", "type": "string" @@ -6216,18 +6643,6 @@ } } }, - "response.SysAuthorityCopyResponse": { - "type": "object", - "properties": { - "authority": { - "$ref": "#/definitions/system.SysAuthority" - }, - "oldAuthorityId": { - "description": "旧角色ID", - "type": "integer" - } - } - }, "response.SysAuthorityResponse": { "type": "object", "properties": { @@ -6310,12 +6725,12 @@ "description": "是否自动创建api", "type": "boolean" }, - "autoCreateResource": { - "description": "是否自动创建资源标识", + "autoCreateMenuToSql": { + "description": "是否自动创建menu", "type": "boolean" }, - "autoMoveFile": { - "description": "是否自动移动文件", + "autoCreateResource": { + "description": "是否自动创建资源标识", "type": "boolean" }, "businessDB": { @@ -6332,7 +6747,8 @@ "$ref": "#/definitions/system.Field" } }, - "hasTimer": { + "gvaModel": { + "description": "是否使用gva默认Model", "type": "boolean" }, "humpPackageName": { @@ -6346,6 +6762,9 @@ "description": "文件名称", "type": "string" }, + "primaryField": { + "$ref": "#/definitions/system.Field" + }, "structName": { "description": "Struct名称", "type": "string" @@ -6356,9 +6775,60 @@ } } }, + "system.Condition": { + "type": "object", + "properties": { + "ID": { + "description": "主键ID", + "type": "integer" + }, + "column": { + "type": "string" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "from": { + "type": "string" + }, + "operator": { + "type": "string" + }, + "templateID": { + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, + "system.DataSource": { + "type": "object", + "properties": { + "association": { + "description": "关联关系 1 一对一 2 一对多", + "type": "integer" + }, + "label": { + "type": "string" + }, + "table": { + "type": "string" + }, + "value": { + "type": "string" + } + } + }, "system.Field": { "type": "object", "properties": { + "checkDataSource": { + "description": "是否检查数据源", + "type": "boolean" + }, "clearable": { "description": "是否可清空", "type": "boolean" @@ -6371,10 +6841,22 @@ "description": "数据库字段描述", "type": "string" }, + "dataSource": { + "description": "数据源", + "allOf": [ + { + "$ref": "#/definitions/system.DataSource" + } + ] + }, "dataTypeLong": { "description": "数据库字段长度", "type": "string" }, + "defaultValue": { + "description": "是否必填", + "type": "string" + }, "dictType": { "description": "字典", "type": "string" @@ -6395,6 +6877,10 @@ "description": "Field名", "type": "string" }, + "fieldSearchHide": { + "description": "是否隐藏查询条件", + "type": "boolean" + }, "fieldSearchType": { "description": "搜索条件", "type": "string" @@ -6403,6 +6889,14 @@ "description": "Field数据类型", "type": "string" }, + "front": { + "description": "是否前端可见", + "type": "boolean" + }, + "primaryKey": { + "description": "是否主键", + "type": "boolean" + }, "require": { "description": "是否必填", "type": "boolean" @@ -6413,6 +6907,35 @@ } } }, + "system.JoinTemplate": { + "type": "object", + "properties": { + "ID": { + "description": "主键ID", + "type": "integer" + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "joins": { + "type": "string" + }, + "on": { + "type": "string" + }, + "table": { + "type": "string" + }, + "templateID": { + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" + } + } + }, "system.Meta": { "type": "object", "properties": { @@ -6607,7 +7130,7 @@ }, "parentId": { "description": "父菜单ID", - "type": "string" + "type": "integer" }, "path": { "description": "路由path", @@ -6757,7 +7280,62 @@ }, "value": { "description": "字典值", + "type": "string" + } + } + }, + "system.SysExportTemplate": { + "type": "object", + "properties": { + "ID": { + "description": "主键ID", + "type": "integer" + }, + "conditions": { + "type": "array", + "items": { + "$ref": "#/definitions/system.Condition" + } + }, + "createdAt": { + "description": "创建时间", + "type": "string" + }, + "dbName": { + "description": "数据库名称", + "type": "string" + }, + "joinTemplate": { + "type": "array", + "items": { + "$ref": "#/definitions/system.JoinTemplate" + } + }, + "limit": { "type": "integer" + }, + "name": { + "description": "模板名称", + "type": "string" + }, + "order": { + "type": "string" + }, + "tableName": { + "description": "表名称", + "type": "string" + }, + "templateID": { + "description": "模板标识", + "type": "string" + }, + "templateInfo": { + "description": "模板信息", + "type": "string" + }, + "updatedAt": { + "description": "更新时间", + "type": "string" } } }, @@ -6805,7 +7383,7 @@ } }, "menuId": { - "type": "string" + "type": "integer" }, "meta": { "description": "附加属性", @@ -6827,7 +7405,7 @@ }, "parentId": { "description": "父菜单ID", - "type": "string" + "type": "integer" }, "path": { "description": "路由path", @@ -6985,4 +7563,4 @@ "in": "header" } } -} +} \ No newline at end of file diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index 0b7167cfb7..8eb9afe4b7 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -106,6 +106,11 @@ definitions: description: 防爆破验证码超时时间,单位:s(秒) type: integer type: object + config.DiskList: + properties: + mount-point: + type: string + type: object config.Excel: properties: dir: @@ -150,6 +155,9 @@ definitions: type: object config.Mongo: properties: + auth-source: + description: 验证数据库 + type: string coll: description: collection name type: string @@ -384,12 +392,20 @@ definitions: addr: description: 服务器地址:端口 type: string + clusterAddrs: + description: 集群模式下的节点地址列表 + items: + type: string + type: array db: - description: redis的哪个数据库 + description: 单实例模式下redis的哪个数据库 type: integer password: description: 密码 type: string + useCluster: + description: 是否使用集群模式 + type: boolean type: object config.Server: properties: @@ -411,6 +427,10 @@ definitions: items: $ref: '#/definitions/config.SpecializedDB' type: array + disk-list: + items: + $ref: '#/definitions/config.DiskList' + type: array email: $ref: '#/definitions/github_com_flipped-aurora_gin-vue-admin_server_config.Email' excel: @@ -542,9 +562,6 @@ definitions: db-type: description: 数据库类型:mysql(默认)|sqlite|sqlserver|postgresql type: string - env: - description: 环境值 - type: string iplimit-count: type: integer iplimit-time: @@ -555,7 +572,7 @@ definitions: router-prefix: type: string use-mongo: - description: 使用redis + description: 使用mongo type: boolean use-multipoint: description: 多点登录拦截 @@ -596,9 +613,6 @@ definitions: log-in-console: description: 输出控制台 type: boolean - max-age: - description: 日志留存时间 - type: integer prefix: description: 日志前缀 type: string @@ -739,6 +753,13 @@ definitions: $ref: '#/definitions/system.SysBaseMenu' type: array type: object + request.AuthorityCopy: + properties: + authority: + $ref: '#/definitions/system.SysAuthority' + oldAuthorityId: + type: integer + type: object request.CasbinInReceive: properties: authorityId: @@ -790,6 +811,8 @@ definitions: type: object request.InitDB: properties: + adminPassword: + type: string dbName: description: 数据库名 type: string @@ -812,6 +835,7 @@ definitions: description: 数据库用户名 type: string required: + - adminPassword - dbName type: object request.Login: @@ -1043,14 +1067,6 @@ definitions: type: integer type: array type: object - response.SysAuthorityCopyResponse: - properties: - authority: - $ref: '#/definitions/system.SysAuthority' - oldAuthorityId: - description: 旧角色ID - type: integer - type: object response.SysAuthorityResponse: properties: authority: @@ -1104,12 +1120,12 @@ definitions: autoCreateApiToSql: description: 是否自动创建api type: boolean + autoCreateMenuToSql: + description: 是否自动创建menu + type: boolean autoCreateResource: description: 是否自动创建资源标识 type: boolean - autoMoveFile: - description: 是否自动移动文件 - type: boolean businessDB: description: 业务数据库 type: string @@ -1120,7 +1136,8 @@ definitions: items: $ref: '#/definitions/system.Field' type: array - hasTimer: + gvaModel: + description: 是否使用gva默认Model type: boolean humpPackageName: description: go文件名称 @@ -1130,6 +1147,8 @@ definitions: packageName: description: 文件名称 type: string + primaryField: + $ref: '#/definitions/system.Field' structName: description: Struct名称 type: string @@ -1137,8 +1156,43 @@ definitions: description: 表名 type: string type: object + system.Condition: + properties: + ID: + description: 主键ID + type: integer + column: + type: string + createdAt: + description: 创建时间 + type: string + from: + type: string + operator: + type: string + templateID: + type: string + updatedAt: + description: 更新时间 + type: string + type: object + system.DataSource: + properties: + association: + description: 关联关系 1 一对一 2 一对多 + type: integer + label: + type: string + table: + type: string + value: + type: string + type: object system.Field: properties: + checkDataSource: + description: 是否检查数据源 + type: boolean clearable: description: 是否可清空 type: boolean @@ -1148,9 +1202,16 @@ definitions: comment: description: 数据库字段描述 type: string + dataSource: + allOf: + - $ref: '#/definitions/system.DataSource' + description: 数据源 dataTypeLong: description: 数据库字段长度 type: string + defaultValue: + description: 是否必填 + type: string dictType: description: 字典 type: string @@ -1166,12 +1227,21 @@ definitions: fieldName: description: Field名 type: string + fieldSearchHide: + description: 是否隐藏查询条件 + type: boolean fieldSearchType: description: 搜索条件 type: string fieldType: description: Field数据类型 type: string + front: + description: 是否前端可见 + type: boolean + primaryKey: + description: 是否主键 + type: boolean require: description: 是否必填 type: boolean @@ -1179,6 +1249,26 @@ definitions: description: 是否增加排序 type: boolean type: object + system.JoinTemplate: + properties: + ID: + description: 主键ID + type: integer + createdAt: + description: 创建时间 + type: string + joins: + type: string + "on": + type: string + table: + type: string + templateID: + type: string + updatedAt: + description: 更新时间 + type: string + type: object system.Meta: properties: activeName: @@ -1315,7 +1405,7 @@ definitions: type: array parentId: description: 父菜单ID - type: string + type: integer path: description: 路由path type: string @@ -1423,7 +1513,46 @@ definitions: type: string value: description: 字典值 + type: string + type: object + system.SysExportTemplate: + properties: + ID: + description: 主键ID + type: integer + conditions: + items: + $ref: '#/definitions/system.Condition' + type: array + createdAt: + description: 创建时间 + type: string + dbName: + description: 数据库名称 + type: string + joinTemplate: + items: + $ref: '#/definitions/system.JoinTemplate' + type: array + limit: type: integer + name: + description: 模板名称 + type: string + order: + type: string + tableName: + description: 表名称 + type: string + templateID: + description: 模板标识 + type: string + templateInfo: + description: 模板信息 + type: string + updatedAt: + description: 更新时间 + type: string type: object system.SysMenu: properties: @@ -1456,7 +1585,7 @@ definitions: $ref: '#/definitions/system.SysBaseMenuBtn' type: array menuId: - type: string + type: integer meta: allOf: - $ref: '#/definitions/system.Meta' @@ -1470,7 +1599,7 @@ definitions: type: array parentId: description: 父菜单ID - type: string + type: integer path: description: 路由path type: string @@ -1806,7 +1935,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/response.SysAuthorityCopyResponse' + $ref: '#/definitions/request.AuthorityCopy' produces: - application/json responses: @@ -1816,8 +1945,6 @@ paths: allOf: - $ref: '#/definitions/response.Response' - properties: - data: - $ref: '#/definitions/response.SysAuthorityResponse' msg: type: string type: object @@ -3532,7 +3659,7 @@ paths: - description: 字典值 in: query name: value - type: integer + type: string produces: - application/json responses: @@ -3605,7 +3732,7 @@ paths: - description: 字典值 in: query name: value - type: integer + type: string produces: - application/json responses: @@ -3653,6 +3780,250 @@ paths: summary: 更新SysDictionaryDetail tags: - SysDictionaryDetail + /sysExportTemplate/createSysExportTemplate: + post: + consumes: + - application/json + parameters: + - description: 创建导出模板 + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.SysExportTemplate' + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"创建成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 创建导出模板 + tags: + - SysExportTemplate + /sysExportTemplate/deleteSysExportTemplate: + delete: + consumes: + - application/json + parameters: + - description: 删除导出模板 + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.SysExportTemplate' + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"删除成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 删除导出模板 + tags: + - SysExportTemplate + /sysExportTemplate/deleteSysExportTemplateByIds: + delete: + consumes: + - application/json + parameters: + - description: 批量删除导出模板 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.IdsReq' + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"批量删除成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 批量删除导出模板 + tags: + - SysExportTemplate + /sysExportTemplate/exportExcel: + get: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - ApiKeyAuth: [] + summary: 导出表格模板 + tags: + - SysExportTemplate + /sysExportTemplate/findSysExportTemplate: + get: + consumes: + - application/json + parameters: + - description: 主键ID + in: query + name: ID + type: integer + - description: 创建时间 + in: query + name: createdAt + type: string + - description: 数据库名称 + in: query + name: dbName + type: string + - in: query + name: limit + type: integer + - description: 模板名称 + in: query + name: name + type: string + - in: query + name: order + type: string + - description: 表名称 + in: query + name: tableName + type: string + - description: 模板标识 + in: query + name: templateID + type: string + - description: 模板信息 + in: query + name: templateInfo + type: string + - description: 更新时间 + in: query + name: updatedAt + type: string + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"查询成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 用id查询导出模板 + tags: + - SysExportTemplate + /sysExportTemplate/getSysExportTemplateList: + get: + consumes: + - application/json + parameters: + - description: 主键ID + in: query + name: ID + type: integer + - description: 创建时间 + in: query + name: createdAt + type: string + - description: 数据库名称 + in: query + name: dbName + type: string + - in: query + name: endCreatedAt + type: string + - description: 关键字 + in: query + name: keyword + type: string + - in: query + name: limit + type: integer + - description: 模板名称 + in: query + name: name + type: string + - in: query + name: order + type: string + - description: 页码 + in: query + name: page + type: integer + - description: 每页大小 + in: query + name: pageSize + type: integer + - in: query + name: startCreatedAt + type: string + - description: 表名称 + in: query + name: tableName + type: string + - description: 模板标识 + in: query + name: templateID + type: string + - description: 模板信息 + in: query + name: templateInfo + type: string + - description: 更新时间 + in: query + name: updatedAt + type: string + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 分页获取导出模板列表 + tags: + - SysExportTemplate + /sysExportTemplate/importExcel: + post: + consumes: + - application/json + produces: + - application/json + responses: {} + security: + - ApiKeyAuth: [] + summary: 导入表格 + tags: + - SysImportTemplate + /sysExportTemplate/updateSysExportTemplate: + put: + consumes: + - application/json + parameters: + - description: 更新导出模板 + in: body + name: data + required: true + schema: + $ref: '#/definitions/system.SysExportTemplate' + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"更新成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 更新导出模板 + tags: + - SysExportTemplate /sysOperationRecord/createSysOperationRecord: post: consumes: diff --git a/server/go.mod b/server/go.mod index 89e1e6750b..56005379b9 100644 --- a/server/go.mod +++ b/server/go.mod @@ -18,6 +18,7 @@ require ( github.com/gookit/color v1.5.4 github.com/huaweicloud/huaweicloud-sdk-go-obs v3.21.8+incompatible github.com/jordan-wright/email v0.0.0-20200824153738-3f5bafa1cd84 + github.com/mholt/archiver/v4 v4.0.0-alpha.8 github.com/mojocn/base64Captcha v1.3.6 github.com/otiai10/copy v1.7.0 github.com/pkg/errors v0.9.1 @@ -102,7 +103,6 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mholt/archiver/v4 v4.0.0-alpha.8 // indirect github.com/microsoft/go-mssqldb v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -150,7 +150,6 @@ require ( google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/datatypes v1.2.0 // indirect gorm.io/plugin/dbresolver v1.4.1 // indirect modernc.org/libc v1.24.1 // indirect modernc.org/mathutil v1.5.0 // indirect diff --git a/server/go.sum b/server/go.sum index a2dbdfcb6b..a386b929f0 100644 --- a/server/go.sum +++ b/server/go.sum @@ -206,7 +206,6 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -306,7 +305,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= @@ -339,8 +337,6 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= -github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg= github.com/mholt/archiver/v4 v4.0.0-alpha.8 h1:tRGQuDVPh66WCOelqe6LIGh0gwmfwxUrSSDunscGsRM= github.com/mholt/archiver/v4 v4.0.0-alpha.8/go.mod h1:5f7FUYGXdJWUjESffJaYR4R60VhnHxb2X3T1teMyv5A= github.com/microsoft/go-mssqldb v1.1.0 h1:jsV+tpvcPTbNNKW0o3kiCD69kOHICsfjZ2VcVu2lKYc= @@ -895,15 +891,11 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gorm.io/datatypes v1.2.0 h1:5YT+eokWdIxhJgWHdrb2zYUimyk0+TaFth+7a0ybzco= -gorm.io/datatypes v1.2.0/go.mod h1:o1dh0ZvjIjhH/bngTpypG6lVRJ5chTBxE09FH/71k04= gorm.io/driver/mysql v1.4.3/go.mod h1:sSIebwZAVPiT+27jK9HIwvsqOGKx3YMPmrA3mBJR10c= gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8= gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM= gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA= -gorm.io/driver/sqlite v1.4.3 h1:HBBcZSDnWi5BW3B3rwvVTc510KGkBkexlOg0QrmLUuU= -gorm.io/driver/sqlite v1.4.3/go.mod h1:0Aq3iPO+v9ZKbcdiz8gLWRw5VOPcBOPUQJFLq5e2ecI= gorm.io/driver/sqlserver v1.5.1 h1:wpyW/pR26U94uaujltiFGXY7fd2Jw5hC9PB1ZF/Y5s4= gorm.io/driver/sqlserver v1.5.1/go.mod h1:AYHzzte2msKTmYBYsSIq8ZUsznLJwBdkB2wpI+kt0nM= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= diff --git a/server/main.go b/server/main.go index 69584ca1f1..0ca12fb539 100644 --- a/server/main.go +++ b/server/main.go @@ -14,13 +14,13 @@ import ( //go:generate go mod tidy //go:generate go mod download -// @title Gin-Vue-Admin Swagger API接口文档 -// @version v2.6.5 -// @description 使用gin+vue进行极速开发的全栈开发基础平台 -// @securityDefinitions.apikey ApiKeyAuth -// @in header -// @name x-token -// @BasePath / +// @title Gin-Vue-Admin Swagger API接口文档 +// @version v2.6.5 +// @description 使用gin+vue进行极速开发的全栈开发基础平台 +// @securityDefinitions.apikey ApiKeyAuth +// @in header +// @name x-token +// @BasePath / func main() { global.GVA_VP = core.Viper() // 初始化Viper initialize.OtherInit() diff --git a/server/model/system/request/sys_authority.go b/server/model/system/request/sys_authority.go new file mode 100644 index 0000000000..eb5dbbfa5c --- /dev/null +++ b/server/model/system/request/sys_authority.go @@ -0,0 +1,16 @@ +package request + +import "github.com/flipped-aurora/gin-vue-admin/server/model/system" + +type AuthorityCopy struct { + OldAuthorityId uint `json:"oldAuthorityId"` + Authority system.SysAuthority `json:"authority"` +} + +func (r *AuthorityCopy) Create() system.SysAuthority { + return system.SysAuthority{ + AuthorityId: r.Authority.AuthorityId, + AuthorityName: r.Authority.AuthorityName, + DefaultRouter: r.Authority.DefaultRouter, + } +} diff --git a/server/plugin/email/api/sys_email.go b/server/plugin/email/api/sys_email.go index fdc76ab64e..4ba165a713 100644 --- a/server/plugin/email/api/sys_email.go +++ b/server/plugin/email/api/sys_email.go @@ -12,12 +12,13 @@ import ( type EmailApi struct{} // EmailTest -// @Tags System -// @Summary 发送测试邮件 -// @Security ApiKeyAuth -// @Produce application/json -// @Success 200 {string} string "{"success":true,"data":{},"msg":"发送成功"}" -// @Router /email/emailTest [post] +// +// @Tags System +// @Summary 发送测试邮件 +// @Security ApiKeyAuth +// @Produce application/json +// @Success 200 {string} string "{"success":true,"data":{},"msg":"发送成功"}" +// @Router /email/emailTest [post] func (s *EmailApi) EmailTest(c *gin.Context) { err := service.ServiceGroupApp.EmailTest() if err != nil { @@ -29,13 +30,14 @@ func (s *EmailApi) EmailTest(c *gin.Context) { } // SendEmail -// @Tags System -// @Summary 发送邮件 -// @Security ApiKeyAuth -// @Produce application/json -// @Param data body email_response.Email true "发送邮件必须的参数" -// @Success 200 {string} string "{"success":true,"data":{},"msg":"发送成功"}" -// @Router /email/sendEmail [post] +// +// @Tags System +// @Summary 发送邮件 +// @Security ApiKeyAuth +// @Produce application/json +// @Param data body email_response.Email true "发送邮件必须的参数" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"发送成功"}" +// @Router /email/sendEmail [post] func (s *EmailApi) SendEmail(c *gin.Context) { var email email_response.Email err := c.ShouldBindJSON(&email) diff --git a/server/service/system/internal/authority.go b/server/service/system/internal/authority.go new file mode 100644 index 0000000000..3399fb56b9 --- /dev/null +++ b/server/service/system/internal/authority.go @@ -0,0 +1,306 @@ +package internal + +import ( + "context" + "fmt" + "github.com/flipped-aurora/gin-vue-admin/server/global" + model "github.com/flipped-aurora/gin-vue-admin/server/model/system" + "github.com/pkg/errors" + "gorm.io/gorm" + "strconv" + "strings" +) + +var Authority = new(authority) + +type authority struct{} + +// Tree . +// tree: map[uint][]model.SysAuthority => map[父角色id][]子角色 +// ids: map[uint][]uint => map[角色id][]子角色id +func (a *authority) Tree(ctx context.Context) (tree map[uint][]model.SysAuthority, ids map[uint][]uint, err error) { + ids = make(map[uint][]uint, 10) + tree = make(map[uint][]model.SysAuthority, 10) + var entities []model.SysAuthority + err = global.GVA_DB.WithContext(ctx).FindInBatches(&entities, 10, func(tx *gorm.DB, batch int) error { + for i := 0; i < batch; i++ { + v1, ok := tree[*entities[i].ParentId] + if !ok { + v1 = make([]model.SysAuthority, 0) + } + v1 = append(v1, entities[i]) + tree[*entities[i].ParentId] = v1 + v2, o2 := ids[entities[i].AuthorityId] + if !o2 { + v2 = make([]uint, 0) + } + v2 = append(v2, entities[i].AuthorityId) + ids[entities[i].AuthorityId] = v2 + } + return nil + }).Error + if err != nil { + return nil, nil, errors.Wrap(err, "查询失败!") + } + return tree, ids, nil +} + +// Children . +// tree: map[uint][]model.SysAuthority => map[父角色id][]子角色 +// entity: *model.SysAuthority => 角色 +func (a *authority) Children(tree map[uint][]model.SysAuthority, entity *model.SysAuthority) { + value, ok := tree[entity.AuthorityId] + if ok { + entity.Children = value + for i := 0; i < len(entity.Children); i++ { + a.Children(tree, &value[i]) + } + } +} + +// Copy 复制角色 +// ids: map[uint][]uint => map[角色id][]子角色id +// creates: map[uint]uint => map[原角色id]新角色id +// entity: *model.SysAuthority => 原角色 +// parent: model.SysAuthority => 新角色 +func (a *authority) Copy(ids map[uint][]uint, creates map[uint]uint, entity *model.SysAuthority, parent model.SysAuthority) []model.SysAuthority { + var entities []model.SysAuthority + a.CopyChildren(ids, creates, entity, parent, &entities, 1) + return entities +} + +// CopyChildren 复制角色的子角色 +// ids: map[uint][]uint => map[角色id][]子角色id +// creates: map[uint]uint => map[原角色id]新角色id +// entity: *model.SysAuthority => 原角色 +// parent: model.SysAuthority => 新角色 +// entities: *[]model.SysAuthority => 新角色集合 +// zi: uint => 子角色id +func (a *authority) CopyChildren(ids map[uint][]uint, creates map[uint]uint, entity *model.SysAuthority, parent model.SysAuthority, entities *[]model.SysAuthority, zi uint) { + var index int + for i := 0; i < len(entity.Children); i++ { + again: + id := parent.AuthorityId*10 + uint(i+index) + _, ok := ids[id] + if ok { + index++ + goto again + } + ids[id] = []uint{} + names := strings.Split(parent.AuthorityName, "子") + if len(names) == 0 { + return + } + name := names[0] + for j := 0; j < int(zi); j++ { + name += "子" + } + name += fmt.Sprintf("角色%d", i+1) + children := model.SysAuthority{ + AuthorityId: id, + AuthorityName: name, + DefaultRouter: entity.Children[i].DefaultRouter, + } + creates[entity.Children[i].AuthorityId] = children.AuthorityId + *entities = append(*entities, children) + a.CopyChildren(ids, creates, &entity.Children[i], children, entities, zi+1) + } +} + +// Menus . +// authorityMenus: map[uint][]model.SysBaseMenu => map[角色id][]菜单 +func (a *authority) Menus(ctx context.Context) (authorityMenus map[uint][]model.SysBaseMenu, err error) { + menus := make(map[uint]model.SysBaseMenu, 10) // map[MenuId][]model.SysBaseMenu + authoritiesMenus := make(map[uint][]uint, 10) // map[AuthorityId][]MenuId + authorityMenus = make(map[uint][]model.SysBaseMenu, 10) // map[AuthorityId][]model.SysBaseMenu + { + var entities []model.SysBaseMenu + err = global.GVA_DB.WithContext(ctx).FindInBatches(&entities, 10, func(tx *gorm.DB, batch int) error { + for i := 0; i < batch; i++ { + _, ok := menus[entities[i].ID] + if ok { + return errors.New("存在相同菜单id") + } + menus[entities[i].ID] = entities[i] + } + return nil + }).Error + if err != nil { + return nil, errors.Wrap(err, "获取所有菜单失败!") + } + } // 获取所有菜单 + { + authoritiesMenus, err = a.MenuIds(ctx) + if err != nil { + return nil, err + } + } // 获取角色对应的菜单 + { + for key, values := range authoritiesMenus { + v1, o1 := authorityMenus[key] + if !o1 { + v1 = make([]model.SysBaseMenu, 0) + } + for i := 0; i < len(values); i++ { + v2, o2 := menus[values[i]] + if o2 { + v1 = append(v1, v2) + } + } + authorityMenus[key] = v1 + } + } // 组装tree + return authorityMenus, nil +} + +// MenuIds . +// authorityMenus: map[uint][]uint => map[角色id][]菜单id +func (a *authority) MenuIds(ctx context.Context) (authorityMenus map[uint][]uint, err error) { + authorityMenus = make(map[uint][]uint, 10) + { + var entities []model.SysAuthorityMenu + err = global.GVA_DB.WithContext(ctx).FindInBatches(&entities, 10, func(tx *gorm.DB, batch int) error { + for i := 0; i < batch; i++ { + menuId, _ := strconv.ParseUint(entities[i].MenuId, 10, 64) + authorityId, _ := strconv.ParseUint(entities[i].AuthorityId, 10, 64) + value, ok := authorityMenus[uint(authorityId)] + if !ok { + value = make([]uint, 0) + } + value = append(value, uint(menuId)) + authorityMenus[uint(authorityId)] = value + } + return nil + }).Error + if err != nil { + return nil, errors.Wrap(err, "查询角色关联菜单关联表失败!") + } + } + return authorityMenus, nil +} + +// CopyMenus 复制角色的角色菜单 +// creates: map[uint]uint => map[原角色id]新角色id +func (a *authority) CopyMenus(ctx context.Context, creates map[uint]uint) ([]model.SysAuthorityMenu, error) { + menus, err := a.MenuIds(ctx) + if err != nil { + return nil, err + } + entities := make([]model.SysAuthorityMenu, len(creates)*len(menus)) + for key, value := range creates { + menu, ok := menus[key] + if ok { + for j := 0; j < len(menu); j++ { + menuId := strconv.FormatUint(uint64(menu[j]), 10) + authorityId := strconv.FormatUint(uint64(value), 10) + entities = append(entities, model.SysAuthorityMenu{ + MenuId: menuId, + AuthorityId: authorityId, + }) + } + } + } + return entities, nil +} + +func (a *authority) MenuButtons(ctx context.Context) (authorityMenuButtons map[uint][]model.SysBaseMenuBtn, err error) { + menuButtons := make(map[uint]model.SysBaseMenuBtn, 10) // map[MenuButtonId]model.SysAuthorityBtn + authoritiesMenuButtons := make(map[uint][]uint, 10) // map[AuthorityId][]MenuButtonId + authorityMenuButtons = make(map[uint][]model.SysBaseMenuBtn, 10) // map[AuthorityId][]model.SysAuthorityBtn + { + var entities []model.SysBaseMenuBtn + err = global.GVA_DB.WithContext(ctx).FindInBatches(&entities, 10, func(tx *gorm.DB, batch int) error { + for i := 0; i < batch; i++ { + _, ok := menuButtons[entities[i].ID] + if ok { + return errors.New("存在相同菜单按钮id") + } + menuButtons[entities[i].ID] = entities[i] + } + return nil + }).Error + } // 获取所有菜单按钮 + { + authoritiesMenuButtons, err = a.MenuButtonIds(ctx) + if err != nil { + return nil, err + } + } // 获取角色对应的菜单按钮 + { + for key, values := range authoritiesMenuButtons { + v1, o1 := authorityMenuButtons[key] + if !o1 { + v1 = make([]model.SysBaseMenuBtn, 0) + } + for i := 0; i < len(values); i++ { + v2, o2 := menuButtons[values[i]] + if o2 { + v1 = append(v1, v2) + } + } + authorityMenuButtons[key] = v1 + } + } // 组装 authorityMenuButtons + return authorityMenuButtons, nil +} + +func (a *authority) MenuButtonIds(ctx context.Context) (authorityMenuButtons map[uint][]uint, err error) { + authorityMenuButtons = make(map[uint][]uint, 10) + { + var entities []model.SysAuthorityBtn + err = global.GVA_DB.WithContext(ctx).FindInBatches(&entities, 10, func(tx *gorm.DB, batch int) error { + for i := 0; i < batch; i++ { + value, ok := authorityMenuButtons[entities[i].AuthorityId] + if !ok { + value = make([]uint, 0) + } + value = append(value, entities[i].SysBaseMenuBtnID) + authorityMenuButtons[entities[i].AuthorityId] = value + } + return nil + }).Error + if err != nil { + return nil, errors.Wrap(err, "查询角色关联菜单按钮关联表失败!") + } + } + return authorityMenuButtons, nil +} + +// CopyMenuButtons 复制角色的角色菜单按钮 +// creates: map[uint]uint => map[原角色id]新角色id +func (a *authority) CopyMenuButtons(ctx context.Context, creates map[uint]uint) ([]model.SysAuthorityBtn, error) { + menuButtons, err := a.MenuButtons(ctx) + if err != nil { + return nil, err + } + entities := make([]model.SysAuthorityBtn, len(creates)*len(menuButtons)) + for key, value := range creates { + menuButton, ok := menuButtons[key] + if ok { + for i := 0; i < len(menuButton); i++ { + entities = append(entities, model.SysAuthorityBtn{ + AuthorityId: value, + SysMenuID: menuButton[i].SysBaseMenuID, + SysBaseMenuBtnID: menuButton[i].ID, + }) + } + } + } + return entities, nil +} + +// CopyCasbin . +// creates: map[uint]uint => map[原角色id]新角色id +func (a *authority) CopyCasbin(rules map[uint][]string, creates map[uint]uint) [][]string { + entities := make([][]string, len(rules)*len(creates)) + for key, value := range creates { + values, ok := rules[key] + if ok { + if len(values) >= 4 { + values[1] = strconv.Itoa(int(value)) + entities = append(entities, values) + } + } + } + return entities +} diff --git a/server/service/system/internal/authority_test.go b/server/service/system/internal/authority_test.go new file mode 100644 index 0000000000..ff9b151e2d --- /dev/null +++ b/server/service/system/internal/authority_test.go @@ -0,0 +1,63 @@ +package internal + +import ( + "fmt" + model "github.com/flipped-aurora/gin-vue-admin/server/model/system" + "testing" +) + +func Test_authority_CopyChildren(t *testing.T) { + type args struct { + ids map[uint][]uint + creates map[uint]uint + entity *model.SysAuthority + parent model.SysAuthority + entities []model.SysAuthority + } + tests := []struct { + name string + args args + }{ + { + name: "test", + args: args{ + ids: map[uint][]uint{ + 1: {}, + 2: {}, + 3: {}, + 4: {}, + 5: {}, + 6: {}, + 7: {}, + }, + creates: map[uint]uint{}, + entity: &model.SysAuthority{ + AuthorityId: 1, + Children: []model.SysAuthority{ + { + AuthorityId: 2, + Children: []model.SysAuthority{ + {AuthorityId: 5}, + {AuthorityId: 6}, + }, + }, + {AuthorityId: 3}, + {AuthorityId: 4}, + }, + }, + parent: model.SysAuthority{ + AuthorityId: 11, + AuthorityName: "测试", + }, + entities: []model.SysAuthority{}, + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + fmt.Printf("%p\n", tt.args.ids) + Authority.CopyChildren(tt.args.ids, tt.args.creates, tt.args.entity, tt.args.parent, &tt.args.entities, 1) + fmt.Println(tt.args.entities) + }) + } +} diff --git a/server/service/system/sys_authority.go b/server/service/system/sys_authority.go index bdabf1af07..2d48fe6715 100644 --- a/server/service/system/sys_authority.go +++ b/server/service/system/sys_authority.go @@ -1,7 +1,9 @@ package system import ( - "errors" + "context" + "github.com/flipped-aurora/gin-vue-admin/server/service/system/internal" + "github.com/pkg/errors" "strconv" systemReq "github.com/flipped-aurora/gin-vue-admin/server/model/system/request" @@ -15,16 +17,15 @@ import ( var ErrRoleExistence = errors.New("存在相同角色id") -//@author: [piexlmax](https://github.com/piexlmax) -//@function: CreateAuthority -//@description: 创建一个角色 -//@param: auth model.SysAuthority -//@return: authority system.SysAuthority, err error - type AuthorityService struct{} var AuthorityServiceApp = new(AuthorityService) +// CreateAuthority 创建一个角色 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: auth model.SysAuthority +// @return: authority system.SysAuthority, err error func (authorityService *AuthorityService) CreateAuthority(auth system.SysAuthority) (authority system.SysAuthority, err error) { if err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&system.SysAuthority{}).Error; !errors.Is(err, gorm.ErrRecordNotFound) { @@ -53,12 +54,108 @@ func (authorityService *AuthorityService) CreateAuthority(auth system.SysAuthori return auth, e } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: CopyAuthority -//@description: 复制一个角色 -//@param: copyInfo response.SysAuthorityCopyResponse -//@return: authority system.SysAuthority, err error +// Copy 复制角色和子角色 + +func (authorityService *AuthorityService) Copy(ctx context.Context, info systemReq.AuthorityCopy) error { + tree, ids, err := internal.Authority.Tree(ctx) + var old system.SysAuthority + { + err = global.GVA_DB.Where("authority_id = ?", info.OldAuthorityId).First(&old).Error + if errors.Is(err, gorm.ErrRecordNotFound) { + return errors.Wrap(err, "旧角色不存在!") + } + internal.Authority.Children(tree, &old) // 子角色 + } // 查询旧角色及其子角色 + rule := make(map[uint][]string) + casbin := CasbinServiceApp.Casbin() + { + rules := casbin.GetGroupingPolicy() + for i := 0; i < len(rules); i++ { + if len(rules[i]) >= 4 { + var id uint64 + id, err = strconv.ParseUint(rules[i][1], 10, 64) + if err != nil { + return errors.Wrap(err, "角色id转换失败!") + } + _, ok := rule[uint(id)] + if !ok { + rule[uint(id)] = rules[i] + } + } + } + } // casbin + create := info.Create() // 复制=>主角色 + creates := make(map[uint]uint) // 复制=>map[复制角色id]子角色id + children := internal.Authority.Copy(ids, creates, &old, create) // 复制=>子角色 + var ( + rules [][]string + menus []system.SysAuthorityMenu + buttons []system.SysAuthorityBtn + ) + { + creates[old.AuthorityId] = create.AuthorityId // 复制旧角色id => 复制主角色id + rules = internal.Authority.CopyCasbin(rule, creates) // 复制角色的权限 + } // 复制角色的权限 + { + { + menus, err = internal.Authority.CopyMenus(ctx, creates) + if err != nil { + return err + } + } // 复制角色的菜单权限 + { + buttons, err = internal.Authority.CopyMenuButtons(ctx, creates) + if err != nil { + return err + } + } // 复制角色的菜单按钮权限 + } // 复制角色的菜单&菜单按钮权限 + err = global.GVA_DB.Transaction(func(tx *gorm.DB) error { + err = tx.WithContext(ctx).Model(&system.SysAuthority{}).Create(&create).Error + if err != nil { + return errors.Wrap(err, "创建主角色失败!") + } + err = tx.WithContext(ctx).Model(&system.SysAuthority{}).Create(&children).Error + if err != nil { + return errors.Wrap(err, "创建子角色失败!") + } + err = tx.WithContext(ctx).Model(&system.SysAuthorityMenu{}).Create(&menus).Error + if err != nil { + return errors.Wrap(err, "创建角色菜单权限失败!") + } + err = tx.WithContext(ctx).Model(&system.SysAuthorityMenu{}).Create(&buttons).Error + if err != nil { + return errors.Wrap(err, "创建角色菜单按钮权限失败!") + } + var success bool + success, err = casbin.AddPolicies(rules) + if err != nil { + return errors.Wrap(err, "复制角色权限失败!") + } + if !success { + return errors.New("复制角色权限失败!") + } + return nil + }) + if err != nil { + var success bool + success, err = casbin.RemoveGroupingPolicies(rules) + if err != nil { + return errors.Wrap(err, "删除casbin失败!") + } + if !success { + return errors.New("事务回滚复制角色权限失败!") + } + return err + } + return nil +} +// CopyAuthority 复制一个角色 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: copyInfo response.SysAuthorityCopyResponse +// @return: authority system.SysAuthority, err error func (authorityService *AuthorityService) CopyAuthority(copyInfo response.SysAuthorityCopyResponse) (authority system.SysAuthority, err error) { var authorityBox system.SysAuthority if !errors.Is(global.GVA_DB.Where("authority_id = ?", copyInfo.Authority.AuthorityId).First(&authorityBox).Error, gorm.ErrRecordNotFound) { @@ -105,12 +202,11 @@ func (authorityService *AuthorityService) CopyAuthority(copyInfo response.SysAut return copyInfo.Authority, err } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: UpdateAuthority -//@description: 更改一个角色 -//@param: auth model.SysAuthority -//@return: authority system.SysAuthority, err error - +// UpdateAuthority 更改一个角色 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: auth model.SysAuthority +// @return: authority system.SysAuthority, err error func (authorityService *AuthorityService) UpdateAuthority(auth system.SysAuthority) (authority system.SysAuthority, err error) { var oldAuthority system.SysAuthority err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&oldAuthority).Error @@ -122,12 +218,11 @@ func (authorityService *AuthorityService) UpdateAuthority(auth system.SysAuthori return auth, err } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: DeleteAuthority -//@description: 删除角色 -//@param: auth *model.SysAuthority -//@return: err error - +// DeleteAuthority 删除角色 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: auth *model.SysAuthority +// @return: err error func (authorityService *AuthorityService) DeleteAuthority(auth *system.SysAuthority) error { if errors.Is(global.GVA_DB.Debug().Preload("Users").First(&auth).Error, gorm.ErrRecordNotFound) { return errors.New("该角色不存在") @@ -177,12 +272,11 @@ func (authorityService *AuthorityService) DeleteAuthority(auth *system.SysAuthor }) } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: GetAuthorityInfoList -//@description: 分页获取数据 -//@param: info request.PageInfo -//@return: list interface{}, total int64, err error - +// GetAuthorityInfoList 分页获取数据 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: info request.PageInfo +// @return: list interface{}, total int64, err error func (authorityService *AuthorityService) GetAuthorityInfoList(info request.PageInfo) (list interface{}, total int64, err error) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) @@ -198,23 +292,22 @@ func (authorityService *AuthorityService) GetAuthorityInfoList(info request.Page return authority, total, err } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: GetAuthorityInfo -//@description: 获取所有角色信息 -//@param: auth model.SysAuthority -//@return: sa system.SysAuthority, err error +// @author: [piexlmax](https://github.com/piexlmax) +// @function: GetAuthorityInfo +// @description: 获取所有角色信息 +// @param: auth model.SysAuthority +// @return: sa system.SysAuthority, err error func (authorityService *AuthorityService) GetAuthorityInfo(auth system.SysAuthority) (sa system.SysAuthority, err error) { err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", auth.AuthorityId).First(&sa).Error return sa, err } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: SetDataAuthority -//@description: 设置角色资源权限 -//@param: auth model.SysAuthority -//@return: error - +// SetDataAuthority 设置角色资源权限 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: auth model.SysAuthority +// @return: error func (authorityService *AuthorityService) SetDataAuthority(auth system.SysAuthority) error { var s system.SysAuthority global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId) @@ -222,12 +315,11 @@ func (authorityService *AuthorityService) SetDataAuthority(auth system.SysAuthor return err } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: SetMenuAuthority -//@description: 菜单与角色绑定 -//@param: auth *model.SysAuthority -//@return: error - +// SetMenuAuthority 菜单与角色绑定 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: auth *model.SysAuthority +// @return: error func (authorityService *AuthorityService) SetMenuAuthority(auth *system.SysAuthority) error { var s system.SysAuthority global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", auth.AuthorityId) @@ -235,12 +327,11 @@ func (authorityService *AuthorityService) SetMenuAuthority(auth *system.SysAutho return err } -//@author: [piexlmax](https://github.com/piexlmax) -//@function: findChildrenAuthority -//@description: 查询子角色 -//@param: authority *model.SysAuthority -//@return: err error - +// findChildrenAuthority 查询子角色 +// +// @author: [piexlmax](https://github.com/piexlmax) +// @param: authority *model.SysAuthority +// @return: err error func (authorityService *AuthorityService) findChildrenAuthority(authority *system.SysAuthority) (err error) { err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error if len(authority.Children) > 0 {