diff --git a/app/admin/apis/monitor/server.go b/app/admin/apis/monitor/server.go index a715d712..8f8488bd 100644 --- a/app/admin/apis/monitor/server.go +++ b/app/admin/apis/monitor/server.go @@ -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) { diff --git a/app/admin/apis/sys_user/sys_user.go b/app/admin/apis/sys_user/sys_user.go index 30540dbe..6b327fba 100644 --- a/app/admin/apis/sys_user/sys_user.go +++ b/app/admin/apis/sys_user/sys_user.go @@ -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) { diff --git a/app/admin/apis/system/dict/sys_dict_data.go b/app/admin/apis/system/dict/sys_dict_data.go index 57c42d94..f440bccc 100644 --- a/app/admin/apis/system/dict/sys_dict_data.go +++ b/app/admin/apis/system/dict/sys_dict_data.go @@ -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] diff --git a/app/admin/apis/system/dict/sys_dict_type.go b/app/admin/apis/system/dict/sys_dict_type.go index 734f0583..6a0c5293 100644 --- a/app/admin/apis/system/dict/sys_dict_type.go +++ b/app/admin/apis/system/dict/sys_dict_type.go @@ -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) { diff --git a/app/admin/apis/system/index.go b/app/admin/apis/system/index.go index 63e3fe2a..59997496 100644 --- a/app/admin/apis/system/index.go +++ b/app/admin/apis/system/index.go @@ -36,4 +36,4 @@ $(function(){ func HelloWorld(c *gin.Context) { c.Header("Content-Type", "text/html; charset=utf-8") c.String(200, INDEX) -} \ No newline at end of file +} diff --git a/app/admin/apis/system/rolemenu.go b/app/admin/apis/system/rolemenu.go index e20ef04f..31da0a02 100644 --- a/app/admin/apis/system/rolemenu.go +++ b/app/admin/apis/system/rolemenu.go @@ -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 diff --git a/app/admin/apis/system/settings.go b/app/admin/apis/system/settings.go index ca133089..2b16fdf4 100644 --- a/app/admin/apis/system/settings.go +++ b/app/admin/apis/system/settings.go @@ -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] diff --git a/app/admin/apis/system/sys_config/sys_config.go b/app/admin/apis/system/sys_config/sys_config.go index 9d547749..431ae0ce 100644 --- a/app/admin/apis/system/sys_config/sys_config.go +++ b/app/admin/apis/system/sys_config/sys_config.go @@ -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) -} \ No newline at end of file +} diff --git a/app/admin/apis/system/sys_dept/sys_dept.go b/app/admin/apis/system/sys_dept/sys_dept.go index 27a0dc14..1708b504 100644 --- a/app/admin/apis/system/sys_dept/sys_dept.go +++ b/app/admin/apis/system/sys_dept/sys_dept.go @@ -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] diff --git a/app/admin/apis/system/sys_menu/sys_menu.go b/app/admin/apis/system/sys_menu/sys_menu.go index c359650f..1c3b032a 100644 --- a/app/admin/apis/system/sys_menu/sys_menu.go +++ b/app/admin/apis/system/sys_menu/sys_menu.go @@ -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] diff --git a/app/admin/apis/system/sys_post/sys_post.go b/app/admin/apis/system/sys_post/sys_post.go index be5881d0..4a56d640 100644 --- a/app/admin/apis/system/sys_post/sys_post.go +++ b/app/admin/apis/system/sys_post/sys_post.go @@ -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] diff --git a/app/admin/apis/system/sys_role/sys_role.go b/app/admin/apis/system/sys_role/sys_role.go index 4c35a212..b8323d1a 100644 --- a/app/admin/apis/system/sys_role/sys_role.go +++ b/app/admin/apis/system/sys_role/sys_role.go @@ -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] diff --git a/app/admin/apis/tools/dbcolumns.go b/app/admin/apis/tools/dbcolumns.go index e4dbd00d..caed593f 100644 --- a/app/admin/apis/tools/dbcolumns.go +++ b/app/admin/apis/tools/dbcolumns.go @@ -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) diff --git a/app/admin/apis/tools/dbtables.go b/app/admin/apis/tools/dbtables.go index 99bd9742..eb4abc6e 100644 --- a/app/admin/apis/tools/dbtables.go +++ b/app/admin/apis/tools/dbtables.go @@ -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 diff --git a/app/admin/apis/tools/gen.go b/app/admin/apis/tools/gen.go index 1c6bf8ae..54ddc15d 100644 --- a/app/admin/apis/tools/gen.go +++ b/app/admin/apis/tools/gen.go @@ -3,7 +3,9 @@ package tools import ( "bytes" "net/http" + "strconv" "text/template" + "time" "github.com/gin-gonic/gin" "github.com/go-admin-team/go-admin-core/sdk/api" @@ -135,6 +137,30 @@ func (e *Gen) GenCodeV3(c *gin.Context) { e.OK(c, "", "Code generated successfully!") } +func (e *Gen) GenApiToFile(c *gin.Context) { + log := e.GetLogger(c) + table := tools.SysTables{} + id, err := pkg.StringToInt(c.Param("tableId")) + if err != nil { + log.Error(err) + e.Error(c, 500, err, "") + return + } + + db, err := pkg.GetOrm(c) + if err != nil { + log.Errorf("get db connection error, %s", err.Error()) + e.Error(c, http.StatusInternalServerError, err, "数据库连接获取失败") + return + } + + table.TableId = id + tab, _ := table.Get(db) + e.genApiToFile(c, tab) + + e.OK(c, "", "Code generated successfully!") +} + func (e *Gen) NOActionsGenV3(c *gin.Context, tab tools.SysTables) { log := e.GetLogger(c) @@ -219,6 +245,28 @@ func (e *Gen) NOActionsGenV3(c *gin.Context, tab tools.SysTables) { } +func (e *Gen) genApiToFile(c *gin.Context, tab tools.SysTables) { + log := e.GetLogger(c) + + basePath := "template/" + + t1, err := template.ParseFiles(basePath + "api_migrate.template") + if err != nil { + log.Error(err) + e.Error(c, 500, err, "") + return + } + i := strconv.FormatInt(time.Now().UnixNano()/1e6, 10) + var b1 bytes.Buffer + err = t1.Execute(&b1, struct { + tools.SysTables + GenerateTime string + }{tab, i}) + + pkg.FileCreate(b1, "./cmd/migrate/migration/version/"+i+"_migrate.go") + +} + func (e *Gen) ActionsGenV3(c *gin.Context, tab tools.SysTables) { log := api.GetRequestLogger(c) basePath := "template/v4/" diff --git a/app/admin/apis/tools/systables.go b/app/admin/apis/tools/systables.go index 4140ab22..8b01bdf7 100644 --- a/app/admin/apis/tools/systables.go +++ b/app/admin/apis/tools/systables.go @@ -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) { diff --git a/app/admin/middleware/handler/auth.go b/app/admin/middleware/handler/auth.go index 24d18e3f..68c6ae64 100644 --- a/app/admin/middleware/handler/auth.go +++ b/app/admin/middleware/handler/auth.go @@ -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) { diff --git a/app/admin/models/system/sys_config.go b/app/admin/models/system/sys_config.go index 80f2c3f3..0075b5e2 100644 --- a/app/admin/models/system/sys_config.go +++ b/app/admin/models/system/sys_config.go @@ -27,4 +27,4 @@ func (e *SysConfig) Generate() models.ActiveRecord { func (e *SysConfig) GetId() interface{} { return e.Id -} \ No newline at end of file +} diff --git a/app/admin/router/init_router.go b/app/admin/router/init_router.go index 18e28416..f0db369f 100644 --- a/app/admin/router/init_router.go +++ b/app/admin/router/init_router.go @@ -2,6 +2,7 @@ package router import ( "github.com/go-admin-team/go-admin-core/sdk" + "github.com/go-admin-team/go-admin-core/sdk/api" "github.com/go-admin-team/go-admin-core/sdk/pkg" "os" @@ -35,7 +36,8 @@ func InitRouter() { } r.Use(common.Sentinel()). - Use(common.RequestId(pkg.TrafficKey)) + Use(common.RequestId(pkg.TrafficKey)). + Use(api.SetRequestLogger) middleware.InitMiddleware(r) // the jwt middleware authMiddleware, err := middleware.AuthInit() diff --git a/app/admin/router/sys_config.go b/app/admin/router/sys_config.go index 6664345b..b10ee60d 100644 --- a/app/admin/router/sys_config.go +++ b/app/admin/router/sys_config.go @@ -34,5 +34,4 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd r2.GET("", api.GetSysConfigBySysApp) } - -} \ No newline at end of file +} diff --git a/app/admin/router/sys_router.go b/app/admin/router/sys_router.go index d503ed8e..921dc27f 100644 --- a/app/admin/router/sys_router.go +++ b/app/admin/router/sys_router.go @@ -65,6 +65,8 @@ func sysNoCheckRoleRouter(r *gin.RouterGroup) { gen := &tools.Gen{} 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) diff --git a/app/admin/service/dto/sys_config.go b/app/admin/service/dto/sys_config.go index 014e6d58..be498452 100644 --- a/app/admin/service/dto/sys_config.go +++ b/app/admin/service/dto/sys_config.go @@ -116,4 +116,4 @@ func (s *SysConfigById) Bind(ctx *gin.Context) error { func (s *SysConfigById) GenerateM() (*system.SysConfig, error) { return &system.SysConfig{}, nil -} \ No newline at end of file +} diff --git a/app/admin/service/sys_config.go b/app/admin/service/sys_config.go index eb11d50a..c4d1756c 100644 --- a/app/admin/service/sys_config.go +++ b/app/admin/service/sys_config.go @@ -131,4 +131,4 @@ func (e *SysConfig) GetSysConfigByKEY(c *dto.SysConfigControl) error { } return nil -} \ No newline at end of file +} diff --git a/cmd/migrate/migration/version/1615948084336_migrate.go b/cmd/migrate/migration/version/1615948084336_migrate.go index 0478d823..5bd46179 100644 --- a/cmd/migrate/migration/version/1615948084336_migrate.go +++ b/cmd/migrate/migration/version/1615948084336_migrate.go @@ -25,4 +25,4 @@ func _1615948084336Test(db *gorm.DB, version string) error { Version: version, }).Error }) -} \ No newline at end of file +} diff --git a/cmd/migrate/migration/version/1615950701614_migrate.go b/cmd/migrate/migration/version/1615950701614_migrate.go index bc4e591f..856fa2f7 100644 --- a/cmd/migrate/migration/version/1615950701614_migrate.go +++ b/cmd/migrate/migration/version/1615950701614_migrate.go @@ -30,4 +30,4 @@ func _1615950701614Test(db *gorm.DB, version string) error { Version: version, }).Error }) -} \ No newline at end of file +} diff --git a/cmd/migrate/migration/version/1615961953379_migrate.go b/cmd/migrate/migration/version/1615961953379_migrate.go index 8871c2f9..66a3750d 100644 --- a/cmd/migrate/migration/version/1615961953379_migrate.go +++ b/cmd/migrate/migration/version/1615961953379_migrate.go @@ -30,4 +30,4 @@ func _1615961953379Test(db *gorm.DB, version string) error { Version: version, }).Error }) -} \ No newline at end of file +} diff --git a/common/global/adm.go b/common/global/adm.go index 977df5e2..1f356198 100644 --- a/common/global/adm.go +++ b/common/global/adm.go @@ -2,11 +2,11 @@ package global const ( // go-admin Version Info - Version = "1.3.0" + Version = "1.3.1rc.1" ) var ( Source string Driver string DBName string -) \ No newline at end of file +) diff --git a/docs/docs.go b/docs/docs.go index fd461e25..72cd1000 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -59,7 +59,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -96,50 +96,49 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } } }, "/api/v1/dept": { - "put": { + "get": { "security": [ { "Bearer": [] } ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], + "description": "分页列表", "tags": [ "部门" ], - "summary": "修改部门", + "summary": "分页部门列表数据", "parameters": [ { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true + "type": "string", + "description": "name", + "name": "name", + "in": "query" }, { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysDept" - } + "type": "string", + "description": "id", + "name": "id", + "in": "query" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" } ], "responses": { "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "type": "string" + "$ref": "#/definitions/response.Response" } } } @@ -165,7 +164,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysDept" + "$ref": "#/definitions/dto.SysDeptControl" } } ], @@ -177,6 +176,32 @@ var doc = `{ } } } + }, + "delete": { + "description": "删除数据", + "tags": [ + "部门" + ], + "summary": "删除部门", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDeptById" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } } }, "/api/v1/dept/{deptId}": { @@ -209,81 +234,11 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } - } - }, - "/api/v1/dept/{id}": { - "delete": { - "description": "删除数据", - "tags": [ - "部门" - ], - "summary": "删除部门", - "parameters": [ - { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/deptList": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "分页列表", - "tags": [ - "部门" - ], - "summary": "分页部门列表数据", - "parameters": [ - { - "type": "string", - "description": "name", - "name": "name", - "in": "query" - }, - { - "type": "string", - "description": "id", - "name": "id", - "in": "query" - }, - { - "type": "string", - "description": "position", - "name": "position", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/dict/data": { + }, "put": { "security": [ { @@ -295,51 +250,24 @@ var doc = `{ "application/json" ], "tags": [ - "字典数据" + "部门" ], - "summary": "修改字典数据", + "summary": "修改部门", "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, { "description": "body", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.DictType" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "字典数据" - ], - "summary": "添加字典数据", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.DictType" + "$ref": "#/definitions/dto.SysDeptControl" } } ], @@ -353,7 +281,7 @@ var doc = `{ } } }, - "/api/v1/dict/data/list": { + "/api/v1/dict/data": { "get": { "security": [ { @@ -401,7 +329,41 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典数据" + ], + "summary": "添加字典数据", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictDataControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" } } } @@ -432,7 +394,41 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典数据" + ], + "summary": "修改字典数据", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictDataControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" } } } @@ -462,108 +458,7 @@ var doc = `{ } } }, - "/api/v1/dict/databyType/{dictType}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "字典数据" - ], - "summary": "通过字典类型获取字典数据", - "parameters": [ - { - "type": "integer", - "description": "dictType", - "name": "dictType", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/dict/type": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "字典类型" - ], - "summary": "修改字典类型", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.DictType" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "字典类型" - ], - "summary": "添加字典类型", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.DictType" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/dict/type/list": { "get": { "security": [ { @@ -611,7 +506,83 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "添加字典类型", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictTypeControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/type-option-select": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典类型" + ], + "summary": "字典类型全部数据", + "parameters": [ + { + "type": "string", + "description": "dictName", + "name": "dictName", + "in": "query" + }, + { + "type": "string", + "description": "dictId", + "name": "dictId", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" } } } @@ -642,7 +613,41 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "修改字典类型", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictTypeControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" } } } @@ -673,34 +678,6 @@ var doc = `{ } }, "/api/v1/menu": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "菜单" - ], - "summary": "Menu列表数据", - "parameters": [ - { - "type": "string", - "description": "menuName", - "name": "menuName", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", - "schema": { - "type": "string" - } - } - } - }, "post": { "security": [ { @@ -768,7 +745,63 @@ var doc = `{ } } }, + "/api/v1/menu/": { + "delete": { + "description": "删除数据", + "tags": [ + "菜单" + ], + "summary": "删除菜单", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysMenuById" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/api/v1/menu/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "Menu详情数据", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + }, "put": { "security": [ { @@ -797,7 +830,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Menu" + "$ref": "#/definitions/dto.SysMenuControl" } } ], @@ -809,30 +842,6 @@ var doc = `{ } } } - }, - "delete": { - "description": "删除数据", - "tags": [ - "菜单" - ], - "summary": "删除菜单", - "parameters": [ - { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } } }, "/api/v1/menuTreeselect": { @@ -994,7 +1003,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1020,7 +1029,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Post" + "$ref": "#/definitions/dto.SysPostControl" } } ], @@ -1056,7 +1065,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Post" + "$ref": "#/definitions/dto.SysPostControl" } } ], @@ -1095,7 +1104,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1168,120 +1177,6 @@ var doc = `{ } }, "/api/v1/role": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "角色/Role" - ], - "summary": "获取Role数据", - "parameters": [ - { - "type": "string", - "description": "roleId", - "name": "roleId", - "in": "path" - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", - "schema": { - "type": "string" - } - } - } - }, - "put": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "角色/Role" - ], - "summary": "修改用户角色", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysRole" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"修改失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "角色/Role" - ], - "summary": "创建角色", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysRole" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/role/{roleId}": { - "delete": { - "description": "删除数据", - "tags": [ - "角色/Role" - ], - "summary": "删除用户角色", - "parameters": [ - { - "type": "integer", - "description": "roleId", - "name": "roleId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/rolelist": { "get": { "security": [ { @@ -1329,13 +1224,78 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "创建角色", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysRoleControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除数据", + "tags": [ + "角色/Role" + ], + "summary": "删除用户角色", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysRoleById" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" } } } } }, - "/api/v1/rolemenu": { + "/api/v1/role/{id}": { "get": { "security": [ { @@ -1344,15 +1304,15 @@ var doc = `{ ], "description": "获取JSON", "tags": [ - "角色菜单" + "角色/Role" ], - "summary": "RoleMenu列表数据", + "summary": "获取Role数据", "parameters": [ { "type": "string", - "description": "RoleId", - "name": "RoleId", - "in": "query" + "description": "roleId", + "name": "roleId", + "in": "path" } ], "responses": { @@ -1363,33 +1323,35 @@ var doc = `{ } } } - } - }, - "/api/v1/rolemenu/{id}": { - "delete": { - "description": "删除数据", - "tags": [ - "角色菜单" + }, + "put": { + "security": [ + { + "Bearer": [] + } ], - "summary": "删除用户菜单数据", + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "修改用户角色", "parameters": [ { - "type": "string", - "description": "id", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "menu_id", - "name": "menu_id", - "in": "query" + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysRoleControl" + } } ], "responses": { "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "description": "{\"code\": -1, \"message\": \"修改失败\"}", "schema": { "type": "string" } @@ -1425,7 +1387,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1523,7 +1485,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1584,7 +1546,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1601,12 +1563,20 @@ var doc = `{ "tags": [ "用户" ], - "summary": "获取用户角色和职位", + "summary": "列表用户信息数据", + "parameters": [ + { + "type": "string", + "description": "username", + "name": "username", + "in": "query" + } + ], "responses": { "200": { - "description": "{\"code\": 200, \"data\": [...]}", + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", "schema": { - "$ref": "#/definitions/app.Response" + "type": "string" } } } @@ -1627,7 +1597,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysUser" + "$ref": "#/definitions/dto.SysUserControl" } } ], @@ -1666,68 +1636,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/sysUserList": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "用户" - ], - "summary": "列表用户信息数据", - "parameters": [ - { - "type": "string", - "description": "username", - "name": "username", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/syscontent": { - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "内容管理" - ], - "summary": "添加内容管理", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysContent" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" + "$ref": "#/definitions/response.Response" } } } @@ -1747,7 +1656,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysUser" + "$ref": "#/definitions/dto.SysSettingControl" } } ], @@ -1778,7 +1687,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysUser" + "$ref": "#/definitions/dto.SysUserControl" } } ], @@ -1816,29 +1725,7 @@ var doc = `{ } } }, - "/api/v1/user/profile": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "个人中心" - ], - "summary": "获取个人中心用户", - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/user/profileAvatar": { + "/api/v1/user/avatar": { "post": { "description": "获取JSON", "consumes": [ @@ -1867,6 +1754,64 @@ var doc = `{ } } }, + "/api/v1/user/profile": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "个人中心" + ], + "summary": "获取个人中心用户", + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/v1/user/pwd": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "用户" + ], + "summary": "重置密码", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PassWord" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/login": { "post": { "description": "获取token\nLoginHandler can be used by clients to get a jwt token.\nPayload needs to be json in the form of {\"username\": \"USERNAME\", \"password\": \"PASSWORD\"}.\nReply will be of the form {\"token\": \"TOKEN\"}.\ndev mode:It should be noted that all fields cannot be empty, and a value of 0 can be passed in addition to the account password\n注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值", @@ -1881,7 +1826,7 @@ var doc = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Login" + "$ref": "#/definitions/system.Login" } } ], @@ -1919,316 +1864,33 @@ var doc = `{ } }, "definitions": { - "app.Response": { + "dto.PassWord": { "type": "object", "properties": { - "code": { - "description": "代码", - "type": "integer", - "example": 200 - }, - "data": { - "description": "数据集", - "type": "object" - }, - "msg": { - "description": "消息", - "type": "string" - }, - "requestId": { - "type": "string" - } - } - }, - "models.DictType": { - "type": "object", - "properties": { - "createBy": { - "description": "创建者", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "dictId": { - "type": "integer" - }, - "dictName": { - "description": "字典名称", - "type": "string" - }, - "dictType": { - "description": "字典类型", - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.Login": { - "type": "object", - "required": [ - "code", - "password", - "username", - "uuid" - ], - "properties": { - "code": { - "type": "string" - }, "password": { "type": "string" - }, - "username": { - "type": "string" - }, - "uuid": { - "type": "string" } } }, - "models.Menu": { + "dto.SysDeptById": { "type": "object", "properties": { - "action": { - "type": "string" - }, - "breadcrumb": { - "type": "string" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/models.Menu" - } - }, - "component": { - "type": "string" - }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "isFrame": { - "type": "string" - }, - "is_select": { - "type": "boolean" - }, - "menuId": { - "type": "integer" - }, - "menuName": { - "type": "string" - }, - "menuType": { - "type": "string" - }, - "noCache": { - "type": "boolean" - }, - "params": { - "type": "string" - }, - "parentId": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "paths": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "roleId": { - "type": "integer" - }, - "sort": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "visible": { - "type": "string" - } - } - }, - "models.Post": { - "type": "object", - "properties": { - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "params": { - "type": "string" - }, - "postCode": { - "description": "岗位代码", - "type": "string" - }, - "postId": { - "description": "岗位编号", - "type": "integer" - }, - "postName": { - "description": "岗位名称", - "type": "string" - }, - "remark": { - "description": "描述", - "type": "string" - }, - "sort": { - "description": "岗位排序", - "type": "integer" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.SysContent": { - "type": "object", - "properties": { - "cateId": { - "description": "分类id", - "type": "string" - }, - "content": { - "description": "内容", - "type": "string" - }, - "createBy": { - "description": "创建者", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, "id": { - "description": "id", "type": "integer" }, - "img": { - "description": "图片", - "type": "string" - }, - "name": { - "description": "名称", - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "sort": { - "description": "排序", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" + "ids": { + "type": "array", + "items": { + "type": "integer" + } } } }, - "models.SysDept": { + "dto.SysDeptControl": { "type": "object", "properties": { - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/models.SysDept" - } - }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, "deptId": { - "description": "部门编码", + "description": "编码", "type": "integer" }, "deptName": { @@ -2236,6 +1898,7 @@ var doc = `{ "type": "string" }, "deptPath": { + "description": "路径", "type": "string" }, "email": { @@ -2246,9 +1909,6 @@ var doc = `{ "description": "负责人", "type": "string" }, - "params": { - "type": "string" - }, "parentId": { "description": "上级部门", "type": "integer" @@ -2264,40 +1924,204 @@ var doc = `{ "status": { "description": "状态", "type": "string" - }, - "updateBy": { + } + } + }, + "dto.SysDictDataControl": { + "type": "object", + "properties": { + "cssClass": { "type": "string" }, - "updatedAt": { + "default": { + "type": "string" + }, + "dictLabel": { + "type": "string" + }, + "dictSort": { + "type": "integer" + }, + "dictType": { + "type": "string" + }, + "dictValue": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "isDefault": { + "type": "string" + }, + "listClass": { + "type": "string" + }, + "remark": { + "type": "string" + }, + "status": { "type": "string" } } }, - "models.SysRole": { + "dto.SysDictTypeControl": { + "type": "object", + "properties": { + "dictName": { + "type": "string" + }, + "dictType": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "remark": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "dto.SysMenuById": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "dto.SysMenuControl": { + "type": "object", + "properties": { + "action": { + "description": "请求方式", + "type": "string" + }, + "breadcrumb": { + "description": "是否面包屑", + "type": "string" + }, + "component": { + "description": "组件", + "type": "string" + }, + "icon": { + "description": "图标", + "type": "string" + }, + "isFrame": { + "description": "是否frame", + "type": "string" + }, + "menuId": { + "description": "编码", + "type": "integer" + }, + "menuName": { + "description": "菜单name", + "type": "string" + }, + "menuType": { + "description": "菜单类型", + "type": "string" + }, + "noCache": { + "description": "是否缓存", + "type": "boolean" + }, + "parentId": { + "description": "上级菜单", + "type": "integer" + }, + "path": { + "description": "路径", + "type": "string" + }, + "paths": { + "description": "id路径", + "type": "string" + }, + "permission": { + "description": "权限编码", + "type": "string" + }, + "sort": { + "description": "排序", + "type": "integer" + }, + "title": { + "description": "显示名称", + "type": "string" + }, + "visible": { + "description": "是否显示", + "type": "string" + } + } + }, + "dto.SysPostControl": { + "type": "object", + "properties": { + "postCode": { + "description": "编码", + "type": "string" + }, + "postId": { + "description": "id", + "type": "integer" + }, + "postName": { + "description": "名称", + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "sort": { + "description": "排序", + "type": "integer" + }, + "status": { + "description": "状态", + "type": "integer" + } + } + }, + "dto.SysRoleById": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "dto.SysRoleControl": { "type": "object", "properties": { "admin": { "type": "boolean" }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, "dataScope": { "type": "string" }, - "deletedAt": { - "type": "string" - }, - "deptIds": { - "type": "array", - "items": { - "type": "integer" - } - }, "flag": { + "description": "标记", "type": "string" }, "menuIds": { @@ -2306,9 +2130,6 @@ var doc = `{ "type": "integer" } }, - "params": { - "type": "string" - }, "remark": { "description": "备注", "type": "string" @@ -2330,89 +2151,71 @@ var doc = `{ "type": "integer" }, "status": { - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { + "description": "状态", "type": "string" } } }, - "models.SysUser": { + "dto.SysSettingControl": { "type": "object", + "required": [ + "logo", + "name", + "settings_id" + ], "properties": { - "avatar": { + "logo": { "description": "头像", "type": "string" }, - "createBy": { + "name": { + "description": "名称", "type": "string" }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { + "settings_id": { + "description": "头像", + "type": "integer" + } + } + }, + "dto.SysUserControl": { + "type": "object", + "properties": { + "avatar": { "type": "string" }, "deptId": { - "description": "部门编码", "type": "integer" }, "email": { - "description": "邮箱", "type": "string" }, "nickName": { - "description": "昵称", - "type": "string" - }, - "params": { "type": "string" }, "password": { - "description": "密码", "type": "string" }, "phone": { - "description": "手机号", "type": "string" }, "postId": { - "description": "职位编码", "type": "integer" }, "remark": { - "description": "备注", "type": "string" }, "roleId": { - "description": "角色编码", "type": "integer" }, - "salt": { - "description": "盐", - "type": "string" - }, "sex": { - "description": "性别", "type": "string" }, "status": { "type": "string" }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, "userId": { - "description": "编码", + "description": "用户ID", "type": "integer" }, "username": { @@ -2420,6 +2223,46 @@ var doc = `{ } } }, + "response.Response": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "msg": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "system.Login": { + "type": "object", + "required": [ + "code", + "password", + "username", + "uuid" + ], + "properties": { + "code": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, "tools.Params": { "type": "object", "properties": { @@ -2701,7 +2544,7 @@ type swaggerInfo struct { // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = swaggerInfo{ - Version: "1.0.1", + Version: "1.3.1", Host: "", BasePath: "", Schemes: []string{}, diff --git a/docs/swagger.json b/docs/swagger.json index a973b906..cd819640 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -8,7 +8,7 @@ "name": "MIT", "url": "https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md" }, - "version": "1.0.1" + "version": "1.3.1" }, "paths": { "/api/v1/db/columns/page": { @@ -42,7 +42,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -79,50 +79,49 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } } }, "/api/v1/dept": { - "put": { + "get": { "security": [ { "Bearer": [] } ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], + "description": "分页列表", "tags": [ "部门" ], - "summary": "修改部门", + "summary": "分页部门列表数据", "parameters": [ { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true + "type": "string", + "description": "name", + "name": "name", + "in": "query" }, { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysDept" - } + "type": "string", + "description": "id", + "name": "id", + "in": "query" + }, + { + "type": "string", + "description": "position", + "name": "position", + "in": "query" } ], "responses": { "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "type": "string" + "$ref": "#/definitions/response.Response" } } } @@ -148,7 +147,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysDept" + "$ref": "#/definitions/dto.SysDeptControl" } } ], @@ -160,6 +159,32 @@ } } } + }, + "delete": { + "description": "删除数据", + "tags": [ + "部门" + ], + "summary": "删除部门", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDeptById" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } } }, "/api/v1/dept/{deptId}": { @@ -192,81 +217,11 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } - } - }, - "/api/v1/dept/{id}": { - "delete": { - "description": "删除数据", - "tags": [ - "部门" - ], - "summary": "删除部门", - "parameters": [ - { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/deptList": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "分页列表", - "tags": [ - "部门" - ], - "summary": "分页部门列表数据", - "parameters": [ - { - "type": "string", - "description": "name", - "name": "name", - "in": "query" - }, - { - "type": "string", - "description": "id", - "name": "id", - "in": "query" - }, - { - "type": "string", - "description": "position", - "name": "position", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/dict/data": { + }, "put": { "security": [ { @@ -278,51 +233,24 @@ "application/json" ], "tags": [ - "字典数据" + "部门" ], - "summary": "修改字典数据", + "summary": "修改部门", "parameters": [ + { + "type": "integer", + "description": "id", + "name": "id", + "in": "path", + "required": true + }, { "description": "body", "name": "data", "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.DictType" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "字典数据" - ], - "summary": "添加字典数据", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.DictType" + "$ref": "#/definitions/dto.SysDeptControl" } } ], @@ -336,7 +264,7 @@ } } }, - "/api/v1/dict/data/list": { + "/api/v1/dict/data": { "get": { "security": [ { @@ -384,7 +312,41 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典数据" + ], + "summary": "添加字典数据", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictDataControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" } } } @@ -415,7 +377,41 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典数据" + ], + "summary": "修改字典数据", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictDataControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" } } } @@ -445,108 +441,7 @@ } } }, - "/api/v1/dict/databyType/{dictType}": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "字典数据" - ], - "summary": "通过字典类型获取字典数据", - "parameters": [ - { - "type": "integer", - "description": "dictType", - "name": "dictType", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, "/api/v1/dict/type": { - "put": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "字典类型" - ], - "summary": "修改字典类型", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.DictType" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "字典类型" - ], - "summary": "添加字典类型", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.DictType" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/dict/type/list": { "get": { "security": [ { @@ -594,7 +489,83 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "添加字典类型", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictTypeControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/dict/type-option-select": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "字典类型" + ], + "summary": "字典类型全部数据", + "parameters": [ + { + "type": "string", + "description": "dictName", + "name": "dictName", + "in": "query" + }, + { + "type": "string", + "description": "dictId", + "name": "dictId", + "in": "query" + }, + { + "type": "string", + "description": "dictType", + "name": "dictType", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" } } } @@ -625,7 +596,41 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "字典类型" + ], + "summary": "修改字典类型", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysDictTypeControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" } } } @@ -656,34 +661,6 @@ } }, "/api/v1/menu": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "菜单" - ], - "summary": "Menu列表数据", - "parameters": [ - { - "type": "string", - "description": "menuName", - "name": "menuName", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", - "schema": { - "type": "string" - } - } - } - }, "post": { "security": [ { @@ -751,7 +728,63 @@ } } }, + "/api/v1/menu/": { + "delete": { + "description": "删除数据", + "tags": [ + "菜单" + ], + "summary": "删除菜单", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysMenuById" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/api/v1/menu/{id}": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "菜单" + ], + "summary": "Menu详情数据", + "parameters": [ + { + "type": "string", + "description": "menuName", + "name": "menuName", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", + "schema": { + "type": "string" + } + } + } + }, "put": { "security": [ { @@ -780,7 +813,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Menu" + "$ref": "#/definitions/dto.SysMenuControl" } } ], @@ -792,30 +825,6 @@ } } } - }, - "delete": { - "description": "删除数据", - "tags": [ - "菜单" - ], - "summary": "删除菜单", - "parameters": [ - { - "type": "integer", - "description": "id", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } } }, "/api/v1/menuTreeselect": { @@ -977,7 +986,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1003,7 +1012,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Post" + "$ref": "#/definitions/dto.SysPostControl" } } ], @@ -1039,7 +1048,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Post" + "$ref": "#/definitions/dto.SysPostControl" } } ], @@ -1078,7 +1087,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1151,120 +1160,6 @@ } }, "/api/v1/role": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "角色/Role" - ], - "summary": "获取Role数据", - "parameters": [ - { - "type": "string", - "description": "roleId", - "name": "roleId", - "in": "path" - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", - "schema": { - "type": "string" - } - } - } - }, - "put": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "角色/Role" - ], - "summary": "修改用户角色", - "parameters": [ - { - "description": "body", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysRole" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"修改失败\"}", - "schema": { - "type": "string" - } - } - } - }, - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "角色/Role" - ], - "summary": "创建角色", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysRole" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/role/{roleId}": { - "delete": { - "description": "删除数据", - "tags": [ - "角色/Role" - ], - "summary": "删除用户角色", - "parameters": [ - { - "type": "integer", - "description": "roleId", - "name": "roleId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/rolelist": { "get": { "security": [ { @@ -1312,13 +1207,78 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "创建角色", + "parameters": [ + { + "description": "data", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysRoleControl" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "delete": { + "security": [ + { + "Bearer": [] + } + ], + "description": "删除数据", + "tags": [ + "角色/Role" + ], + "summary": "删除用户角色", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysRoleById" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" } } } } }, - "/api/v1/rolemenu": { + "/api/v1/role/{id}": { "get": { "security": [ { @@ -1327,15 +1287,15 @@ ], "description": "获取JSON", "tags": [ - "角色菜单" + "角色/Role" ], - "summary": "RoleMenu列表数据", + "summary": "获取Role数据", "parameters": [ { "type": "string", - "description": "RoleId", - "name": "RoleId", - "in": "query" + "description": "roleId", + "name": "roleId", + "in": "path" } ], "responses": { @@ -1346,33 +1306,35 @@ } } } - } - }, - "/api/v1/rolemenu/{id}": { - "delete": { - "description": "删除数据", - "tags": [ - "角色菜单" + }, + "put": { + "security": [ + { + "Bearer": [] + } ], - "summary": "删除用户菜单数据", + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "角色/Role" + ], + "summary": "修改用户角色", "parameters": [ { - "type": "string", - "description": "id", - "name": "id", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "menu_id", - "name": "menu_id", - "in": "query" + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.SysRoleControl" + } } ], "responses": { "200": { - "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "description": "{\"code\": -1, \"message\": \"修改失败\"}", "schema": { "type": "string" } @@ -1408,7 +1370,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1506,7 +1468,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1567,7 +1529,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" + "$ref": "#/definitions/response.Response" } } } @@ -1584,12 +1546,20 @@ "tags": [ "用户" ], - "summary": "获取用户角色和职位", + "summary": "列表用户信息数据", + "parameters": [ + { + "type": "string", + "description": "username", + "name": "username", + "in": "query" + } + ], "responses": { "200": { - "description": "{\"code\": 200, \"data\": [...]}", + "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", "schema": { - "$ref": "#/definitions/app.Response" + "type": "string" } } } @@ -1610,7 +1580,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysUser" + "$ref": "#/definitions/dto.SysUserControl" } } ], @@ -1649,68 +1619,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/sysUserList": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "用户" - ], - "summary": "列表用户信息数据", - "parameters": [ - { - "type": "string", - "description": "username", - "name": "username", - "in": "query" - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/api/v1/syscontent": { - "post": { - "description": "获取JSON", - "consumes": [ - "application/json" - ], - "tags": [ - "内容管理" - ], - "summary": "添加内容管理", - "parameters": [ - { - "description": "data", - "name": "data", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/models.SysContent" - } - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" + "$ref": "#/definitions/response.Response" } } } @@ -1730,7 +1639,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysUser" + "$ref": "#/definitions/dto.SysSettingControl" } } ], @@ -1761,7 +1670,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.SysUser" + "$ref": "#/definitions/dto.SysUserControl" } } ], @@ -1799,29 +1708,7 @@ } } }, - "/api/v1/user/profile": { - "get": { - "security": [ - { - "Bearer": [] - } - ], - "description": "获取JSON", - "tags": [ - "个人中心" - ], - "summary": "获取个人中心用户", - "responses": { - "200": { - "description": "{\"code\": 200, \"data\": [...]}", - "schema": { - "$ref": "#/definitions/app.Response" - } - } - } - } - }, - "/api/v1/user/profileAvatar": { + "/api/v1/user/avatar": { "post": { "description": "获取JSON", "consumes": [ @@ -1850,6 +1737,64 @@ } } }, + "/api/v1/user/profile": { + "get": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "tags": [ + "个人中心" + ], + "summary": "获取个人中心用户", + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, + "/api/v1/user/pwd": { + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "获取JSON", + "consumes": [ + "application/json" + ], + "tags": [ + "用户" + ], + "summary": "重置密码", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PassWord" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/login": { "post": { "description": "获取token\nLoginHandler can be used by clients to get a jwt token.\nPayload needs to be json in the form of {\"username\": \"USERNAME\", \"password\": \"PASSWORD\"}.\nReply will be of the form {\"token\": \"TOKEN\"}.\ndev mode:It should be noted that all fields cannot be empty, and a value of 0 can be passed in addition to the account password\n注意:开发模式:需要注意全部字段不能为空,账号密码外可以传入0值", @@ -1864,7 +1809,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/models.Login" + "$ref": "#/definitions/system.Login" } } ], @@ -1902,316 +1847,33 @@ } }, "definitions": { - "app.Response": { + "dto.PassWord": { "type": "object", "properties": { - "code": { - "description": "代码", - "type": "integer", - "example": 200 - }, - "data": { - "description": "数据集", - "type": "object" - }, - "msg": { - "description": "消息", - "type": "string" - }, - "requestId": { - "type": "string" - } - } - }, - "models.DictType": { - "type": "object", - "properties": { - "createBy": { - "description": "创建者", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "dictId": { - "type": "integer" - }, - "dictName": { - "description": "字典名称", - "type": "string" - }, - "dictType": { - "description": "字典类型", - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.Login": { - "type": "object", - "required": [ - "code", - "password", - "username", - "uuid" - ], - "properties": { - "code": { - "type": "string" - }, "password": { "type": "string" - }, - "username": { - "type": "string" - }, - "uuid": { - "type": "string" } } }, - "models.Menu": { + "dto.SysDeptById": { "type": "object", "properties": { - "action": { - "type": "string" - }, - "breadcrumb": { - "type": "string" - }, - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/models.Menu" - } - }, - "component": { - "type": "string" - }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "icon": { - "type": "string" - }, - "isFrame": { - "type": "string" - }, - "is_select": { - "type": "boolean" - }, - "menuId": { - "type": "integer" - }, - "menuName": { - "type": "string" - }, - "menuType": { - "type": "string" - }, - "noCache": { - "type": "boolean" - }, - "params": { - "type": "string" - }, - "parentId": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "paths": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "roleId": { - "type": "integer" - }, - "sort": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, - "visible": { - "type": "string" - } - } - }, - "models.Post": { - "type": "object", - "properties": { - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, - "params": { - "type": "string" - }, - "postCode": { - "description": "岗位代码", - "type": "string" - }, - "postId": { - "description": "岗位编号", - "type": "integer" - }, - "postName": { - "description": "岗位名称", - "type": "string" - }, - "remark": { - "description": "描述", - "type": "string" - }, - "sort": { - "description": "岗位排序", - "type": "integer" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - } - } - }, - "models.SysContent": { - "type": "object", - "properties": { - "cateId": { - "description": "分类id", - "type": "string" - }, - "content": { - "description": "内容", - "type": "string" - }, - "createBy": { - "description": "创建者", - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, "id": { - "description": "id", "type": "integer" }, - "img": { - "description": "图片", - "type": "string" - }, - "name": { - "description": "名称", - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "sort": { - "description": "排序", - "type": "string" - }, - "status": { - "description": "状态", - "type": "string" - }, - "updateBy": { - "description": "更新者", - "type": "string" - }, - "updatedAt": { - "type": "string" + "ids": { + "type": "array", + "items": { + "type": "integer" + } } } }, - "models.SysDept": { + "dto.SysDeptControl": { "type": "object", "properties": { - "children": { - "type": "array", - "items": { - "$ref": "#/definitions/models.SysDept" - } - }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { - "type": "string" - }, "deptId": { - "description": "部门编码", + "description": "编码", "type": "integer" }, "deptName": { @@ -2219,6 +1881,7 @@ "type": "string" }, "deptPath": { + "description": "路径", "type": "string" }, "email": { @@ -2229,9 +1892,6 @@ "description": "负责人", "type": "string" }, - "params": { - "type": "string" - }, "parentId": { "description": "上级部门", "type": "integer" @@ -2247,40 +1907,204 @@ "status": { "description": "状态", "type": "string" - }, - "updateBy": { + } + } + }, + "dto.SysDictDataControl": { + "type": "object", + "properties": { + "cssClass": { "type": "string" }, - "updatedAt": { + "default": { + "type": "string" + }, + "dictLabel": { + "type": "string" + }, + "dictSort": { + "type": "integer" + }, + "dictType": { + "type": "string" + }, + "dictValue": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "isDefault": { + "type": "string" + }, + "listClass": { + "type": "string" + }, + "remark": { + "type": "string" + }, + "status": { "type": "string" } } }, - "models.SysRole": { + "dto.SysDictTypeControl": { + "type": "object", + "properties": { + "dictName": { + "type": "string" + }, + "dictType": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "remark": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "dto.SysMenuById": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "dto.SysMenuControl": { + "type": "object", + "properties": { + "action": { + "description": "请求方式", + "type": "string" + }, + "breadcrumb": { + "description": "是否面包屑", + "type": "string" + }, + "component": { + "description": "组件", + "type": "string" + }, + "icon": { + "description": "图标", + "type": "string" + }, + "isFrame": { + "description": "是否frame", + "type": "string" + }, + "menuId": { + "description": "编码", + "type": "integer" + }, + "menuName": { + "description": "菜单name", + "type": "string" + }, + "menuType": { + "description": "菜单类型", + "type": "string" + }, + "noCache": { + "description": "是否缓存", + "type": "boolean" + }, + "parentId": { + "description": "上级菜单", + "type": "integer" + }, + "path": { + "description": "路径", + "type": "string" + }, + "paths": { + "description": "id路径", + "type": "string" + }, + "permission": { + "description": "权限编码", + "type": "string" + }, + "sort": { + "description": "排序", + "type": "integer" + }, + "title": { + "description": "显示名称", + "type": "string" + }, + "visible": { + "description": "是否显示", + "type": "string" + } + } + }, + "dto.SysPostControl": { + "type": "object", + "properties": { + "postCode": { + "description": "编码", + "type": "string" + }, + "postId": { + "description": "id", + "type": "integer" + }, + "postName": { + "description": "名称", + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "sort": { + "description": "排序", + "type": "integer" + }, + "status": { + "description": "状态", + "type": "integer" + } + } + }, + "dto.SysRoleById": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "ids": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "dto.SysRoleControl": { "type": "object", "properties": { "admin": { "type": "boolean" }, - "createBy": { - "type": "string" - }, - "createdAt": { - "type": "string" - }, "dataScope": { "type": "string" }, - "deletedAt": { - "type": "string" - }, - "deptIds": { - "type": "array", - "items": { - "type": "integer" - } - }, "flag": { + "description": "标记", "type": "string" }, "menuIds": { @@ -2289,9 +2113,6 @@ "type": "integer" } }, - "params": { - "type": "string" - }, "remark": { "description": "备注", "type": "string" @@ -2313,89 +2134,71 @@ "type": "integer" }, "status": { - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updatedAt": { + "description": "状态", "type": "string" } } }, - "models.SysUser": { + "dto.SysSettingControl": { "type": "object", + "required": [ + "logo", + "name", + "settings_id" + ], "properties": { - "avatar": { + "logo": { "description": "头像", "type": "string" }, - "createBy": { + "name": { + "description": "名称", "type": "string" }, - "createdAt": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "deletedAt": { + "settings_id": { + "description": "头像", + "type": "integer" + } + } + }, + "dto.SysUserControl": { + "type": "object", + "properties": { + "avatar": { "type": "string" }, "deptId": { - "description": "部门编码", "type": "integer" }, "email": { - "description": "邮箱", "type": "string" }, "nickName": { - "description": "昵称", - "type": "string" - }, - "params": { "type": "string" }, "password": { - "description": "密码", "type": "string" }, "phone": { - "description": "手机号", "type": "string" }, "postId": { - "description": "职位编码", "type": "integer" }, "remark": { - "description": "备注", "type": "string" }, "roleId": { - "description": "角色编码", "type": "integer" }, - "salt": { - "description": "盐", - "type": "string" - }, "sex": { - "description": "性别", "type": "string" }, "status": { "type": "string" }, - "updateBy": { - "type": "string" - }, - "updatedAt": { - "type": "string" - }, "userId": { - "description": "编码", + "description": "用户ID", "type": "integer" }, "username": { @@ -2403,6 +2206,46 @@ } } }, + "response.Response": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "msg": { + "type": "string" + }, + "requestId": { + "type": "string" + }, + "status": { + "type": "string" + } + } + }, + "system.Login": { + "type": "object", + "required": [ + "code", + "password", + "username", + "uuid" + ], + "properties": { + "code": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, "tools.Params": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0ef911f3..b9377fe9 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,224 +1,28 @@ definitions: - app.Response: + dto.PassWord: properties: - code: - description: 代码 - example: 200 - type: integer - data: - description: 数据集 - type: object - msg: - description: 消息 - type: string - requestId: - type: string - type: object - models.DictType: - properties: - createBy: - description: 创建者 - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string - dictId: - type: integer - dictName: - description: 字典名称 - type: string - dictType: - description: 字典类型 - type: string - params: - type: string - remark: - description: 备注 - type: string - status: - description: 状态 - type: string - updateBy: - description: 更新者 - type: string - updatedAt: - type: string - type: object - models.Login: - properties: - code: - type: string password: type: string - username: - type: string - uuid: - type: string - required: - - code - - password - - username - - uuid type: object - models.Menu: + dto.SysDeptById: properties: - action: - type: string - breadcrumb: - type: string - children: - items: - $ref: '#/definitions/models.Menu' - type: array - component: - type: string - createBy: - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string - icon: - type: string - is_select: - type: boolean - isFrame: - type: string - menuId: - type: integer - menuName: - type: string - menuType: - type: string - noCache: - type: boolean - params: - type: string - parentId: - type: integer - path: - type: string - paths: - type: string - permission: - type: string - roleId: - type: integer - sort: - type: integer - title: - type: string - updateBy: - type: string - updatedAt: - type: string - visible: - type: string - type: object - models.Post: - properties: - createBy: - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string - params: - type: string - postCode: - description: 岗位代码 - type: string - postId: - description: 岗位编号 - type: integer - postName: - description: 岗位名称 - type: string - remark: - description: 描述 - type: string - sort: - description: 岗位排序 - type: integer - status: - description: 状态 - type: string - updateBy: - type: string - updatedAt: - type: string - type: object - models.SysContent: - properties: - cateId: - description: 分类id - type: string - content: - description: 内容 - type: string - createBy: - description: 创建者 - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string id: - description: id type: integer - img: - description: 图片 - type: string - name: - description: 名称 - type: string - params: - type: string - remark: - description: 备注 - type: string - sort: - description: 排序 - type: string - status: - description: 状态 - type: string - updateBy: - description: 更新者 - type: string - updatedAt: - type: string - type: object - models.SysDept: - properties: - children: + ids: items: - $ref: '#/definitions/models.SysDept' + type: integer type: array - createBy: - type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: - type: string + type: object + dto.SysDeptControl: + properties: deptId: - description: 部门编码 + description: 编码 type: integer deptName: description: 部门名称 type: string deptPath: + description: 路径 type: string email: description: 邮箱 @@ -226,8 +30,6 @@ definitions: leader: description: 负责人 type: string - params: - type: string parentId: description: 上级部门 type: integer @@ -240,35 +42,148 @@ definitions: status: description: 状态 type: string - updateBy: + type: object + dto.SysDictDataControl: + properties: + cssClass: type: string - updatedAt: + default: + type: string + dictLabel: + type: string + dictSort: + type: integer + dictType: + type: string + dictValue: + type: string + id: + type: integer + isDefault: + type: string + listClass: + type: string + remark: + type: string + status: type: string type: object - models.SysRole: + dto.SysDictTypeControl: properties: - admin: - type: boolean - createBy: + dictName: type: string - createdAt: + dictType: type: string - dataScope: + id: + type: integer + remark: type: string - deletedAt: + status: type: string - deptIds: + type: object + dto.SysMenuById: + properties: + id: + type: integer + ids: items: type: integer type: array + type: object + dto.SysMenuControl: + properties: + action: + description: 请求方式 + type: string + breadcrumb: + description: 是否面包屑 + type: string + component: + description: 组件 + type: string + icon: + description: 图标 + type: string + isFrame: + description: 是否frame + type: string + menuId: + description: 编码 + type: integer + menuName: + description: 菜单name + type: string + menuType: + description: 菜单类型 + type: string + noCache: + description: 是否缓存 + type: boolean + parentId: + description: 上级菜单 + type: integer + path: + description: 路径 + type: string + paths: + description: id路径 + type: string + permission: + description: 权限编码 + type: string + sort: + description: 排序 + type: integer + title: + description: 显示名称 + type: string + visible: + description: 是否显示 + type: string + type: object + dto.SysPostControl: + properties: + postCode: + description: 编码 + type: string + postId: + description: id + type: integer + postName: + description: 名称 + type: string + remark: + description: 备注 + type: string + sort: + description: 排序 + type: integer + status: + description: 状态 + type: integer + type: object + dto.SysRoleById: + properties: + id: + type: integer + ids: + items: + type: integer + type: array + type: object + dto.SysRoleControl: + properties: + admin: + type: boolean + dataScope: + type: string flag: + description: 标记 type: string menuIds: items: type: integer type: array - params: - type: string remark: description: 备注 type: string @@ -285,69 +200,82 @@ definitions: description: 角色排序 type: integer status: - type: string - updateBy: - type: string - updatedAt: + description: 状态 type: string type: object - models.SysUser: + dto.SysSettingControl: properties: - avatar: + logo: description: 头像 type: string - createBy: + name: + description: 名称 type: string - createdAt: - type: string - dataScope: - type: string - deletedAt: + settings_id: + description: 头像 + type: integer + required: + - logo + - name + - settings_id + type: object + dto.SysUserControl: + properties: + avatar: type: string deptId: - description: 部门编码 type: integer email: - description: 邮箱 type: string nickName: - description: 昵称 - type: string - params: type: string password: - description: 密码 type: string phone: - description: 手机号 type: string postId: - description: 职位编码 type: integer remark: - description: 备注 type: string roleId: - description: 角色编码 type: integer - salt: - description: 盐 - type: string sex: - description: 性别 type: string status: type: string - updateBy: - type: string - updatedAt: - type: string userId: - description: 编码 + description: 用户ID type: integer username: type: string type: object + response.Response: + properties: + code: + type: integer + msg: + type: string + requestId: + type: string + status: + type: string + type: object + system.Login: + properties: + code: + type: string + password: + type: string + username: + type: string + uuid: + type: string + required: + - code + - password + - username + - uuid + type: object tools.Params: properties: treeCode: @@ -532,7 +460,7 @@ info: name: MIT url: https://github.com/go-admin-team/go-admin/blob/master/LICENSE.md title: go-admin API - version: 1.0.1 + version: 1.3.1 paths: /api/v1/db/columns/page: get: @@ -554,7 +482,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' summary: 分页列表数据 / page list data tags: - 工具 / Tools @@ -578,89 +506,20 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' summary: 分页列表数据 / page list data tags: - 工具 / Tools /api/v1/dept: - post: - consumes: - - application/json - description: 获取JSON + delete: + description: 删除数据 parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysDept' - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 添加部门 - tags: - - 部门 - put: - consumes: - - application/json - description: 获取JSON - parameters: - - description: id - in: path - name: id - required: true - type: integer - description: body in: body name: data required: true schema: - $ref: '#/definitions/models.SysDept' - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 修改部门 - tags: - - 部门 - /api/v1/dept/{deptId}: - get: - description: 获取JSON - parameters: - - description: deptId - in: path - name: deptId - type: string - - description: position - in: query - name: position - type: string - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 部门列表数据 - tags: - - 部门 - /api/v1/dept/{id}: - delete: - description: 删除数据 - parameters: - - description: id - in: path - name: id - required: true - type: integer + $ref: '#/definitions/dto.SysDeptById' responses: "200": description: '{"code": -1, "message": "删除失败"}' @@ -669,7 +528,6 @@ paths: summary: 删除部门 tags: - 部门 - /api/v1/deptList: get: description: 分页列表 parameters: @@ -689,13 +547,12 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 分页部门列表数据 tags: - 部门 - /api/v1/dict/data: post: consumes: - application/json @@ -706,7 +563,110 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.DictType' + $ref: '#/definitions/dto.SysDeptControl' + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加部门 + tags: + - 部门 + /api/v1/dept/{deptId}: + get: + description: 获取JSON + parameters: + - description: deptId + in: path + name: deptId + type: string + - description: position + in: query + name: position + type: string + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/response.Response' + security: + - Bearer: [] + summary: 部门列表数据 + tags: + - 部门 + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: id + in: path + name: id + required: true + type: integer + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/dto.SysDeptControl' + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改部门 + tags: + - 部门 + /api/v1/dict/data: + get: + description: 获取JSON + parameters: + - description: status + in: query + name: status + type: string + - description: dictCode + in: query + name: dictCode + type: string + - description: dictType + in: query + name: dictType + type: string + - description: 页条数 + in: query + name: pageSize + type: integer + - description: 页码 + in: query + name: pageIndex + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/response.Response' + security: + - Bearer: [] + summary: 字典数据列表 + tags: + - 字典数据 + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/dto.SysDictDataControl' responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -717,27 +677,6 @@ paths: summary: 添加字典数据 tags: - 字典数据 - put: - consumes: - - application/json - description: 获取JSON - parameters: - - description: body - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.DictType' - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - security: - - Bearer: [] - summary: 修改字典数据 - tags: - - 字典数据 /api/v1/dict/data/{dictCode}: delete: description: 删除数据 @@ -767,23 +706,44 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 通过编码获取字典数据 tags: - 字典数据 - /api/v1/dict/data/list: + put: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/dto.SysDictDataControl' + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改字典数据 + tags: + - 字典数据 + /api/v1/dict/type: get: description: 获取JSON parameters: - - description: status + - description: dictName in: query - name: status + name: dictName type: string - - description: dictCode + - description: dictId in: query - name: dictCode + name: dictId type: string - description: dictType in: query @@ -801,32 +761,12 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] - summary: 字典数据列表 + summary: 字典类型列表数据 tags: - - 字典数据 - /api/v1/dict/databyType/{dictType}: - get: - description: 获取JSON - parameters: - - description: dictType - in: path - name: dictType - required: true - type: integer - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 通过字典类型获取字典数据 - tags: - - 字典数据 - /api/v1/dict/type: + - 字典类型 post: consumes: - application/json @@ -837,7 +777,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.DictType' + $ref: '#/definitions/dto.SysDictTypeControl' responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -848,25 +788,30 @@ paths: summary: 添加字典类型 tags: - 字典类型 - put: - consumes: - - application/json + /api/v1/dict/type-option-select: + get: description: 获取JSON parameters: - - description: body - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.DictType' + - description: dictName + in: query + name: dictName + type: string + - description: dictId + in: query + name: dictId + type: string + - description: dictType + in: query + name: dictType + type: string responses: "200": - description: '{"code": -1, "message": "添加失败"}' + description: '{"code": 200, "data": [...]}' schema: - type: string + $ref: '#/definitions/response.Response' security: - Bearer: [] - summary: 修改字典类型 + summary: 字典类型全部数据 tags: - 字典类型 /api/v1/dict/type/{dictId}: @@ -898,64 +843,34 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 通过字典id获取字典类型 tags: - 字典类型 - /api/v1/dict/type/list: - get: + put: + consumes: + - application/json description: 获取JSON parameters: - - description: dictName - in: query - name: dictName - type: string - - description: dictId - in: query - name: dictId - type: string - - description: dictType - in: query - name: dictType - type: string - - description: 页条数 - in: query - name: pageSize - type: integer - - description: 页码 - in: query - name: pageIndex - type: integer + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/dto.SysDictTypeControl' responses: "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 字典类型列表数据 - tags: - - 字典类型 - /api/v1/menu: - get: - description: 获取JSON - parameters: - - description: menuName - in: query - name: menuName - type: string - responses: - "200": - description: '{"code": -1, "message": "抱歉未找到相关信息"}' + description: '{"code": -1, "message": "添加失败"}' schema: type: string security: - Bearer: [] - summary: Menu列表数据 + summary: 修改字典类型 tags: - - 菜单 + - 字典类型 + /api/v1/menu: post: consumes: - application/x-www-form-urlencoded @@ -1000,15 +915,16 @@ paths: summary: 创建菜单 tags: - 菜单 - /api/v1/menu/{id}: + /api/v1/menu/: delete: description: 删除数据 parameters: - - description: id - in: path - name: id + - description: body + in: body + name: data required: true - type: integer + schema: + $ref: '#/definitions/dto.SysMenuById' responses: "200": description: '{"code": -1, "message": "删除失败"}' @@ -1017,6 +933,24 @@ paths: summary: 删除菜单 tags: - 菜单 + /api/v1/menu/{id}: + get: + description: 获取JSON + parameters: + - description: menuName + in: query + name: menuName + type: string + responses: + "200": + description: '{"code": -1, "message": "抱歉未找到相关信息"}' + schema: + type: string + security: + - Bearer: [] + summary: Menu详情数据 + tags: + - 菜单 put: consumes: - application/x-www-form-urlencoded @@ -1032,7 +966,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.Menu' + $ref: '#/definitions/dto.SysMenuControl' responses: "200": description: '{"code": -1, "message": "修改失败"}' @@ -1138,7 +1072,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 岗位列表数据 @@ -1154,7 +1088,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.Post' + $ref: '#/definitions/dto.SysPostControl' responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1176,7 +1110,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.Post' + $ref: '#/definitions/dto.SysPostControl' responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1220,7 +1154,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 获取岗位信息 @@ -1251,79 +1185,25 @@ paths: tags: - 公共接口 /api/v1/role: - get: - description: 获取JSON - parameters: - - description: roleId - in: path - name: roleId - type: string - responses: - "200": - description: '{"code": -1, "message": "抱歉未找到相关信息"}' - schema: - type: string - security: - - Bearer: [] - summary: 获取Role数据 - tags: - - 角色/Role - post: - consumes: - - application/json - description: 获取JSON - parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysRole' - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - summary: 创建角色 - tags: - - 角色/Role - put: - consumes: - - application/json - description: 获取JSON + delete: + description: 删除数据 parameters: - description: body in: body name: data required: true schema: - $ref: '#/definitions/models.SysRole' - responses: - "200": - description: '{"code": -1, "message": "修改失败"}' - schema: - type: string - summary: 修改用户角色 - tags: - - 角色/Role - /api/v1/role/{roleId}: - delete: - description: 删除数据 - parameters: - - description: roleId - in: path - name: roleId - required: true - type: integer + $ref: '#/definitions/dto.SysRoleById' responses: "200": description: '{"code": -1, "message": "删除失败"}' schema: type: string + security: + - Bearer: [] summary: 删除用户角色 tags: - 角色/Role - /api/v1/rolelist: get: description: Get JSON parameters: @@ -1351,19 +1231,40 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 角色列表数据 tags: - 角色/Role - /api/v1/rolemenu: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: data + in: body + name: data + required: true + schema: + $ref: '#/definitions/dto.SysRoleControl' + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 创建角色 + tags: + - 角色/Role + /api/v1/role/{id}: get: description: 获取JSON parameters: - - description: RoleId - in: query - name: RoleId + - description: roleId + in: path + name: roleId type: string responses: "200": @@ -1372,30 +1273,30 @@ paths: type: string security: - Bearer: [] - summary: RoleMenu列表数据 + summary: 获取Role数据 tags: - - 角色菜单 - /api/v1/rolemenu/{id}: - delete: - description: 删除数据 + - 角色/Role + put: + consumes: + - application/json + description: 获取JSON parameters: - - description: id - in: path - name: id + - description: body + in: body + name: data required: true - type: string - - description: menu_id - in: query - name: menu_id - type: string + schema: + $ref: '#/definitions/dto.SysRoleControl' responses: "200": - description: '{"code": -1, "message": "删除失败"}' + description: '{"code": -1, "message": "修改失败"}' schema: type: string - summary: 删除用户菜单数据 + security: + - Bearer: [] + summary: 修改用户角色 tags: - - 角色菜单 + - 角色/Role /api/v1/setting: get: description: 获取JSON @@ -1414,7 +1315,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' summary: 系统信息 tags: - 系统信息 @@ -1488,7 +1389,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 获取配置 @@ -1514,21 +1415,26 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' summary: 分页列表数据 tags: - 工具 - 生成表 /api/v1/sysUser: get: description: 获取JSON + parameters: + - description: username + in: query + name: username + type: string responses: "200": - description: '{"code": 200, "data": [...]}' + description: '{"code": -1, "message": "抱歉未找到相关信息"}' schema: - $ref: '#/definitions/app.Response' + type: string security: - Bearer: [] - summary: 获取用户角色和职位 + summary: 列表用户信息数据 tags: - 用户 post: @@ -1541,7 +1447,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.SysUser' + $ref: '#/definitions/dto.SysUserControl' responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1563,50 +1469,12 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/app.Response' + $ref: '#/definitions/response.Response' security: - Bearer: [] summary: 获取用户 tags: - 用户 - /api/v1/sysUserList: - get: - description: 获取JSON - parameters: - - description: username - in: query - name: username - type: string - responses: - "200": - description: '{"code": -1, "message": "抱歉未找到相关信息"}' - schema: - type: string - security: - - Bearer: [] - summary: 列表用户信息数据 - tags: - - 用户 - /api/v1/syscontent: - post: - consumes: - - application/json - description: 获取JSON - parameters: - - description: data - in: body - name: data - required: true - schema: - $ref: '#/definitions/models.SysContent' - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - summary: 添加内容管理 - tags: - - 内容管理 /api/v1/system/setting: post: description: 获取JSON @@ -1616,7 +1484,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.SysUser' + $ref: '#/definitions/dto.SysSettingControl' responses: "200": description: '{"code": -1, "message": "添加失败"}' @@ -1652,7 +1520,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.SysUser' + $ref: '#/definitions/dto.SysUserControl' responses: "200": description: '{"code": -1, "message": "修改失败"}' @@ -1661,20 +1529,7 @@ paths: summary: 修改用户数据 tags: - 用户 - /api/v1/user/profile: - get: - description: 获取JSON - responses: - "200": - description: '{"code": 200, "data": [...]}' - schema: - $ref: '#/definitions/app.Response' - security: - - Bearer: [] - summary: 获取个人中心用户 - tags: - - 个人中心 - /api/v1/user/profileAvatar: + /api/v1/user/avatar: post: consumes: - multipart/form-data @@ -1693,6 +1548,41 @@ paths: summary: 修改头像 tags: - 用户 + /api/v1/user/profile: + get: + description: 获取JSON + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/response.Response' + security: + - Bearer: [] + summary: 获取个人中心用户 + tags: + - 个人中心 + /api/v1/user/pwd: + post: + consumes: + - application/json + description: 获取JSON + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/dto.PassWord' + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/response.Response' + security: + - Bearer: [] + summary: 重置密码 + tags: + - 用户 /login: post: consumes: @@ -1710,7 +1600,7 @@ paths: name: account required: true schema: - $ref: '#/definitions/models.Login' + $ref: '#/definitions/system.Login' responses: "200": description: '{"code": 200, "expire": "2019-08-07T12:45:48+08:00", "token": diff --git a/go.mod b/go.mod index c1a17a8d..1457cd02 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/aliyun/aliyun-oss-go-sdk v0.0.0-20190307165228-86c17b95fcd5 github.com/casbin/casbin/v2 v2.25.1 github.com/gin-gonic/gin v1.6.3 - github.com/go-admin-team/go-admin-core v1.3.0-rc.0.0.20210317043714-3dd2b8cbf8cc + github.com/go-admin-team/go-admin-core v1.3.1-0.20210324084642-7c164d76fc11 github.com/google/uuid v1.2.0 github.com/mojocn/base64Captcha v1.3.1 github.com/mssola/user_agent v0.5.2 diff --git a/main.go b/main.go index b6d72c56..e9a81a9c 100644 --- a/main.go +++ b/main.go @@ -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() } diff --git a/template/api_migrate.template b/template/api_migrate.template new file mode 100644 index 00000000..6f391640 --- /dev/null +++ b/template/api_migrate.template @@ -0,0 +1,326 @@ +package version + +import ( + "gorm.io/gorm" + "runtime" + "time" + + "github.com/go-admin-team/go-admin-core/sdk/pkg" + + "go-admin/cmd/migrate/migration" + common "go-admin/common/models" +) + +type Menu struct { + MenuId int `json:"menuId" gorm:"primaryKey;autoIncrement"` + MenuName string `json:"menuName" gorm:"size:128;"` + Title string `json:"title" gorm:"size:128;"` + Icon string `json:"icon" gorm:"size:128;"` + Path string `json:"path" gorm:"size:128;"` + Paths string `json:"paths" gorm:"size:128;"` + MenuType string `json:"menuType" gorm:"size:1;"` + Action string `json:"action" gorm:"size:16;"` + Permission string `json:"permission" gorm:"size:255;"` + ParentId int `json:"parentId" gorm:"size:11;"` + NoCache bool `json:"noCache" gorm:"size:8;"` + Breadcrumb string `json:"breadcrumb" gorm:"size:255;"` + Component string `json:"component" gorm:"size:255;"` + Sort int `json:"sort" gorm:"size:4;"` + Visible string `json:"visible" gorm:"size:1;"` + CreateBy string `json:"createBy" gorm:"size:128;"` + UpdateBy string `json:"updateBy" gorm:"size:128;"` + IsFrame string `json:"isFrame" gorm:"size:1;DEFAULT:0;"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt *time.Time `json:"deletedAt"` +} + +func (Menu) TableName() string { + return "sys_menu" +} + +func init() { + _, fileName, _, _ := runtime.Caller(0) + migration.Migrate.SetVersion(migration.GetFilename(fileName), _{{.GenerateTime}}Test) +} + +func _{{.GenerateTime}}Test(db *gorm.DB, version string) error { + return db.Transaction(func(tx *gorm.DB) error { + + timeNow := pkg.GetCurrentTime() + Mmenu := Menu{} + Mmenu.MenuName = "{{.TBName}}Manage" + Mmenu.Title = "{{.TableComment}}" + Mmenu.Icon = "pass" + Mmenu.Path = "/{{.TBName}}" + Mmenu.MenuType = "M" + Mmenu.Action = "无" + Mmenu.ParentId = 0 + Mmenu.NoCache = false + Mmenu.Component = "Layout" + Mmenu.Sort = 0 + Mmenu.Visible = "0" + Mmenu.IsFrame = "0" + Mmenu.CreateBy = "1" + Mmenu.UpdateBy = "1" + Mmenu.CreatedAt = timeNow + Mmenu.UpdatedAt = timeNow + // Mmenu.MenuId, err = Mmenu.Create(db) + err := tx.Create(&Mmenu).Error + if err != nil { + return err + } + Cmenu := Menu{} + Cmenu.MenuName = "{{.TBName}}" + Cmenu.Title = "{{.TableComment}}" + Cmenu.Icon = "pass" + Cmenu.Path = "{{.TBName}}" + Cmenu.MenuType = "C" + Cmenu.Action = "无" + Cmenu.Permission = "{{.PackageName}}:{{.BusinessName}}:list" + Cmenu.ParentId = Mmenu.MenuId + Cmenu.NoCache = false + Cmenu.Component = "/{{.BusinessName}}/index" + Cmenu.Sort = 0 + Cmenu.Visible = "0" + Cmenu.IsFrame = "0" + Cmenu.CreateBy = "1" + Cmenu.UpdateBy = "1" + Cmenu.CreatedAt = timeNow + Cmenu.UpdatedAt = timeNow + // Cmenu.MenuId, err = Cmenu.Create(db) + err = tx.Create(&Cmenu).Error + if err != nil { + return err + } + + MList := Menu{} + MList.MenuName = "" + MList.Title = "分页获取{{.TableComment}}" + MList.Icon = "" + MList.Path = "{{.TBName}}" + MList.MenuType = "F" + MList.Action = "无" + MList.Permission = "{{.PackageName}}:{{.BusinessName}}:query" + MList.ParentId = Cmenu.MenuId + MList.NoCache = false + MList.Sort = 0 + MList.Visible = "0" + MList.IsFrame = "0" + MList.CreateBy = "1" + MList.UpdateBy = "1" + MList.CreatedAt = timeNow + MList.UpdatedAt = timeNow + // MList.MenuId, err = MList.Create(db) + err = tx.Create(&MList).Error + if err != nil { + return err + } + + MCreate := Menu{} + MCreate.MenuName = "" + MCreate.Title = "创建{{.TableComment}}" + MCreate.Icon = "" + MCreate.Path = "{{.TBName}}" + MCreate.MenuType = "F" + MCreate.Action = "无" + MCreate.Permission = "{{.PackageName}}:{{.BusinessName}}:add" + MCreate.ParentId = Cmenu.MenuId + MCreate.NoCache = false + MCreate.Sort = 0 + MCreate.Visible = "0" + MCreate.IsFrame = "0" + MCreate.CreateBy = "1" + MCreate.UpdateBy = "1" + MCreate.CreatedAt = timeNow + MCreate.UpdatedAt = timeNow + // MCreate.MenuId, err = MCreate.Create(db) + err = tx.Create(&MCreate).Error + if err != nil { + return err + } + + MUpdate := Menu{} + MUpdate.MenuName = "" + MUpdate.Title = "修改{{.TableComment}}" + MUpdate.Icon = "" + MUpdate.Path = "{{.TBName}}" + MUpdate.MenuType = "F" + MUpdate.Action = "无" + MUpdate.Permission ="{{.PackageName}}:{{.BusinessName}}:edit" + MUpdate.ParentId = Cmenu.MenuId + MUpdate.NoCache = false + MUpdate.Sort = 0 + MUpdate.Visible = "0" + MUpdate.IsFrame = "0" + MUpdate.CreateBy = "1" + MUpdate.UpdateBy = "1" + MUpdate.CreatedAt = timeNow + MUpdate.UpdatedAt = timeNow + // MUpdate.MenuId, err = MUpdate.Create(db) + err = tx.Create(&MUpdate).Error + if err != nil { + return err + } + + MDelete := Menu{} + MDelete.MenuName = "" + MDelete.Title = "删除{{.TableComment}}" + MDelete.Icon = "" + MDelete.Path = "{{.TBName}}" + MDelete.MenuType = "F" + MDelete.Action = "无" + MDelete.Permission = "{{.PackageName}}:{{.BusinessName}}:remove" + MDelete.ParentId = Cmenu.MenuId + MDelete.NoCache = false + MDelete.Sort = 0 + MDelete.Visible = "0" + MDelete.IsFrame = "0" + MDelete.CreateBy = "1" + MDelete.UpdateBy = "1" + MDelete.CreatedAt = timeNow + MDelete.UpdatedAt = timeNow + // MDelete.MenuId, err = MDelete.Create(db) + err = tx.Create(&MDelete).Error + if err != nil { + return err + } + + var InterfaceId = 63 + Amenu := Menu{} + Amenu.MenuName = "{{.TBName}}" + Amenu.Title = "{{.TableComment}}" + Amenu.Icon = "bug" + Amenu.Path = "{{.TBName}}" + Amenu.MenuType = "M" + Amenu.Action = "无" + Amenu.ParentId = InterfaceId + Amenu.NoCache = false + Amenu.Sort = 0 + Amenu.Visible = "1" + Amenu.IsFrame = "0" + Amenu.CreateBy = "1" + Amenu.UpdateBy = "1" + Amenu.CreatedAt = timeNow + Amenu.UpdatedAt = timeNow + // Amenu.MenuId, err = Amenu.Create(db) + err = tx.Create(&Amenu).Error + if err != nil { + return err + } + + AList := Menu{} + AList.MenuName = "" + AList.Title = "分页获取{{.TableComment}}" + AList.Icon = "bug" + AList.Path = "/api/v1/{{.ModuleName}}" + AList.MenuType = "A" + AList.Action = "GET" + AList.ParentId = Amenu.MenuId + AList.NoCache = false + AList.Sort = 0 + AList.Visible = "1" + AList.IsFrame = "0" + AList.CreateBy = "1" + AList.UpdateBy = "1" + AList.CreatedAt = timeNow + AList.UpdatedAt = timeNow + // AList.MenuId, err = AList.Create(db) + err = tx.Create(&AList).Error + if err != nil { + return err + } + + AGet := Menu{} + AGet.MenuName = "" + AGet.Title = "根据id获取{{.TableComment}}" + AGet.Icon = "bug" + AGet.Path = "/api/v1/{{.ModuleName}}/:id" + AGet.MenuType = "A" + AGet.Action = "GET" + AGet.ParentId = Amenu.MenuId + AGet.NoCache = false + AGet.Sort = 0 + AGet.Visible = "1" + AGet.IsFrame = "0" + AGet.CreateBy = "1" + AGet.UpdateBy = "1" + AGet.CreatedAt = timeNow + AGet.UpdatedAt = timeNow + // AGet.MenuId, err = AGet.Create(db) + err = tx.Create(&AGet).Error + if err != nil { + return err + } + + ACreate := Menu{} + ACreate.MenuName = "" + ACreate.Title = "创建{{.TableComment}}" + ACreate.Icon = "bug" + ACreate.Path = "/api/v1/{{.ModuleName}}" + ACreate.MenuType = "A" + ACreate.Action = "POST" + ACreate.ParentId = Amenu.MenuId + ACreate.NoCache = false + ACreate.Sort = 0 + ACreate.Visible = "1" + ACreate.IsFrame = "0" + ACreate.CreateBy = "1" + ACreate.UpdateBy = "1" + ACreate.CreatedAt = timeNow + ACreate.UpdatedAt = timeNow + // ACreate.MenuId, err = ACreate.Create(db) + err = tx.Create(&ACreate).Error + if err != nil { + return err + } + + AUpdate := Menu{} + AUpdate.MenuName = "" + AUpdate.Title = "修改{{.TableComment}}" + AUpdate.Icon = "bug" + AUpdate.Path = "/api/v1/{{.ModuleName}}/:id" + AUpdate.MenuType = "A" + AUpdate.Action = "PUT" + AUpdate.ParentId = Amenu.MenuId + AUpdate.NoCache = false + AUpdate.Sort = 0 + AUpdate.Visible = "1" + AUpdate.IsFrame = "0" + AUpdate.CreateBy = "1" + AUpdate.UpdateBy = "1" + AUpdate.CreatedAt = timeNow + AUpdate.UpdatedAt = timeNow + // AUpdate.MenuId, err = AUpdate.Create(db) + err = tx.Create(&AUpdate).Error + if err != nil { + return err + } + + ADelete := Menu{} + ADelete.MenuName = "" + ADelete.Title = "删除{{.TableComment}}" + ADelete.Icon = "bug" + ADelete.Path = "/api/v1/{{.ModuleName}}" + ADelete.MenuType = "A" + ADelete.Action = "DELETE" + ADelete.ParentId = Amenu.MenuId + ADelete.NoCache = false + ADelete.Sort = 0 + ADelete.Visible = "1" + ADelete.IsFrame = "0" + ADelete.CreateBy = "1" + ADelete.UpdateBy = "1" + ADelete.CreatedAt = timeNow + ADelete.UpdatedAt = timeNow + //ADelete.MenuId, err = ADelete.Create(db) + err = tx.Create(&ADelete).Error + if err != nil { + return err + } + + return tx.Create(&common.Migration{ + Version: version, + }).Error + }) +} \ No newline at end of file diff --git a/template/v4/no_actions/apis.go.template b/template/v4/no_actions/apis.go.template index 25cfe0bb..ae09942d 100644 --- a/template/v4/no_actions/apis.go.template +++ b/template/v4/no_actions/apis.go.template @@ -5,10 +5,11 @@ 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" - "go-admin/app/admin/service/dto" + "go-admin/app/{{.PackageName}}/models" + "go-admin/app/{{.PackageName}}/service" + "go-admin/app/{{.PackageName}}/service/dto" "go-admin/common/actions" "go-admin/common/apis" ) @@ -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) @@ -214,11 +209,9 @@ func (e *{{.ClassName}}) Update{{.ClassName}}(c *gin.Context) { // @Summary 删除{{.TableComment}} // @Description 删除{{.TableComment}} // @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] +// @Param ids body []int false "ids" +// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}" +// @Router /api/v1/{{.ModuleName}} [delete] // Delete{{.ClassName}} 删除{{.TableComment}} func (e *{{.ClassName}}) Delete{{.ClassName}}(c *gin.Context) { log := e.GetLogger(c) diff --git a/template/v4/no_actions/router_check_role.go.template b/template/v4/no_actions/router_check_role.go.template index 1ffd2663..d8066c17 100644 --- a/template/v4/no_actions/router_check_role.go.template +++ b/template/v4/no_actions/router_check_role.go.template @@ -4,7 +4,7 @@ import ( "github.com/gin-gonic/gin" jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" - "go-admin/app/admin/apis/{{.ModuleName}}" + "go-admin/app/{{.PackageName}}/apis/{{.ModuleName}}" "go-admin/common/middleware" ) @@ -23,4 +23,4 @@ func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJW r.PUT("/:id", api.Update{{.ClassName}}) r.DELETE("", api.Delete{{.ClassName}}) } -} \ No newline at end of file +} diff --git a/template/v4/no_actions/router_no_check_role.go.template b/template/v4/no_actions/router_no_check_role.go.template index 20e02ec4..46f09aa8 100644 --- a/template/v4/no_actions/router_no_check_role.go.template +++ b/template/v4/no_actions/router_no_check_role.go.template @@ -4,7 +4,7 @@ import ( "github.com/gin-gonic/gin" jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" - "go-admin/app/admin/apis/{{.ModuleName}}" + "go-admin/app/{{.PackageName}}/apis/{{.ModuleName}}" ) func init() { @@ -22,4 +22,4 @@ func register{{.ClassName}}Router(v1 *gin.RouterGroup, authMiddleware *jwt.GinJW r.PUT("/:id", api.Update{{.ClassName}}) r.DELETE("", api.Delete{{.ClassName}}) } -} \ No newline at end of file +} diff --git a/template/v4/no_actions/service.go.template b/template/v4/no_actions/service.go.template index 7ed5ca8e..943a3ea7 100644 --- a/template/v4/no_actions/service.go.template +++ b/template/v4/no_actions/service.go.template @@ -5,10 +5,10 @@ import ( "gorm.io/gorm" - "go-admin/app/admin/models" + "go-admin/app/{{.PackageName}}/models" "go-admin/common/actions" cDto "go-admin/common/dto" - "go-admin/app/admin/service/dto" + "go-admin/app/{{.PackageName}}/service/dto" "go-admin/common/service" )