Code generation module
This commit is contained in:
1 parent
e149589990
commit
65dbf587f9
13 files changed
+497
-62
No files matched your search
@@ -4,3 +4,4 @@ main.exe
|
|||||||
temp/logs/log.txt
|
temp/logs/log.txt
|
||||||
vendor
|
vendor
|
||||||
config/settings.dev.yml
|
config/settings.dev.yml
|
||||||
|
temp/logs/log.txt
|
||||||
+10
-10
@@ -10,12 +10,12 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Summary 配置列表数据
|
// @Summary 角色列表数据
|
||||||
// @Description 获取JSON
|
// @Description Get JSON
|
||||||
// @Tags 配置
|
// @Tags 角色/Role
|
||||||
// @Param configKey query string false "configKey"
|
// @Param roleName query string false "roleName"
|
||||||
// @Param configName query string false "configName"
|
// @Param status query string false "status"
|
||||||
// @Param configType query string false "configType"
|
// @Param roleKey query string false "roleKey"
|
||||||
// @Param pageSize query int false "页条数"
|
// @Param pageSize query int false "页条数"
|
||||||
// @Param pageIndex query int false "页码"
|
// @Param pageIndex query int false "页码"
|
||||||
// @Success 200 {object} models.Response "{"code": 200, "data": [...]}"
|
// @Success 200 {object} models.Response "{"code": 200, "data": [...]}"
|
||||||
@@ -56,7 +56,7 @@ func GetRoleList(c *gin.Context) {
|
|||||||
|
|
||||||
// @Summary 获取Role数据
|
// @Summary 获取Role数据
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 角色
|
// @Tags 角色/Role
|
||||||
// @Param roleId path string false "roleId"
|
// @Param roleId path string false "roleId"
|
||||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||||
@@ -87,7 +87,7 @@ func GetRole(c *gin.Context) {
|
|||||||
|
|
||||||
// @Summary 创建角色
|
// @Summary 创建角色
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 角色
|
// @Tags 角色/Role
|
||||||
// @Accept application/json
|
// @Accept application/json
|
||||||
// @Product application/json
|
// @Product application/json
|
||||||
// @Param data body models.Config true "data"
|
// @Param data body models.Config true "data"
|
||||||
@@ -113,7 +113,7 @@ func InsertRole(c *gin.Context) {
|
|||||||
|
|
||||||
// @Summary 修改用户角色
|
// @Summary 修改用户角色
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 角色
|
// @Tags 角色/Role
|
||||||
// @Accept application/json
|
// @Accept application/json
|
||||||
// @Product application/json
|
// @Product application/json
|
||||||
// @Param data body models.SysRole true "body"
|
// @Param data body models.SysRole true "body"
|
||||||
@@ -162,7 +162,7 @@ func UpdateRoleDataScope(c *gin.Context) {
|
|||||||
|
|
||||||
// @Summary 删除用户角色
|
// @Summary 删除用户角色
|
||||||
// @Description 删除数据
|
// @Description 删除数据
|
||||||
// @Tags 角色
|
// @Tags 角色/Role
|
||||||
// @Param roleId path int true "roleId"
|
// @Param roleId path int true "roleId"
|
||||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"go-admin/models"
|
||||||
|
"go-admin/models/tools"
|
||||||
|
"go-admin/pkg"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// @Summary 分页列表数据 / page list data
|
||||||
|
// @Description 数据库表列分页列表 / database table column page list
|
||||||
|
// @Tags 工具 / Tools
|
||||||
|
// @Param tableName query string false "tableName / 数据表名称"
|
||||||
|
// @Param pageSize query int false "pageSize / 页条数"
|
||||||
|
// @Param pageIndex query int false "pageIndex / 页码"
|
||||||
|
// @Success 200 {object} models.Response "{"code": 200, "data": [...]}"
|
||||||
|
// @Router /api/v1/db/columns/page [get]
|
||||||
|
func GetDBColumnList(c *gin.Context) {
|
||||||
|
var data tools.DBColumns
|
||||||
|
var err error
|
||||||
|
var pageSize = 10
|
||||||
|
var pageIndex = 1
|
||||||
|
|
||||||
|
if size := c.Request.FormValue("pageSize"); size != "" {
|
||||||
|
pageSize = pkg.StrToInt(err, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
if index := c.Request.FormValue("pageIndex"); index != "" {
|
||||||
|
pageIndex = pkg.StrToInt(err, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
data.TableName = c.Request.FormValue("tableName")
|
||||||
|
pkg.Assert(data.TableName=="","table name cannot be empty!",500)
|
||||||
|
result, count, err := data.GetPage(pageSize, pageIndex)
|
||||||
|
pkg.AssertErr(err, "", -1)
|
||||||
|
|
||||||
|
var mp = make(map[string]interface{}, 3)
|
||||||
|
mp["list"] = result
|
||||||
|
mp["count"] = count
|
||||||
|
mp["pageIndex"] = pageIndex
|
||||||
|
mp["pageIndex"] = pageSize
|
||||||
|
|
||||||
|
var res models.Response
|
||||||
|
res.Data = mp
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, res.ReturnOK())
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"go-admin/models"
|
||||||
|
"go-admin/models/tools"
|
||||||
|
"go-admin/pkg"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// @Summary 分页列表数据 / page list data
|
||||||
|
// @Description 数据库表分页列表 / database table page list
|
||||||
|
// @Tags 工具 / Tools
|
||||||
|
// @Param tableName query string false "tableName / 数据表名称"
|
||||||
|
// @Param pageSize query int false "pageSize / 页条数"
|
||||||
|
// @Param pageIndex query int false "pageIndex / 页码"
|
||||||
|
// @Success 200 {object} models.Response "{"code": 200, "data": [...]}"
|
||||||
|
// @Router /api/v1/db/tables/page [get]
|
||||||
|
func GetDBTableList(c *gin.Context) {
|
||||||
|
var data tools.DBTables
|
||||||
|
var err error
|
||||||
|
var pageSize = 10
|
||||||
|
var pageIndex = 1
|
||||||
|
|
||||||
|
if size := c.Request.FormValue("pageSize"); size != "" {
|
||||||
|
pageSize = pkg.StrToInt(err, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
if index := c.Request.FormValue("pageIndex"); index != "" {
|
||||||
|
pageIndex = pkg.StrToInt(err, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
data.TableName = c.Request.FormValue("tableName")
|
||||||
|
result, count, err := data.GetPage(pageSize, pageIndex)
|
||||||
|
pkg.AssertErr(err, "", -1)
|
||||||
|
|
||||||
|
var mp = make(map[string]interface{}, 3)
|
||||||
|
mp["list"] = result
|
||||||
|
mp["count"] = count
|
||||||
|
mp["pageIndex"] = pageIndex
|
||||||
|
mp["pageIndex"] = pageSize
|
||||||
|
|
||||||
|
var res models.Response
|
||||||
|
res.Data = mp
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, res.ReturnOK())
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"go-admin/models"
|
||||||
|
"go-admin/models/tools"
|
||||||
|
"go-admin/pkg"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// @Summary 分页列表数据 / page list data
|
||||||
|
// @Description 生成表分页列表 / gen table page list
|
||||||
|
// @Tags 工具 - Tools / 生成表 - Gen Table
|
||||||
|
// @Param tableName query string false "tableName / 数据表名称"
|
||||||
|
// @Param pageSize query int false "pageSize / 页条数"
|
||||||
|
// @Param pageIndex query int false "pageIndex / 页码"
|
||||||
|
// @Success 200 {object} models.Response "{"code": 200, "data": [...]}"
|
||||||
|
// @Router /api/v1/sys/tables/page [get]
|
||||||
|
func GetSysTableList(c *gin.Context) {
|
||||||
|
var data tools.SysTables
|
||||||
|
var err error
|
||||||
|
var pageSize = 10
|
||||||
|
var pageIndex = 1
|
||||||
|
|
||||||
|
if size := c.Request.FormValue("pageSize"); size != "" {
|
||||||
|
pageSize = pkg.StrToInt(err, size)
|
||||||
|
}
|
||||||
|
|
||||||
|
if index := c.Request.FormValue("pageIndex"); index != "" {
|
||||||
|
pageIndex = pkg.StrToInt(err, index)
|
||||||
|
}
|
||||||
|
|
||||||
|
data.TableName = c.Request.FormValue("tableName")
|
||||||
|
result, count, err := data.GetPage(pageSize, pageIndex)
|
||||||
|
pkg.AssertErr(err, "", -1)
|
||||||
|
|
||||||
|
var mp = make(map[string]interface{}, 3)
|
||||||
|
mp["list"] = result
|
||||||
|
mp["count"] = count
|
||||||
|
mp["pageIndex"] = pageIndex
|
||||||
|
mp["pageIndex"] = pageSize
|
||||||
|
|
||||||
|
var res models.Response
|
||||||
|
res.Data = mp
|
||||||
|
|
||||||
|
c.JSON(http.StatusOK, res.ReturnOK())
|
||||||
|
}
|
||||||
+55
-18
@@ -1,6 +1,6 @@
|
|||||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
// This file was generated by swaggo/swag at
|
// This file was generated by swaggo/swag at
|
||||||
// 2020-03-17 14:25:08.714368 +0800 CST m=+0.081722206
|
// 2020-03-19 00:24:21.426215 +0800 CST m=+0.087420189
|
||||||
|
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
@@ -436,9 +436,9 @@ var doc = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"字典数据"
|
"配置"
|
||||||
],
|
],
|
||||||
"summary": "添加字典数据",
|
"summary": "添加配置",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "data",
|
"description": "data",
|
||||||
@@ -447,7 +447,7 @@ var doc = `{
|
|||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"$ref": "#/definitions/models.DictType"
|
"$ref": "#/definitions/models.Config"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1570,7 +1570,7 @@ var doc = `{
|
|||||||
],
|
],
|
||||||
"description": "获取JSON",
|
"description": "获取JSON",
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "获取Role数据",
|
"summary": "获取Role数据",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1596,7 +1596,7 @@ var doc = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "修改用户角色",
|
"summary": "修改用户角色",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1626,7 +1626,7 @@ var doc = `{
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "创建角色",
|
"summary": "创建角色",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1655,7 +1655,7 @@ var doc = `{
|
|||||||
"delete": {
|
"delete": {
|
||||||
"description": "删除数据",
|
"description": "删除数据",
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "删除用户角色",
|
"summary": "删除用户角色",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1684,28 +1684,28 @@ var doc = `{
|
|||||||
"": []
|
"": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取JSON",
|
"description": "Get JSON",
|
||||||
"tags": [
|
"tags": [
|
||||||
"配置"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "配置列表数据",
|
"summary": "角色列表数据",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "configKey",
|
"description": "roleName",
|
||||||
"name": "configKey",
|
"name": "roleName",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "configName",
|
"description": "status",
|
||||||
"name": "configName",
|
"name": "status",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "configType",
|
"description": "roleKey",
|
||||||
"name": "configType",
|
"name": "roleKey",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1996,6 +1996,43 @@ var doc = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/v1/tables/page": {
|
||||||
|
"get": {
|
||||||
|
"description": "数据库表分页列表 / database table page list",
|
||||||
|
"tags": [
|
||||||
|
"工具 / Tools"
|
||||||
|
],
|
||||||
|
"summary": "分页列表数据 / page list data",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "tableName / 数据表名称",
|
||||||
|
"name": "tableName",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "pageSize / 页条数",
|
||||||
|
"name": "pageSize",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "pageIndex / 页码",
|
||||||
|
"name": "pageIndex",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "{\"code\": 200, \"data\": [...]}",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/v1/user/profile": {
|
"/api/v1/user/profile": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
@@ -2955,7 +2992,7 @@ var SwaggerInfo = swaggerInfo{
|
|||||||
BasePath: "",
|
BasePath: "",
|
||||||
Schemes: []string{},
|
Schemes: []string{},
|
||||||
Title: "go-admin API",
|
Title: "go-admin API",
|
||||||
Description: "基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档\n添加微信号: zwj891129 进入技术交流微信群 请备注,谢谢!",
|
Description: "基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档\n添加qq群: 74520518 进入技术交流群 请备注,谢谢!",
|
||||||
}
|
}
|
||||||
|
|
||||||
type s struct{}
|
type s struct{}
|
||||||
|
|||||||
+54
-17
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"description": "基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档\n添加微信号: zwj891129 进入技术交流微信群 请备注,谢谢!",
|
"description": "基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档\n添加qq群: 74520518 进入技术交流群 请备注,谢谢!",
|
||||||
"title": "go-admin API",
|
"title": "go-admin API",
|
||||||
"contact": {},
|
"contact": {},
|
||||||
"license": {
|
"license": {
|
||||||
@@ -418,9 +418,9 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"字典数据"
|
"配置"
|
||||||
],
|
],
|
||||||
"summary": "添加字典数据",
|
"summary": "添加配置",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"description": "data",
|
"description": "data",
|
||||||
@@ -429,7 +429,7 @@
|
|||||||
"required": true,
|
"required": true,
|
||||||
"schema": {
|
"schema": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"$ref": "#/definitions/models.DictType"
|
"$ref": "#/definitions/models.Config"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -1552,7 +1552,7 @@
|
|||||||
],
|
],
|
||||||
"description": "获取JSON",
|
"description": "获取JSON",
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "获取Role数据",
|
"summary": "获取Role数据",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1578,7 +1578,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "修改用户角色",
|
"summary": "修改用户角色",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1608,7 +1608,7 @@
|
|||||||
"application/json"
|
"application/json"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "创建角色",
|
"summary": "创建角色",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1637,7 +1637,7 @@
|
|||||||
"delete": {
|
"delete": {
|
||||||
"description": "删除数据",
|
"description": "删除数据",
|
||||||
"tags": [
|
"tags": [
|
||||||
"角色"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "删除用户角色",
|
"summary": "删除用户角色",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
@@ -1666,28 +1666,28 @@
|
|||||||
"": []
|
"": []
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "获取JSON",
|
"description": "Get JSON",
|
||||||
"tags": [
|
"tags": [
|
||||||
"配置"
|
"角色/Role"
|
||||||
],
|
],
|
||||||
"summary": "配置列表数据",
|
"summary": "角色列表数据",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "configKey",
|
"description": "roleName",
|
||||||
"name": "configKey",
|
"name": "roleName",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "configName",
|
"description": "status",
|
||||||
"name": "configName",
|
"name": "status",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "configType",
|
"description": "roleKey",
|
||||||
"name": "configType",
|
"name": "roleKey",
|
||||||
"in": "query"
|
"in": "query"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -1978,6 +1978,43 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/api/v1/tables/page": {
|
||||||
|
"get": {
|
||||||
|
"description": "数据库表分页列表 / database table page list",
|
||||||
|
"tags": [
|
||||||
|
"工具 / Tools"
|
||||||
|
],
|
||||||
|
"summary": "分页列表数据 / page list data",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "tableName / 数据表名称",
|
||||||
|
"name": "tableName",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "pageSize / 页条数",
|
||||||
|
"name": "pageSize",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "pageIndex / 页码",
|
||||||
|
"name": "pageIndex",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "{\"code\": 200, \"data\": [...]}",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Response"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/api/v1/user/profile": {
|
"/api/v1/user/profile": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
|
|||||||
+41
-17
@@ -488,7 +488,7 @@ info:
|
|||||||
contact: {}
|
contact: {}
|
||||||
description: |-
|
description: |-
|
||||||
基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档
|
基于Gin + Vue + Element UI的前后端分离权限管理系统的接口文档
|
||||||
添加微信号: zwj891129 进入技术交流微信群 请备注,谢谢!
|
添加qq群: 74520518 进入技术交流群 请备注,谢谢!
|
||||||
license:
|
license:
|
||||||
name: MIT
|
name: MIT
|
||||||
url: https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md
|
url: https://github.com/wenjianzhang/go-admin/blob/master/LICENSE.md
|
||||||
@@ -732,7 +732,7 @@ paths:
|
|||||||
name: data
|
name: data
|
||||||
required: true
|
required: true
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/models.DictType'
|
$ref: '#/definitions/models.Config'
|
||||||
type: object
|
type: object
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
@@ -741,9 +741,9 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- Bearer: []
|
- Bearer: []
|
||||||
summary: 添加字典数据
|
summary: 添加配置
|
||||||
tags:
|
tags:
|
||||||
- 字典数据
|
- 配置
|
||||||
put:
|
put:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -1475,7 +1475,7 @@ paths:
|
|||||||
- Bearer: []
|
- Bearer: []
|
||||||
summary: 获取Role数据
|
summary: 获取Role数据
|
||||||
tags:
|
tags:
|
||||||
- 角色
|
- 角色/Role
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -1495,7 +1495,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 创建角色
|
summary: 创建角色
|
||||||
tags:
|
tags:
|
||||||
- 角色
|
- 角色/Role
|
||||||
put:
|
put:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
@@ -1515,7 +1515,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 修改用户角色
|
summary: 修改用户角色
|
||||||
tags:
|
tags:
|
||||||
- 角色
|
- 角色/Role
|
||||||
/api/v1/role/{roleId}:
|
/api/v1/role/{roleId}:
|
||||||
delete:
|
delete:
|
||||||
description: 删除数据
|
description: 删除数据
|
||||||
@@ -1532,22 +1532,22 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
summary: 删除用户角色
|
summary: 删除用户角色
|
||||||
tags:
|
tags:
|
||||||
- 角色
|
- 角色/Role
|
||||||
/api/v1/rolelist:
|
/api/v1/rolelist:
|
||||||
get:
|
get:
|
||||||
description: 获取JSON
|
description: Get JSON
|
||||||
parameters:
|
parameters:
|
||||||
- description: configKey
|
- description: roleName
|
||||||
in: query
|
in: query
|
||||||
name: configKey
|
name: roleName
|
||||||
type: string
|
type: string
|
||||||
- description: configName
|
- description: status
|
||||||
in: query
|
in: query
|
||||||
name: configName
|
name: status
|
||||||
type: string
|
type: string
|
||||||
- description: configType
|
- description: roleKey
|
||||||
in: query
|
in: query
|
||||||
name: configType
|
name: roleKey
|
||||||
type: string
|
type: string
|
||||||
- description: 页条数
|
- description: 页条数
|
||||||
in: query
|
in: query
|
||||||
@@ -1564,9 +1564,9 @@ paths:
|
|||||||
$ref: '#/definitions/models.Response'
|
$ref: '#/definitions/models.Response'
|
||||||
security:
|
security:
|
||||||
- "": []
|
- "": []
|
||||||
summary: 配置列表数据
|
summary: 角色列表数据
|
||||||
tags:
|
tags:
|
||||||
- 配置
|
- 角色/Role
|
||||||
/api/v1/rolemenu:
|
/api/v1/rolemenu:
|
||||||
get:
|
get:
|
||||||
description: 获取JSON
|
description: 获取JSON
|
||||||
@@ -1736,6 +1736,30 @@ paths:
|
|||||||
summary: 修改用户数据
|
summary: 修改用户数据
|
||||||
tags:
|
tags:
|
||||||
- 用户
|
- 用户
|
||||||
|
/api/v1/tables/page:
|
||||||
|
get:
|
||||||
|
description: 数据库表分页列表 / database table page list
|
||||||
|
parameters:
|
||||||
|
- description: tableName / 数据表名称
|
||||||
|
in: query
|
||||||
|
name: tableName
|
||||||
|
type: string
|
||||||
|
- description: pageSize / 页条数
|
||||||
|
in: query
|
||||||
|
name: pageSize
|
||||||
|
type: integer
|
||||||
|
- description: pageIndex / 页码
|
||||||
|
in: query
|
||||||
|
name: pageIndex
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: '{"code": 200, "data": [...]}'
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.Response'
|
||||||
|
summary: 分页列表数据 / page list data
|
||||||
|
tags:
|
||||||
|
- 工具 / Tools
|
||||||
/api/v1/user/profile:
|
/api/v1/user/profile:
|
||||||
get:
|
get:
|
||||||
description: 获取JSON
|
description: 获取JSON
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
orm "go-admin/database"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBColumns struct {
|
||||||
|
//select COLUMN_NAME,COLUMN_DEFAULT,IS_NULLABLE,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_SET_NAME,COLUMN_TYPE,COLUMN_KEY,EXTRA,COLUMN_COMMENT
|
||||||
|
//from information_schema.`COLUMNS` where table_schema='test1db' and TABLE_NAME='sys_config'
|
||||||
|
|
||||||
|
TableSchema string `gorm:"column:TABLE_SCHEMA" json:"tableSchema"`
|
||||||
|
TableName string `gorm:"column:TABLE_NAME" json:"tableName"`
|
||||||
|
Engine string `gorm:"column:COLUMN_NAME" json:"engine"`
|
||||||
|
TableRows string `gorm:"column:COLUMN_DEFAULT" json:"tableRows"`
|
||||||
|
TableCollation string `gorm:"column:IS_NULLABLE" json:"tableCollation"`
|
||||||
|
CreateTime string `gorm:"column:DATA_TYPE" json:"createTime"`
|
||||||
|
UpdateTime string `gorm:"column:CHARACTER_MAXIMUM_LENGTH" json:"updateTime"`
|
||||||
|
TableComment string `gorm:"column:CHARACTER_SET_NAME" json:"tableComment"`
|
||||||
|
ColumnType string `gorm:"column:COLUMN_TYPE" json:"columnType"`
|
||||||
|
ColumnKey string `gorm:"column:COLUMN_KEY" json:"columnKey"`
|
||||||
|
Extra string `gorm:"column:EXTRA" json:"extra"`
|
||||||
|
ColumnComment string `gorm:"column:COLUMN_COMMENT" json:"columnComment"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *DBColumns) GetPage(pageSize int, pageIndex int) ([]DBColumns, int32, error) {
|
||||||
|
var doc []DBColumns
|
||||||
|
|
||||||
|
table := orm.Eloquent.Select("*").Table("information_schema.`COLUMNS`")
|
||||||
|
table=table.Where("table_schema='test1db'")
|
||||||
|
|
||||||
|
if e.TableName != "" {
|
||||||
|
return nil,0,errors.New("table name cannot be empty!")
|
||||||
|
}
|
||||||
|
|
||||||
|
table = table.Where("TABLE_NAME = ?", e.TableName)
|
||||||
|
|
||||||
|
var count int32
|
||||||
|
|
||||||
|
if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
table.Count(&count)
|
||||||
|
return doc, count, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import (
|
||||||
|
orm "go-admin/database"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBTables struct {
|
||||||
|
TableName string `gorm:"column:TABLE_NAME" json:"tableName"`
|
||||||
|
Engine string `gorm:"column:ENGINE" json:"engine"`
|
||||||
|
TableRows string `gorm:"column:TABLE_ROWS" json:"tableRows"`
|
||||||
|
TableCollation string `gorm:"column:TABLE_COLLATION" json:"tableCollation"`
|
||||||
|
CreateTime string `gorm:"column:CREATE_TIME" json:"createTime"`
|
||||||
|
UpdateTime string `gorm:"column:UPDATE_TIME" json:"updateTime"`
|
||||||
|
TableComment string `gorm:"column:TABLE_COMMENT" json:"tableComment"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *DBTables) GetPage(pageSize int, pageIndex int) ([]DBTables, int32, error) {
|
||||||
|
var doc []DBTables
|
||||||
|
|
||||||
|
table := orm.Eloquent.Select("*").Table("information_schema.tables")
|
||||||
|
table=table.Where("table_schema='test1db'")
|
||||||
|
|
||||||
|
if e.TableName != "" {
|
||||||
|
table = table.Where("TABLE_NAME = ?", e.TableName)
|
||||||
|
}
|
||||||
|
|
||||||
|
var count int32
|
||||||
|
|
||||||
|
if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
table.Count(&count)
|
||||||
|
return doc, count, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import orm "go-admin/database"
|
||||||
|
|
||||||
|
type SysColumns struct {
|
||||||
|
ColumnId int64 `gorm:"column:configId;primary_key" json:"configId"`
|
||||||
|
TableId int64 `gorm:"column:configId" json:"configId"`
|
||||||
|
ColumnName string `gorm:"column:configId" json:"configId"`
|
||||||
|
ColumnComment string `gorm:"column:column_comment" json:"columnComment"`
|
||||||
|
ColumnType string `gorm:"column:column_type" json:"columnType"`
|
||||||
|
GoType string `gorm:"column:go_type" json:"goType"`
|
||||||
|
GoField string `gorm:"column:go_field" json:"goField"`
|
||||||
|
IsPk string `gorm:"column:is_pk" json:"isPk"`
|
||||||
|
IsIncrement string `gorm:"column:is_increment" json:"isIncrement"`
|
||||||
|
IsRequired string `gorm:"column:is_required" json:"isRequired"`
|
||||||
|
IsInsert string `gorm:"column:is_insert" json:"isInsert"`
|
||||||
|
IsEdit string `gorm:"column:is_edit" json:"isEdit"`
|
||||||
|
IsList string `gorm:"column:is_list" json:"isList"`
|
||||||
|
IsQuery string `gorm:"column:is_query" json:"isQuery"`
|
||||||
|
QueryType string `gorm:"column:query_type" json:"queryType"`
|
||||||
|
HtmlType string `gorm:"column:html_type" json:"htmlType"`
|
||||||
|
DictType string `gorm:"column:dict_type" json:"dictType"`
|
||||||
|
Sort string `gorm:"column:sort" json:"sort"`
|
||||||
|
List string `gorm:"column:list" json:"list"`
|
||||||
|
Pk bool `gorm:"column:pk" json:"pk"`
|
||||||
|
Required bool `gorm:"column:required" json:"required"`
|
||||||
|
SuperColumn bool `gorm:"column:super_column" json:"superColumn"`
|
||||||
|
UsableColumn bool `gorm:"column:usable_column" json:"usableColumn"`
|
||||||
|
Increment bool `gorm:"column:increment" json:"increment"`
|
||||||
|
Insert bool `gorm:"column:insert" json:"insert"`
|
||||||
|
Edit bool `gorm:"column:edit" json:"edit"`
|
||||||
|
Query bool `gorm:"column:query" json:"query"`
|
||||||
|
Remark string `gorm:"column:remark" json:"remark"`
|
||||||
|
CreateBy string `gorm:"column:create_by" json:"createBy"`
|
||||||
|
CreateTime string `gorm:"column:create_time" json:"createTime"`
|
||||||
|
UpdateBy string `gorm:"column:update_By" json:"updateBy"`
|
||||||
|
UpdateTime string `gorm:"column:update_time" json:"updateTime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *SysColumns) GetList() ([]SysColumns, error) {
|
||||||
|
var doc []SysColumns
|
||||||
|
|
||||||
|
table := orm.Eloquent.Select("*").Table("sys_columns")
|
||||||
|
|
||||||
|
table = table.Where("table_id = ?", e.TableId)
|
||||||
|
|
||||||
|
|
||||||
|
if err := table.Find(&doc).Error; err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return doc, nil
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package tools
|
||||||
|
|
||||||
|
import orm "go-admin/database"
|
||||||
|
|
||||||
|
type SysTables struct {
|
||||||
|
//表编码
|
||||||
|
TableId string `gorm:"column:table_id" json:"tableName"`
|
||||||
|
//表名称
|
||||||
|
TableName string `gorm:"column:table_name" json:"tableName"`
|
||||||
|
//表备注
|
||||||
|
TableComment string `gorm:"column:table_comment" json:"tableComment"`
|
||||||
|
//类名
|
||||||
|
ClassName string `gorm:"column:class_name" json:"className"`
|
||||||
|
|
||||||
|
TplCategory string `gorm:"column:tpl_category" json:"tplCategory"`
|
||||||
|
//包名
|
||||||
|
PackageName string `gorm:"column:package_name" json:"packageName"`
|
||||||
|
//模块名
|
||||||
|
ModuleName string `gorm:"column:module_name" json:"moduleName"`
|
||||||
|
BusinessName string `gorm:"column:business_name" json:"businessName"`
|
||||||
|
//功能名称
|
||||||
|
FunctionName string `gorm:"column:function_name" json:"functionName"`
|
||||||
|
//功能作者
|
||||||
|
FunctionAuthor string `gorm:"column:function_author" json:"functionAuthor"`
|
||||||
|
PkColumn string `gorm:"column:pk_column" json:"pkColumn"`
|
||||||
|
Options string `gorm:"column:options" json:"options"`
|
||||||
|
TreeCode string `gorm:"column:tree_code" json:"treeCode"`
|
||||||
|
TreeParentCode string `gorm:"column:tree_parent_code" json:"treeParentCode"`
|
||||||
|
TreeName string `gorm:"column:tree_name" json:"treeName"`
|
||||||
|
Tree bool `gorm:"column:tree" json:"tree"`
|
||||||
|
Crud bool `gorm:"column:crud" json:"crud"`
|
||||||
|
Remark string `gorm:"column:remark" json:"remark"`
|
||||||
|
|
||||||
|
CreateBy string `gorm:"column:create_by" json:"createBy"`
|
||||||
|
CreateTime string `gorm:"column:create_time" json:"createTime"`
|
||||||
|
UpdateBy string `gorm:"column:update_By" json:"updateBy"`
|
||||||
|
UpdateTime string `gorm:"column:update_time" json:"updateTime"`
|
||||||
|
DataScope string `gorm:"-" json:"dataScope"`
|
||||||
|
Params string `gorm:"-" json:"params"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *SysTables) GetPage(pageSize int, pageIndex int) ([]SysTables, int32, error) {
|
||||||
|
var doc []SysTables
|
||||||
|
|
||||||
|
table := orm.Eloquent.Select("*").Table("sys_tables")
|
||||||
|
|
||||||
|
if e.TableName != "" {
|
||||||
|
table = table.Where("table_name = ?", e.TableName)
|
||||||
|
}
|
||||||
|
if e.TableComment !=""{
|
||||||
|
table = table.Where("table_comment = ?", e.TableComment)
|
||||||
|
}
|
||||||
|
|
||||||
|
var count int32
|
||||||
|
|
||||||
|
if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil {
|
||||||
|
return nil, 0, err
|
||||||
|
}
|
||||||
|
table.Count(&count)
|
||||||
|
return doc, count, nil
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/swaggo/gin-swagger"
|
"github.com/swaggo/gin-swagger"
|
||||||
"github.com/swaggo/gin-swagger/swaggerFiles"
|
"github.com/swaggo/gin-swagger/swaggerFiles"
|
||||||
. "go-admin/apis"
|
. "go-admin/apis"
|
||||||
|
. "go-admin/apis/tools"
|
||||||
_ "go-admin/docs"
|
_ "go-admin/docs"
|
||||||
"go-admin/handler"
|
"go-admin/handler"
|
||||||
"go-admin/handler/sd"
|
"go-admin/handler/sd"
|
||||||
@@ -56,6 +57,7 @@ func InitRouter() *gin.Engine {
|
|||||||
apiv1 := r.Group("/api/v1")
|
apiv1 := r.Group("/api/v1")
|
||||||
{
|
{
|
||||||
apiv1.GET("/getCaptcha", GenerateCaptchaHandler)
|
apiv1.GET("/getCaptcha", GenerateCaptchaHandler)
|
||||||
|
apiv1.GET("/tables/page", GetTableList)
|
||||||
|
|
||||||
apiv1.GET("/menuTreeselect", GetMenuTreeelect)
|
apiv1.GET("/menuTreeselect", GetMenuTreeelect)
|
||||||
apiv1.GET("/rolemenu", GetRoleMenu)
|
apiv1.GET("/rolemenu", GetRoleMenu)
|
||||||
|
|||||||
Reference in new issue
Block a user