修复swagger无法生成文档
This commit is contained in:
1 parent
6fb7da87a3
commit
12893fc09d
31 files changed
+2032
-2442
No files matched your search
@@ -1,14 +1,16 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"go-admin/common/apis"
|
||||
"runtime"
|
||||
|
||||
"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/response"
|
||||
"github.com/shirou/gopsutil/cpu"
|
||||
"github.com/shirou/gopsutil/disk"
|
||||
"github.com/shirou/gopsutil/mem"
|
||||
|
||||
"go-admin/common/apis"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -25,7 +27,7 @@ type Monitor struct {
|
||||
// @Summary 系统信息
|
||||
// @Description 获取JSON
|
||||
// @Tags 系统信息
|
||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/settings/serverInfo [get]
|
||||
func (e *Monitor) ServerInfo(c *gin.Context) {
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
"github.com/google/uuid"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
@@ -68,7 +69,7 @@ func (e *SysUser) GetSysUserList(c *gin.Context) {
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysUser) GetSysUser(c *gin.Context) {
|
||||
@@ -109,7 +110,7 @@ func (e *SysUser) GetSysUser(c *gin.Context) {
|
||||
// @Tags 用户
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/sysUser [post]
|
||||
@@ -156,7 +157,7 @@ func (e *SysUser) InsertSysUser(c *gin.Context) {
|
||||
// @Tags 用户
|
||||
// @Accept 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": -1, "message": "修改失败"}"
|
||||
// @Router /api/v1/sysuser/{userId} [put]
|
||||
@@ -303,7 +304,7 @@ func (e *SysUser) InsetSysUserAvatar(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysUser) SysUserUpdatePwd(c *gin.Context) {
|
||||
@@ -343,7 +344,7 @@ func (e *SysUser) SysUserUpdatePwd(c *gin.Context) {
|
||||
// @Summary 获取个人中心用户
|
||||
// @Description 获取JSON
|
||||
// @Tags 个人中心
|
||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/user/profile [get]
|
||||
// @Security Bearer
|
||||
func (e *SysUser) GetSysUserProfile(c *gin.Context) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
@@ -25,7 +26,7 @@ type SysDictData struct {
|
||||
// @Param dictType query string false "dictType"
|
||||
// @Param pageSize 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]
|
||||
// @Security Bearer
|
||||
func (e *SysDictData) GetSysDictDataList(c *gin.Context) {
|
||||
@@ -65,7 +66,7 @@ func (e *SysDictData) GetSysDictDataList(c *gin.Context) {
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典数据
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysDictData) GetSysDictData(c *gin.Context) {
|
||||
@@ -104,7 +105,7 @@ func (e *SysDictData) GetSysDictData(c *gin.Context) {
|
||||
// @Tags 字典数据
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/data [post]
|
||||
@@ -147,7 +148,7 @@ func (e *SysDictData) InsertSysDictData(c *gin.Context) {
|
||||
// @Tags 字典数据
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/data/{dictCode} [put]
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
@@ -25,7 +26,7 @@ type SysDictType struct {
|
||||
// @Param dictType query string false "dictType"
|
||||
// @Param pageSize 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]
|
||||
// @Security Bearer
|
||||
func (e *SysDictType) GetSysDictTypeList(c *gin.Context) {
|
||||
@@ -63,7 +64,7 @@ func (e *SysDictType) GetSysDictTypeList(c *gin.Context) {
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典类型
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysDictType) GetSysDictType(c *gin.Context) {
|
||||
@@ -100,7 +101,7 @@ func (e *SysDictType) GetSysDictType(c *gin.Context) {
|
||||
// @Tags 字典类型
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/type [post]
|
||||
@@ -142,7 +143,7 @@ func (e *SysDictType) InsertSysDictType(c *gin.Context) {
|
||||
// @Tags 字典类型
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @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 dictId query string false "dictId"
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysDictType) GetSysDictTypeAll(c *gin.Context) {
|
||||
|
||||
@@ -36,4 +36,4 @@ $(function(){
|
||||
func HelloWorld(c *gin.Context) {
|
||||
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||
c.String(200, INDEX)
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
// var Rm models.RoleMenu
|
||||
// err := c.ShouldBind(&Rm)
|
||||
// result, err := Rm.Get()
|
||||
// var res app.Response
|
||||
// var res response.Response
|
||||
// if err != nil {
|
||||
// res.Msg = "抱歉未找到相关信息"
|
||||
// c.JSON(http.StatusOK, res.ReturnError(200))
|
||||
@@ -33,7 +33,7 @@ type RoleMenuPost struct {
|
||||
|
||||
//func InsertRoleMenu(c *gin.Context) {
|
||||
//
|
||||
// var res app.Response
|
||||
// var res response.Response
|
||||
// res.Msg = "添加成功"
|
||||
// c.JSON(http.StatusOK, res.ReturnOK())
|
||||
// return
|
||||
@@ -55,12 +55,12 @@ type RoleMenuPost struct {
|
||||
// fmt.Println(menuId)
|
||||
// _, err := t.Delete(id, menuId)
|
||||
// if err != nil {
|
||||
// var res app.Response
|
||||
// var res response.Response
|
||||
// res.Msg = "删除失败"
|
||||
// c.JSON(http.StatusOK, res.ReturnError(200))
|
||||
// return
|
||||
// }
|
||||
// var res app.Response
|
||||
// var res response.Response
|
||||
// res.Msg = "删除成功"
|
||||
// c.JSON(http.StatusOK, res.ReturnOK())
|
||||
// return
|
||||
|
||||
@@ -53,7 +53,7 @@ func (e *SysSetting) GetSetting(c *gin.Context) {
|
||||
// @Summary 更新或提交系统信息
|
||||
// @Description 获取JSON
|
||||
// @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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/system/setting [post]
|
||||
|
||||
@@ -62,11 +62,10 @@ func (e *SysConfig) GetSysConfigBySysApp(c *gin.Context) {
|
||||
e.Error(c, 500, err, "参数验证失败")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// 控制只读前台的数据
|
||||
d.IsFrontend = 1
|
||||
|
||||
|
||||
list := make([]system.SysConfig, 0)
|
||||
s := service.SysConfig{}
|
||||
s.Log = log
|
||||
@@ -268,4 +267,4 @@ func (e *SysConfig) GetSysConfigByKEYForService(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(c, v, s.Msg)
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
@@ -22,7 +23,7 @@ type SysDept struct {
|
||||
// @Param name query string false "name"
|
||||
// @Param id query string false "id"
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysDept) GetSysDeptList(c *gin.Context) {
|
||||
@@ -59,7 +60,7 @@ func (e *SysDept) GetSysDeptList(c *gin.Context) {
|
||||
// @Tags 部门
|
||||
// @Param deptId path string false "deptId"
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysDept) GetSysDept(c *gin.Context) {
|
||||
@@ -96,7 +97,7 @@ func (e *SysDept) GetSysDept(c *gin.Context) {
|
||||
// @Tags 部门
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dept [post]
|
||||
@@ -143,7 +144,7 @@ func (e *SysDept) InsertSysDept(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dept/{deptId} [put]
|
||||
@@ -184,7 +185,7 @@ func (e *SysDept) UpdateSysDept(c *gin.Context) {
|
||||
// @Summary 删除部门
|
||||
// @Description 删除数据
|
||||
// @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": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/dept [delete]
|
||||
|
||||
@@ -152,7 +152,7 @@ func (e *SysMenu) InsertSysMenu(c *gin.Context) {
|
||||
// @Accept application/x-www-form-urlencoded
|
||||
// @Product application/x-www-form-urlencoded
|
||||
// @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": -1, "message": "修改失败"}"
|
||||
// @Router /api/v1/menu/{id} [put]
|
||||
@@ -195,7 +195,7 @@ func (e *SysMenu) UpdateSysMenu(c *gin.Context) {
|
||||
// @Summary 删除菜单
|
||||
// @Description 删除数据
|
||||
// @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": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/menu/ [delete]
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
@@ -23,7 +24,7 @@ type SysPost struct {
|
||||
// @Param postCode query string false "postCode"
|
||||
// @Param postId query string false "postId"
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysPost) GetSysPostList(c *gin.Context) {
|
||||
@@ -60,7 +61,7 @@ func (e *SysPost) GetSysPostList(c *gin.Context) {
|
||||
// @Description 获取JSON
|
||||
// @Tags 岗位
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysPost) GetSysPost(c *gin.Context) {
|
||||
@@ -97,7 +98,7 @@ func (e *SysPost) GetSysPost(c *gin.Context) {
|
||||
// @Tags 岗位
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/post [post]
|
||||
@@ -143,7 +144,7 @@ func (e *SysPost) InsertSysPost(c *gin.Context) {
|
||||
// @Tags 岗位
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/post/ [put]
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/system"
|
||||
"go-admin/app/admin/service"
|
||||
@@ -25,7 +26,7 @@ type SysRole struct {
|
||||
// @Param roleKey query string false "roleKey"
|
||||
// @Param pageSize 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]
|
||||
// @Security Bearer
|
||||
func (e *SysRole) GetSysRoleList(c *gin.Context) {
|
||||
@@ -100,7 +101,7 @@ func (e *SysRole) GetSysRole(c *gin.Context) {
|
||||
// @Tags 角色/Role
|
||||
// @Accept 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": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/role [post]
|
||||
@@ -153,7 +154,7 @@ func (e *SysRole) InsertSysRole(c *gin.Context) {
|
||||
// @Tags 角色/Role
|
||||
// @Accept 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": -1, "message": "修改失败"}"
|
||||
// @Router /api/v1/role/{id} [put]
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/tools"
|
||||
)
|
||||
@@ -15,7 +16,7 @@ import (
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Param pageSize query int false "pageSize / 页条数"
|
||||
// @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]
|
||||
func (e *Gen) GetDBColumnList(c *gin.Context) {
|
||||
log := e.GetLogger(c)
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models/tools"
|
||||
)
|
||||
@@ -17,10 +18,10 @@ import (
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Param pageSize query int false "pageSize / 页条数"
|
||||
// @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]
|
||||
func (e *Gen) GetDBTableList(c *gin.Context) {
|
||||
//var res app.Response
|
||||
//var res response.Response
|
||||
var data tools.DBTables
|
||||
var err error
|
||||
var pageSize = 10
|
||||
|
||||
@@ -245,7 +245,6 @@ func (e *Gen) NOActionsGenV3(c *gin.Context, tab tools.SysTables) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
|
||||
log := e.GetLogger(c)
|
||||
|
||||
@@ -262,7 +261,7 @@ func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) {
|
||||
err = t1.Execute(&b1, struct {
|
||||
tools.SysTables
|
||||
GenerateTime string
|
||||
}{tab,i} )
|
||||
}{tab, i})
|
||||
|
||||
pkg.FileCreate(b1, "./cmd/migrate/migration/version/"+i+"_migrate.go")
|
||||
|
||||
@@ -574,4 +573,4 @@ func (e *Gen) GenMenuAndApi(c *gin.Context) {
|
||||
ADelete.MenuId, err = ADelete.Create(db)
|
||||
|
||||
e.OK(c, "", "数据生成成功!")
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"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/jwtauth/user"
|
||||
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models/tools"
|
||||
@@ -23,7 +24,7 @@ type SysTable struct {
|
||||
// @Param tableName query string false "tableName / 数据表名称"
|
||||
// @Param pageSize query int false "pageSize / 页条数"
|
||||
// @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]
|
||||
func (e *SysTable) GetSysTableList(c *gin.Context) {
|
||||
log := e.GetLogger(c)
|
||||
@@ -62,7 +63,7 @@ func (e *SysTable) GetSysTableList(c *gin.Context) {
|
||||
// @Description 获取JSON
|
||||
// @Tags 工具 - 生成表
|
||||
// @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]
|
||||
// @Security Bearer
|
||||
func (e *SysTable) GetSysTables(c *gin.Context) {
|
||||
|
||||
@@ -56,7 +56,7 @@ func IdentityHandler(c *gin.Context) interface{} {
|
||||
// @Description 注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值
|
||||
// @Accept 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" }"
|
||||
// @Router /login [post]
|
||||
func Authenticator(c *gin.Context) (interface{}, error) {
|
||||
|
||||
@@ -27,4 +27,4 @@ func (e *SysConfig) Generate() models.ActiveRecord {
|
||||
|
||||
func (e *SysConfig) GetId() interface{} {
|
||||
return e.Id
|
||||
}
|
||||
}
|
||||
@@ -34,5 +34,4 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd
|
||||
r2.GET("", api.GetSysConfigBySysApp)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func sysNoCheckRoleRouter(r *gin.RouterGroup) {
|
||||
v1.GET("/gen/preview/:tableId", gen.Preview)
|
||||
v1.GET("/gen/toproject/:tableId", gen.GenCodeV3)
|
||||
v1.GET("/gen/apitofile/:tableId", gen.GenApiToFile)
|
||||
|
||||
|
||||
v1.GET("/gen/todb/:tableId", gen.GenMenuAndApi)
|
||||
sysTable := &tools.SysTable{}
|
||||
v1.GET("/gen/tabletree", sysTable.GetSysTablesTree)
|
||||
@@ -214,4 +214,4 @@ func registerPublicRouter(v1 *gin.RouterGroup) {
|
||||
file := &public.File{}
|
||||
p.POST("/uploadFile", file.UploadFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,4 +116,4 @@ func (s *SysConfigById) Bind(ctx *gin.Context) error {
|
||||
|
||||
func (s *SysConfigById) GenerateM() (*system.SysConfig, error) {
|
||||
return &system.SysConfig{}, nil
|
||||
}
|
||||
}
|
||||
@@ -131,4 +131,4 @@ func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error {
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,4 @@ func _1615948084336Test(db *gorm.DB, version string) error {
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ func _1615950701614Test(db *gorm.DB, version string) error {
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,4 @@ func _1615961953379Test(db *gorm.DB, version string) error {
|
||||
Version: version,
|
||||
}).Error
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,11 @@ package global
|
||||
|
||||
const (
|
||||
// go-admin Version Info
|
||||
Version = "1.3.1rc.0"
|
||||
Version = "1.3.1rc.1"
|
||||
)
|
||||
|
||||
var (
|
||||
Source string
|
||||
Driver string
|
||||
DBName string
|
||||
)
|
||||
)
|
||||
+731
-888
File diff suppressed because it is too large.
Load diff
+731
-888
File diff suppressed because it is too large.
Load diff
+479
-589
File diff suppressed because it is too large.
Load diff
@@ -4,6 +4,18 @@ import (
|
||||
"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() {
|
||||
cmd.Execute()
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
|
||||
"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/response"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service"
|
||||
@@ -23,13 +24,10 @@ type {{.ClassName}} struct {
|
||||
{{ $tablename := .TBName -}}
|
||||
{{ range .Columns -}}
|
||||
{{$z := .IsQuery}}
|
||||
{{- if ($z) -}}
|
||||
// @Param {{.JsonField}} query {{.GoType}} false "{{.ColumnComment}}"
|
||||
{{ end -}}
|
||||
{{- end }}
|
||||
{{- if ($z) -}}// @Param {{.JsonField}} query {{.GoType}} false "{{.ColumnComment}}"{{ end -}}{{- end }}
|
||||
// @Param pageSize 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]
|
||||
// @Security Bearer
|
||||
// Get{{.ClassName}}List 获取{{.TableComment}}列表
|
||||
@@ -72,9 +70,8 @@ func (e *{{.ClassName}}) Get{{.ClassName}}List(c *gin.Context) {
|
||||
// @Description 获取{{.TableComment}}
|
||||
// @Tags {{.TableComment}}
|
||||
// @Param id path string false "id"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /api/v1/{{.ModuleName}} [get]
|
||||
// @Success 200 {object} response.Response{data=models.{{.ClassName}}} "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/{{.ModuleName}}/{id} [get]
|
||||
// @Security Bearer
|
||||
// Get{{.ClassName}} 获取{{.TableComment}}
|
||||
func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) {
|
||||
@@ -118,9 +115,8 @@ func (e *{{.ClassName}}) Get{{.ClassName}}(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.{{.ClassName}}Control true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/{{.ClassName}} [post]
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "添加成功"}"
|
||||
// @Router /api/v1/{{.ModuleName}} [post]
|
||||
// Insert{{.ClassName}} 创建{{.TableComment}}
|
||||
func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
|
||||
log := e.GetLogger(c)
|
||||
@@ -167,9 +163,8 @@ func (e *{{.ClassName}}) Insert{{.ClassName}}(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.{{.ClassName}}Control true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Router /api/v1/{{.ClassName}} [put]
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
|
||||
// @Router /api/v1/{{.ModuleName}} [put]
|
||||
// Update{{.ClassName}} 修改{{.TableComment}}
|
||||
func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
|
||||
log := e.GetLogger(c)
|
||||
@@ -216,9 +211,8 @@ func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) {
|
||||
// @Tags {{.TableComment}}
|
||||
// @Param id path int false "id"
|
||||
// @Param ids body string false "ids"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/{{.ClassName}}/{id} [delete]
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
|
||||
// @Router /api/v1/{{.ModuleName}}/{id} [delete]
|
||||
// Delete{{.ClassName}} 删除{{.TableComment}}
|
||||
func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) {
|
||||
log := e.GetLogger(c)
|
||||
|
||||
Reference in new issue
Block a user