修复swagger无法生成文档

This commit is contained in:
linwenxiang committed 2021-03-24 18:52:59 +08:00
1 parent 6fb7da87a3
commit 12893fc09d
23 files changed
+2018 -2428

No files matched your search

+4 -2
View File
@@ -1,14 +1,16 @@
package monitor package monitor
import ( import (
"go-admin/common/apis"
"runtime" "runtime"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg" "github.com/go-admin-team/go-admin-core/sdk/pkg"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"github.com/shirou/gopsutil/cpu" "github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk" "github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/mem" "github.com/shirou/gopsutil/mem"
"go-admin/common/apis"
) )
const ( const (
@@ -25,7 +27,7 @@ type Monitor struct {
// @Summary 系统信息 // @Summary 系统信息
// @Description 获取JSON // @Description 获取JSON
// @Tags 系统信息 // @Tags 系统信息
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/settings/serverInfo [get] // @Router /api/v1/settings/serverInfo [get]
func (e *Monitor) ServerInfo(c *gin.Context) { func (e *Monitor) ServerInfo(c *gin.Context) {
+6 -5
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"github.com/google/uuid" "github.com/google/uuid"
"go-admin/app/admin/models" "go-admin/app/admin/models"
@@ -68,7 +69,7 @@ func (e *SysUser) GetSysUserList(c *gin.Context) {
// @Description 获取JSON // @Description 获取JSON
// @Tags 用户 // @Tags 用户
// @Param userId path int true "用户编码" // @Param userId path int true "用户编码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sysUser/{userId} [get] // @Router /api/v1/sysUser/{userId} [get]
// @Security Bearer // @Security Bearer
func (e *SysUser) GetSysUser(c *gin.Context) { func (e *SysUser) GetSysUser(c *gin.Context) {
@@ -109,7 +110,7 @@ func (e *SysUser) GetSysUser(c *gin.Context) {
// @Tags 用户 // @Tags 用户
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.SysUser true "用户数据" // @Param data body dto.SysUserControl true "用户数据"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/sysUser [post] // @Router /api/v1/sysUser [post]
@@ -156,7 +157,7 @@ func (e *SysUser) InsertSysUser(c *gin.Context) {
// @Tags 用户 // @Tags 用户
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.SysUser true "body" // @Param data body dto.SysUserControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" // @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" // @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
// @Router /api/v1/sysuser/{userId} [put] // @Router /api/v1/sysuser/{userId} [put]
@@ -303,7 +304,7 @@ func (e *SysUser) InsetSysUserAvatar(c *gin.Context) {
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body dto.PassWord true "body" // @Param data body dto.PassWord true "body"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/pwd [post] // @Router /api/v1/user/pwd [post]
// @Security Bearer // @Security Bearer
func (e *SysUser) SysUserUpdatePwd(c *gin.Context) { func (e *SysUser) SysUserUpdatePwd(c *gin.Context) {
@@ -343,7 +344,7 @@ func (e *SysUser) SysUserUpdatePwd(c *gin.Context) {
// @Summary 获取个人中心用户 // @Summary 获取个人中心用户
// @Description 获取JSON // @Description 获取JSON
// @Tags 个人中心 // @Tags 个人中心
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/user/profile [get] // @Router /api/v1/user/profile [get]
// @Security Bearer // @Security Bearer
func (e *SysUser) GetSysUserProfile(c *gin.Context) { func (e *SysUser) GetSysUserProfile(c *gin.Context) {
+5 -4
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/system" "go-admin/app/admin/models/system"
"go-admin/app/admin/service" "go-admin/app/admin/service"
@@ -25,7 +26,7 @@ type SysDictData struct {
// @Param dictType query string false "dictType" // @Param dictType query string false "dictType"
// @Param pageSize query int false "页条数" // @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码" // @Param pageIndex query int false "页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/data [get] // @Router /api/v1/dict/data [get]
// @Security Bearer // @Security Bearer
func (e *SysDictData) GetSysDictDataList(c *gin.Context) { func (e *SysDictData) GetSysDictDataList(c *gin.Context) {
@@ -65,7 +66,7 @@ func (e *SysDictData) GetSysDictDataList(c *gin.Context) {
// @Description 获取JSON // @Description 获取JSON
// @Tags 字典数据 // @Tags 字典数据
// @Param dictCode path int true "字典编码" // @Param dictCode path int true "字典编码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/data/{dictCode} [get] // @Router /api/v1/dict/data/{dictCode} [get]
// @Security Bearer // @Security Bearer
func (e *SysDictData) GetSysDictData(c *gin.Context) { func (e *SysDictData) GetSysDictData(c *gin.Context) {
@@ -104,7 +105,7 @@ func (e *SysDictData) GetSysDictData(c *gin.Context) {
// @Tags 字典数据 // @Tags 字典数据
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body system.DictType true "data" // @Param data body dto.SysDictDataControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dict/data [post] // @Router /api/v1/dict/data [post]
@@ -147,7 +148,7 @@ func (e *SysDictData) InsertSysDictData(c *gin.Context) {
// @Tags 字典数据 // @Tags 字典数据
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.DictType true "body" // @Param data body dto.SysDictDataControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dict/data/{dictCode} [put] // @Router /api/v1/dict/data/{dictCode} [put]
+6 -5
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/system" "go-admin/app/admin/models/system"
"go-admin/app/admin/service" "go-admin/app/admin/service"
@@ -25,7 +26,7 @@ type SysDictType struct {
// @Param dictType query string false "dictType" // @Param dictType query string false "dictType"
// @Param pageSize query int false "页条数" // @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码" // @Param pageIndex query int false "页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/type [get] // @Router /api/v1/dict/type [get]
// @Security Bearer // @Security Bearer
func (e *SysDictType) GetSysDictTypeList(c *gin.Context) { func (e *SysDictType) GetSysDictTypeList(c *gin.Context) {
@@ -63,7 +64,7 @@ func (e *SysDictType) GetSysDictTypeList(c *gin.Context) {
// @Description 获取JSON // @Description 获取JSON
// @Tags 字典类型 // @Tags 字典类型
// @Param dictId path int true "字典类型编码" // @Param dictId path int true "字典类型编码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/type/{dictId} [get] // @Router /api/v1/dict/type/{dictId} [get]
// @Security Bearer // @Security Bearer
func (e *SysDictType) GetSysDictType(c *gin.Context) { func (e *SysDictType) GetSysDictType(c *gin.Context) {
@@ -100,7 +101,7 @@ func (e *SysDictType) GetSysDictType(c *gin.Context) {
// @Tags 字典类型 // @Tags 字典类型
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.DictType true "data" // @Param data body dto.SysDictTypeControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dict/type [post] // @Router /api/v1/dict/type [post]
@@ -142,7 +143,7 @@ func (e *SysDictType) InsertSysDictType(c *gin.Context) {
// @Tags 字典类型 // @Tags 字典类型
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.DictType true "body" // @Param data body dto.SysDictTypeControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dict/type/{dictId} [put] // @Router /api/v1/dict/type/{dictId} [put]
@@ -226,7 +227,7 @@ func (e *SysDictType) DeleteSysDictType(c *gin.Context) {
// @Param dictName query string false "dictName" // @Param dictName query string false "dictName"
// @Param dictId query string false "dictId" // @Param dictId query string false "dictId"
// @Param dictType query string false "dictType" // @Param dictType query string false "dictType"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dict/type-option-select [get] // @Router /api/v1/dict/type-option-select [get]
// @Security Bearer // @Security Bearer
func (e *SysDictType) GetSysDictTypeAll(c *gin.Context) { func (e *SysDictType) GetSysDictTypeAll(c *gin.Context) {
+4 -4
View File
@@ -16,7 +16,7 @@ import (
// var Rm models.RoleMenu // var Rm models.RoleMenu
// err := c.ShouldBind(&Rm) // err := c.ShouldBind(&Rm)
// result, err := Rm.Get() // result, err := Rm.Get()
// var res app.Response // var res response.Response
// if err != nil { // if err != nil {
// res.Msg = "抱歉未找到相关信息" // res.Msg = "抱歉未找到相关信息"
// c.JSON(http.StatusOK, res.ReturnError(200)) // c.JSON(http.StatusOK, res.ReturnError(200))
@@ -33,7 +33,7 @@ type RoleMenuPost struct {
//func InsertRoleMenu(c *gin.Context) { //func InsertRoleMenu(c *gin.Context) {
// //
// var res app.Response // var res response.Response
// res.Msg = "添加成功" // res.Msg = "添加成功"
// c.JSON(http.StatusOK, res.ReturnOK()) // c.JSON(http.StatusOK, res.ReturnOK())
// return // return
@@ -55,12 +55,12 @@ type RoleMenuPost struct {
// fmt.Println(menuId) // fmt.Println(menuId)
// _, err := t.Delete(id, menuId) // _, err := t.Delete(id, menuId)
// if err != nil { // if err != nil {
// var res app.Response // var res response.Response
// res.Msg = "删除失败" // res.Msg = "删除失败"
// c.JSON(http.StatusOK, res.ReturnError(200)) // c.JSON(http.StatusOK, res.ReturnError(200))
// return // return
// } // }
// var res app.Response // var res response.Response
// res.Msg = "删除成功" // res.Msg = "删除成功"
// c.JSON(http.StatusOK, res.ReturnOK()) // c.JSON(http.StatusOK, res.ReturnOK())
// return // return
+1 -1
View File
@@ -53,7 +53,7 @@ func (e *SysSetting) GetSetting(c *gin.Context) {
// @Summary 更新或提交系统信息 // @Summary 更新或提交系统信息
// @Description 获取JSON // @Description 获取JSON
// @Tags 系统信息 // @Tags 系统信息
// @Param data body models.SysUser true "body" // @Param data body dto.SysSettingControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/system/setting [post] // @Router /api/v1/system/setting [post]
@@ -66,7 +66,6 @@ func (e *SysConfig) GetSysConfigBySysApp(c *gin.Context) {
// 控制只读前台的数据 // 控制只读前台的数据
d.IsFrontend = 1 d.IsFrontend = 1
list := make([]system.SysConfig, 0) list := make([]system.SysConfig, 0)
s := service.SysConfig{} s := service.SysConfig{}
s.Log = log s.Log = log
+6 -5
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/system" "go-admin/app/admin/models/system"
"go-admin/app/admin/service" "go-admin/app/admin/service"
@@ -22,7 +23,7 @@ type SysDept struct {
// @Param name query string false "name" // @Param name query string false "name"
// @Param id query string false "id" // @Param id query string false "id"
// @Param position query string false "position" // @Param position query string false "position"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dept [get] // @Router /api/v1/dept [get]
// @Security Bearer // @Security Bearer
func (e *SysDept) GetSysDeptList(c *gin.Context) { func (e *SysDept) GetSysDeptList(c *gin.Context) {
@@ -59,7 +60,7 @@ func (e *SysDept) GetSysDeptList(c *gin.Context) {
// @Tags 部门 // @Tags 部门
// @Param deptId path string false "deptId" // @Param deptId path string false "deptId"
// @Param position query string false "position" // @Param position query string false "position"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/dept/{deptId} [get] // @Router /api/v1/dept/{deptId} [get]
// @Security Bearer // @Security Bearer
func (e *SysDept) GetSysDept(c *gin.Context) { func (e *SysDept) GetSysDept(c *gin.Context) {
@@ -96,7 +97,7 @@ func (e *SysDept) GetSysDept(c *gin.Context) {
// @Tags 部门 // @Tags 部门
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.SysDept true "data" // @Param data body dto.SysDeptControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dept [post] // @Router /api/v1/dept [post]
@@ -143,7 +144,7 @@ func (e *SysDept) InsertSysDept(c *gin.Context) {
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param id path int true "id" // @Param id path int true "id"
// @Param data body models.SysDept true "body" // @Param data body dto.SysDeptControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/dept/{deptId} [put] // @Router /api/v1/dept/{deptId} [put]
@@ -184,7 +185,7 @@ func (e *SysDept) UpdateSysDept(c *gin.Context) {
// @Summary 删除部门 // @Summary 删除部门
// @Description 删除数据 // @Description 删除数据
// @Tags 部门 // @Tags 部门
// @Param data body []int true "body" // @Param data body dto.SysDeptById true "body"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" // @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" // @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Router /api/v1/dept [delete] // @Router /api/v1/dept [delete]
+2 -2
View File
@@ -152,7 +152,7 @@ func (e *SysMenu) InsertSysMenu(c *gin.Context) {
// @Accept application/x-www-form-urlencoded // @Accept application/x-www-form-urlencoded
// @Product application/x-www-form-urlencoded // @Product application/x-www-form-urlencoded
// @Param id path int true "id" // @Param id path int true "id"
// @Param data body models.Menu true "body" // @Param data body dto.SysMenuControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" // @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" // @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
// @Router /api/v1/menu/{id} [put] // @Router /api/v1/menu/{id} [put]
@@ -195,7 +195,7 @@ func (e *SysMenu) UpdateSysMenu(c *gin.Context) {
// @Summary 删除菜单 // @Summary 删除菜单
// @Description 删除数据 // @Description 删除数据
// @Tags 菜单 // @Tags 菜单
// @Param data body []int true "body" // @Param data body dto.SysMenuById true "body"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" // @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" // @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Router /api/v1/menu/ [delete] // @Router /api/v1/menu/ [delete]
+5 -4
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/system" "go-admin/app/admin/models/system"
"go-admin/app/admin/service" "go-admin/app/admin/service"
@@ -23,7 +24,7 @@ type SysPost struct {
// @Param postCode query string false "postCode" // @Param postCode query string false "postCode"
// @Param postId query string false "postId" // @Param postId query string false "postId"
// @Param status query string false "status" // @Param status query string false "status"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/post [get] // @Router /api/v1/post [get]
// @Security Bearer // @Security Bearer
func (e *SysPost) GetSysPostList(c *gin.Context) { func (e *SysPost) GetSysPostList(c *gin.Context) {
@@ -60,7 +61,7 @@ func (e *SysPost) GetSysPostList(c *gin.Context) {
// @Description 获取JSON // @Description 获取JSON
// @Tags 岗位 // @Tags 岗位
// @Param postId path int true "postId" // @Param postId path int true "postId"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/post/{postId} [get] // @Router /api/v1/post/{postId} [get]
// @Security Bearer // @Security Bearer
func (e *SysPost) GetSysPost(c *gin.Context) { func (e *SysPost) GetSysPost(c *gin.Context) {
@@ -97,7 +98,7 @@ func (e *SysPost) GetSysPost(c *gin.Context) {
// @Tags 岗位 // @Tags 岗位
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.Post true "data" // @Param data body dto.SysPostControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/post [post] // @Router /api/v1/post [post]
@@ -143,7 +144,7 @@ func (e *SysPost) InsertSysPost(c *gin.Context) {
// @Tags 岗位 // @Tags 岗位
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.Post true "body" // @Param data body dto.SysPostControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/post/ [put] // @Router /api/v1/post/ [put]
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/system" "go-admin/app/admin/models/system"
"go-admin/app/admin/service" "go-admin/app/admin/service"
@@ -25,7 +26,7 @@ type SysRole struct {
// @Param roleKey query string false "roleKey" // @Param roleKey query string false "roleKey"
// @Param pageSize query int false "页条数" // @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码" // @Param pageIndex query int false "页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/role [get] // @Router /api/v1/role [get]
// @Security Bearer // @Security Bearer
func (e *SysRole) GetSysRoleList(c *gin.Context) { func (e *SysRole) GetSysRoleList(c *gin.Context) {
@@ -100,7 +101,7 @@ func (e *SysRole) GetSysRole(c *gin.Context) {
// @Tags 角色/Role // @Tags 角色/Role
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.SysRole true "data" // @Param data body dto.SysRoleControl true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/role [post] // @Router /api/v1/role [post]
@@ -153,7 +154,7 @@ func (e *SysRole) InsertSysRole(c *gin.Context) {
// @Tags 角色/Role // @Tags 角色/Role
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body models.SysRole true "body" // @Param data body dto.SysRoleControl true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" // @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" // @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
// @Router /api/v1/role/{id} [put] // @Router /api/v1/role/{id} [put]
+2 -1
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg" "github.com/go-admin-team/go-admin-core/sdk/pkg"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/tools" "go-admin/app/admin/models/tools"
) )
@@ -15,7 +16,7 @@ import (
// @Param tableName query string false "tableName / 数据表名称" // @Param tableName query string false "tableName / 数据表名称"
// @Param pageSize query int false "pageSize / 页条数" // @Param pageSize query int false "pageSize / 页条数"
// @Param pageIndex query int false "pageIndex / 页码" // @Param pageIndex query int false "pageIndex / 页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/db/columns/page [get] // @Router /api/v1/db/columns/page [get]
func (e *Gen) GetDBColumnList(c *gin.Context) { func (e *Gen) GetDBColumnList(c *gin.Context) {
log := e.GetLogger(c) log := e.GetLogger(c)
+3 -2
View File
@@ -7,6 +7,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/config" "github.com/go-admin-team/go-admin-core/sdk/config"
"github.com/go-admin-team/go-admin-core/sdk/pkg" "github.com/go-admin-team/go-admin-core/sdk/pkg"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models/tools" "go-admin/app/admin/models/tools"
) )
@@ -17,10 +18,10 @@ import (
// @Param tableName query string false "tableName / 数据表名称" // @Param tableName query string false "tableName / 数据表名称"
// @Param pageSize query int false "pageSize / 页条数" // @Param pageSize query int false "pageSize / 页条数"
// @Param pageIndex query int false "pageIndex / 页码" // @Param pageIndex query int false "pageIndex / 页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/db/tables/page [get] // @Router /api/v1/db/tables/page [get]
func (e *Gen) GetDBTableList(c *gin.Context) { func (e *Gen) GetDBTableList(c *gin.Context) {
//var res app.Response //var res response.Response
var data tools.DBTables var data tools.DBTables
var err error var err error
var pageSize = 10 var pageSize = 10
+1 -2
View File
@@ -245,7 +245,6 @@ func (e *Gen) NOActionsGenV3(c *gin.Context, tab tools.SysTables) {
} }
func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) { func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
log := e.GetLogger(c) log := e.GetLogger(c)
@@ -262,7 +261,7 @@ func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
err = t1.Execute(&b1, struct { err = t1.Execute(&b1, struct {
tools.SysTables tools.SysTables
GenerateTime string GenerateTime string
}{tab,i} ) }{tab, i})
pkg.FileCreate(b1, "./cmd/migrate/migration/version/"+i+"_migrate.go") pkg.FileCreate(b1, "./cmd/migrate/migration/version/"+i+"_migrate.go")
+3 -2
View File
@@ -7,6 +7,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg" "github.com/go-admin-team/go-admin-core/sdk/pkg"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"gorm.io/gorm" "gorm.io/gorm"
"go-admin/app/admin/models/tools" "go-admin/app/admin/models/tools"
@@ -23,7 +24,7 @@ type SysTable struct {
// @Param tableName query string false "tableName / 数据表名称" // @Param tableName query string false "tableName / 数据表名称"
// @Param pageSize query int false "pageSize / 页条数" // @Param pageSize query int false "pageSize / 页条数"
// @Param pageIndex query int false "pageIndex / 页码" // @Param pageIndex query int false "pageIndex / 页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys/tables/page [get] // @Router /api/v1/sys/tables/page [get]
func (e *SysTable) GetSysTableList(c *gin.Context) { func (e *SysTable) GetSysTableList(c *gin.Context) {
log := e.GetLogger(c) log := e.GetLogger(c)
@@ -62,7 +63,7 @@ func (e *SysTable) GetSysTableList(c *gin.Context) {
// @Description 获取JSON // @Description 获取JSON
// @Tags 工具 - 生成表 // @Tags 工具 - 生成表
// @Param configKey path int true "configKey" // @Param configKey path int true "configKey"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys/tables/info/{tableId} [get] // @Router /api/v1/sys/tables/info/{tableId} [get]
// @Security Bearer // @Security Bearer
func (e *SysTable) GetSysTables(c *gin.Context) { func (e *SysTable) GetSysTables(c *gin.Context) {
+1 -1
View File
@@ -56,7 +56,7 @@ func IdentityHandler(c *gin.Context) interface{} {
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值 // @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param account body models.Login true "account" // @Param account body system.Login true "account"
// @Success 200 {string} string "{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" }" // @Success 200 {string} string "{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": ".eyJleHAiOjE1NjUxNTMxNDgsImlkIjoiYWRtaW4iLCJvcmlnX2lhdCI6MTU2NTE0OTU0OH0.-zvzHvbg0A" }"
// @Router /login [post] // @Router /login [post]
func Authenticator(c *gin.Context) (interface{}, error) { func Authenticator(c *gin.Context) (interface{}, error) {
-1
View File
@@ -34,5 +34,4 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd
r2.GET("", api.GetSysConfigBySysApp) r2.GET("", api.GetSysConfigBySysApp)
} }
} }
+1 -1
View File
@@ -2,7 +2,7 @@ package global
const ( const (
// go-admin Version Info // go-admin Version Info
Version = "1.3.1rc.0" Version = "1.3.1rc.1"
) )
var ( var (
+731 -888
View File
File diff suppressed because it is too large. Load diff
+731 -888
View File
File diff suppressed because it is too large. Load diff
+479 -589
View File
File diff suppressed because it is too large. Load diff
+12
View File
@@ -4,6 +4,18 @@ import (
"go-admin/cmd" "go-admin/cmd"
) )
//go:generate swag init --parseDependency
// @title go-admin API
// @version 1.3.1
// @description 基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档
// @description 添加qq群: 74520518 进入技术交流群 请备注,谢谢!
// @license.name MIT
// @license.url https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md
// @securityDefinitions.apikey Bearer
// @in header
// @name Authorization
func main() { func main() {
cmd.Execute() cmd.Execute()
} }
+11 -17
View File
@@ -5,6 +5,7 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
"go-admin/app/admin/models" "go-admin/app/admin/models"
"go-admin/app/admin/service" "go-admin/app/admin/service"
@@ -23,13 +24,10 @@ type {{.ClassName}} struct {
{{ $tablename := .TBName -}} {{ $tablename := .TBName -}}
{{ range .Columns -}} {{ range .Columns -}}
{{$z := .IsQuery}} {{$z := .IsQuery}}
{{- if ($z) -}} {{- if ($z) -}}// @Param {{.JsonField}} query {{.GoType}} false "{{.ColumnComment}}"{{ end -}}{{- end }}
// @Param {{.JsonField}} query {{.GoType}} false "{{.ColumnComment}}"
{{ end -}}
{{- end }}
// @Param pageSize query int false "页条数" // @Param pageSize query int false "页条数"
// @Param pageIndex query int false "页码" // @Param pageIndex query int false "页码"
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response{data=response.Page{list=[]models.{{.ClassName}}}} "{"code": 200, "data": [...]}"
// @Router /api/v1/{{.ModuleName}} [get] // @Router /api/v1/{{.ModuleName}} [get]
// @Security Bearer // @Security Bearer
// Get{{.ClassName}}List 获取{{.TableComment}}列表 // Get{{.ClassName}}List 获取{{.TableComment}}列表
@@ -72,9 +70,8 @@ func (e *{{.ClassName}}) Get{{.ClassName}}List(c *gin.Context) {
// @Description 获取{{.TableComment}} // @Description 获取{{.TableComment}}
// @Tags {{.TableComment}} // @Tags {{.TableComment}}
// @Param id path string false "id" // @Param id path string false "id"
// @Success 200 {string} string "{"code": 200, "data": [...]}" // @Success 200 {object} response.Response{data=models.{{.ClassName}}} "{"code": 200, "data": [...]}"
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}" // @Router /api/v1/{{.ModuleName}}/{id} [get]
// @Router /api/v1/{{.ModuleName}} [get]
// @Security Bearer // @Security Bearer
// Get{{.ClassName}} 获取{{.TableComment}} // Get{{.ClassName}} 获取{{.TableComment}}
func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) { func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) {
@@ -118,9 +115,8 @@ func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) {
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body dto.{{.ClassName}}Control true "data" // @Param data body dto.{{.ClassName}}Control true "data"
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {object} response.Response "{"code": 200, "message": "添加成功"}"
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/{{.ModuleName}} [post]
// @Router /api/v1/{{.ClassName}} [post]
// Insert{{.ClassName}} 创建{{.TableComment}} // Insert{{.ClassName}} 创建{{.TableComment}}
func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) { func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
log := e.GetLogger(c) log := e.GetLogger(c)
@@ -167,9 +163,8 @@ func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
// @Accept application/json // @Accept application/json
// @Product application/json // @Product application/json
// @Param data body dto.{{.ClassName}}Control true "body" // @Param data body dto.{{.ClassName}}Control true "body"
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}" // @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}" // @Router /api/v1/{{.ModuleName}} [put]
// @Router /api/v1/{{.ClassName}} [put]
// Update{{.ClassName}} 修改{{.TableComment}} // Update{{.ClassName}} 修改{{.TableComment}}
func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) { func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
log := e.GetLogger(c) log := e.GetLogger(c)
@@ -216,9 +211,8 @@ func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
// @Tags {{.TableComment}} // @Tags {{.TableComment}}
// @Param id path int false "id" // @Param id path int false "id"
// @Param ids body string false "ids" // @Param ids body string false "ids"
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}" // @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}" // @Router /api/v1/{{.ModuleName}}/{id} [delete]
// @Router /api/v1/{{.ClassName}}/{id} [delete]
// Delete{{.ClassName}} 删除{{.TableComment}} // Delete{{.ClassName}} 删除{{.TableComment}}
func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) { func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) {
log := e.GetLogger(c) log := e.GetLogger(c)