diff --git a/README.md b/README.md index d4e0ea3..d4c47ce 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,6 @@ settings: mode: dev # dev开发环境 test测试环境 prod线上环境;当 mode:demo 时,GET以外的请求操作提示 demomsg: "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!" host: 0.0.0.0 # 主机ip 或者域名,默认0.0.0.0 - isinit: false # 是否需要初始化数据库结构以及基本数据;true:需要;false:不需要 # 服务名称 name: go-admin # 服务端口 @@ -111,7 +110,7 @@ settings: ## 📦 本地开发 -首次启动说明 +### 首次启动说明 ```bash # 获取代码 @@ -128,9 +127,14 @@ vi ./config/setting.yml (更改isinit和数据库连接) # 1. 配置文件中修改数据库信息 # 注意: settings.database 下对应的配置数据) -# 2. 确认数据库初始化参数 -# 注意: settings.application.isinit 如果是首次启动,请把当前值设置成true,系统会自动初始化数据库结构以及基本的数据信息; -# 3. 确认log路径 +# 2. 确认log路径 + +``` + +### 初始化数据库,以及服务启动 +``` +# 首次配置需要初始化数据库资源信息 +./go-admin migrate -c config/settings.yml -m dev # 启动项目,也可以用IDE进行调试 @@ -140,17 +144,15 @@ vi ./config/setting.yml (更改isinit和数据库连接) [在线文档](https://wenjianzhang.github.io/go-admin-site) -文档生成 +### 文档生成 ```bash swag init -``` -如果没有swag命令 go get安装一下即可 -```bash +# 如果没有swag命令 go get安装一下即可 go get -u github.com/swaggo/swag/cmd/swag ``` -交叉编译 +### 交叉编译 ```bash env GOOS=windows GOARCH=amd64 go build main.go diff --git a/apis/log/loginLog.go b/apis/log/loginLog.go index 42e49e1..891b081 100644 --- a/apis/log/loginLog.go +++ b/apis/log/loginLog.go @@ -17,7 +17,7 @@ import ( // @Param dictType query string false "dictType" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/loginloglist [get] // @Security func GetLoginLogList(c *gin.Context) { @@ -57,7 +57,7 @@ func GetLoginLogList(c *gin.Context) { // @Description 获取JSON // @Tags 登录日志 // @Param infoId path int true "infoId" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/loginlog/{infoId} [get] // @Security func GetLoginLog(c *gin.Context) { diff --git a/apis/log/operlog.go b/apis/log/operlog.go index 55dbd3f..b2e1c3f 100644 --- a/apis/log/operlog.go +++ b/apis/log/operlog.go @@ -17,7 +17,7 @@ import ( // @Param dictType query string false "dictType" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/operloglist [get] // @Security func GetOperLogList(c *gin.Context) { @@ -58,7 +58,7 @@ func GetOperLogList(c *gin.Context) { // @Description 获取JSON // @Tags 登录日志 // @Param infoId path int true "infoId" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/operlog/{infoId} [get] // @Security func GetOperLog(c *gin.Context) { diff --git a/apis/system/config.go b/apis/system/config.go index 1f7538f..c74b900 100644 --- a/apis/system/config.go +++ b/apis/system/config.go @@ -18,7 +18,7 @@ import ( // @Param configType query string false "configType" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/configList [get] // @Security func GetConfigList(c *gin.Context) { @@ -58,7 +58,7 @@ func GetConfigList(c *gin.Context) { // @Description 获取JSON // @Tags 配置 // @Param configId path int true "配置编码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/config/{configId} [get] // @Security func GetConfig(c *gin.Context) { @@ -77,7 +77,7 @@ func GetConfig(c *gin.Context) { // @Description 获取JSON // @Tags 配置 // @Param configKey path int true "configKey" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/configKey/{configKey} [get] // @Security func GetConfigByConfigKey(c *gin.Context) { @@ -115,7 +115,7 @@ func InsertConfig(c *gin.Context) { // @Tags 配置 // @Accept application/json // @Product application/json -// @Param data body models.Config true "body" +// @Param data body models.SysConfig true "body" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/config [put] diff --git a/apis/system/dept.go b/apis/system/dept.go index dca8cac..14fdd63 100644 --- a/apis/system/dept.go +++ b/apis/system/dept.go @@ -15,7 +15,7 @@ import ( // @Param name query string false "name" // @Param id query string false "id" // @Param position query string false "position" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/deptList [get] // @Security func GetDeptList(c *gin.Context) { @@ -44,7 +44,7 @@ func GetDeptTree(c *gin.Context) { // @Tags 部门 // @Param deptId path string false "deptId" // @Param position query string false "position" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dept/{deptId} [get] // @Security func GetDept(c *gin.Context) { diff --git a/apis/system/dict/dictData.go b/apis/system/dict/dictData.go index 6abf2f2..00a29ca 100644 --- a/apis/system/dict/dictData.go +++ b/apis/system/dict/dictData.go @@ -17,7 +17,7 @@ import ( // @Param dictType query string false "dictType" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dict/data/list [get] // @Security func GetDictDataList(c *gin.Context) { @@ -59,7 +59,7 @@ func GetDictDataList(c *gin.Context) { // @Description 获取JSON // @Tags 字典数据 // @Param dictCode path int true "字典编码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dict/data/{dictCode} [get] // @Security func GetDictData(c *gin.Context) { @@ -77,7 +77,7 @@ func GetDictData(c *gin.Context) { // @Description 获取JSON // @Tags 字典数据 // @Param dictType path int true "dictType" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dict/databyType/{dictType} [get] // @Security func GetDictDataByDictType(c *gin.Context) { diff --git a/apis/system/dict/dictType.go b/apis/system/dict/dictType.go index a3dc63f..c7d2b19 100644 --- a/apis/system/dict/dictType.go +++ b/apis/system/dict/dictType.go @@ -17,7 +17,7 @@ import ( // @Param dictType query string false "dictType" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dict/type/list [get] // @Security func GetDictTypeList(c *gin.Context) { @@ -57,7 +57,7 @@ func GetDictTypeList(c *gin.Context) { // @Description 获取JSON // @Tags 字典类型 // @Param dictId path int true "字典类型编码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/dict/type/{dictId} [get] // @Security func GetDictType(c *gin.Context) { diff --git a/apis/system/post.go b/apis/system/post.go index 7cf16d1..643c41b 100644 --- a/apis/system/post.go +++ b/apis/system/post.go @@ -13,7 +13,7 @@ import ( // @Param name query string false "name" // @Param id query string false "id" // @Param position query string false "position" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post [get] // @Security func GetPostList(c *gin.Context) { @@ -45,7 +45,7 @@ func GetPostList(c *gin.Context) { // @Description 获取JSON // @Tags 字典数据 // @Param postId path int true "postId" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post/{postId} [get] // @Security func GetPost(c *gin.Context) { diff --git a/apis/system/role.go b/apis/system/role.go index 7e0c5a7..b762806 100644 --- a/apis/system/role.go +++ b/apis/system/role.go @@ -16,7 +16,7 @@ import ( // @Param roleKey query string false "roleKey" // @Param pageSize query int false "页条数" // @Param pageIndex query int false "页码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/rolelist [get] // @Security func GetRoleList(c *gin.Context) { @@ -68,7 +68,7 @@ func GetRole(c *gin.Context) { // @Tags 角色/Role // @Accept application/json // @Product application/json -// @Param data body models.Config true "data" +// @Param data body models.SysRole true "data" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/role [post] diff --git a/apis/system/sysuser.go b/apis/system/sysuser.go index 78217f1..0d16a50 100644 --- a/apis/system/sysuser.go +++ b/apis/system/sysuser.go @@ -55,7 +55,7 @@ func GetSysUserList(c *gin.Context) { // @Description 获取JSON // @Tags 用户 // @Param userId path int true "用户编码" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/sysUser/{userId} [get] // @Security func GetSysUser(c *gin.Context) { @@ -86,7 +86,7 @@ func GetSysUser(c *gin.Context) { // @Summary 获取当前登录用户 // @Description 获取JSON // @Tags 个人中心 -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/user/profile [get] // @Security func GetSysUserProfile(c *gin.Context) { @@ -126,7 +126,7 @@ func GetSysUserProfile(c *gin.Context) { // @Summary 获取用户角色和职位 // @Description 获取JSON // @Tags 用户 -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/sysUser [get] // @Security func GetSysUserInit(c *gin.Context) { diff --git a/apis/tools/dbcolumns.go b/apis/tools/dbcolumns.go index 61bd842..7219969 100644 --- a/apis/tools/dbcolumns.go +++ b/apis/tools/dbcolumns.go @@ -14,7 +14,7 @@ import ( // @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": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/db/columns/page [get] func GetDBColumnList(c *gin.Context) { var data tools.DBColumns diff --git a/apis/tools/dbtables.go b/apis/tools/dbtables.go index 6e51f39..0b6f258 100644 --- a/apis/tools/dbtables.go +++ b/apis/tools/dbtables.go @@ -15,7 +15,7 @@ import ( // @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": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/db/tables/page [get] func GetDBTableList(c *gin.Context) { var res app.Response diff --git a/apis/tools/gen.go b/apis/tools/gen.go index 318f1d5..b0f2a14 100644 --- a/apis/tools/gen.go +++ b/apis/tools/gen.go @@ -19,15 +19,25 @@ func Preview(c *gin.Context) { tools2.HasError(err, "", -1) t2, err := template.ParseFiles("template/api.go.template") tools2.HasError(err, "", -1) + t3, err := template.ParseFiles("template/js.go.template") + tools2.HasError(err, "", -1) + t4, err := template.ParseFiles("template/vue.go.template") + tools2.HasError(err, "", -1) tab, _ := table.Get() var b1 bytes.Buffer err = t1.Execute(&b1, tab) var b2 bytes.Buffer err = t2.Execute(&b2, tab) + var b3 bytes.Buffer + err = t3.Execute(&b3, tab) + var b4 bytes.Buffer + err = t4.Execute(&b4, tab) mp := make(map[string]interface{}) mp["template/model.go.template"] = b1.String() mp["template/api.go.template"] = b2.String() + mp["template/js.go.template"] = b3.String() + mp["template/vue.go.template"] = b4.String() var res app.Response res.Data = mp diff --git a/apis/tools/systables.go b/apis/tools/systables.go index dbb0573..ef69b9c 100644 --- a/apis/tools/systables.go +++ b/apis/tools/systables.go @@ -15,7 +15,7 @@ import ( // @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": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/sys/tables/page [get] func GetSysTableList(c *gin.Context) { var data tools.SysTables @@ -52,7 +52,7 @@ func GetSysTableList(c *gin.Context) { // @Description 获取JSON // @Tags 工具 - 生成表 // @Param configKey path int true "configKey" -// @Success 200 {object} models.Response "{"code": 200, "data": [...]}" +// @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/sys/tables/info/{tableId} [get] // @Security func GetSysTables(c *gin.Context) { diff --git a/cmd/api/server.go b/cmd/api/server.go index 2a7bf0b..0e48da2 100644 --- a/cmd/api/server.go +++ b/cmd/api/server.go @@ -21,8 +21,6 @@ var ( config string port string mode string - //auto tls - //StartCmd : set up restful api server StartCmd = &cobra.Command{ Use: "server", Short: "Start API server", diff --git a/cmd/migrate/server.go b/cmd/migrate/server.go index 75a4b6b..897fb80 100644 --- a/cmd/migrate/server.go +++ b/cmd/migrate/server.go @@ -41,19 +41,14 @@ func run() { //3. 初始化数据库链接 database.Setup() //4. 数据库迁移 - gorm.AutoMigrate(orm.Eloquent) + _ = gorm.AutoMigrate(orm.Eloquent) log.Println("数据库结构初始化成功!") //5. 数据初始化完成 - if config2.ApplicationConfig.IsInit { - if err := models.InitDb(); err != nil { - log.Fatal("数据库基础数据初始化失败!") - } else { - config2.SetApplicationIsInit() - } - log.Println("数据库基础数据初始化成功!") + if err := models.InitDb(); err != nil { + log.Fatal("数据库基础数据初始化失败!") } - usage = `finish` + usage = `数据库基础数据初始化成功` fmt.Println(usage) } diff --git a/config/db.sql b/config/db.sql index e65fbef..7ce90c9 100644 --- a/config/db.sql +++ b/config/db.sql @@ -337,9 +337,6 @@ INSERT INTO `sys_menu` VALUES (46, NULL, '删除用户', NULL, '/api/v1/sysuser/ INSERT INTO `sys_menu` VALUES (50, 'Mangent', '基础信息', 'network', '/mangent', '/0/50', 'M', '无', '', 0, '1', '', 'Layout', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (51, 'Menu', '菜单管理', 'tree-table', 'menu', '/0/2/51', 'C', '无', 'system:sysmenu:list', 2, '1', '', '/menu/index', 3, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:30', NULL); INSERT INTO `sys_menu` VALUES (52, 'Role', '角色管理', 'peoples', 'role', '/0/2/52', 'C', '无', 'system:sysrole:list', 2, '1', '', '/role/index', 2, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:19', NULL); -INSERT INTO `sys_menu` VALUES (53, 'Doctor', '医生管理', 'pass', 'doctor', '/0/50/53', 'C', '无', '', 50, '1', '', '/doctor/index', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (54, 'Calendar', '排班管理', 'calendar', 'calendar', '/0/50/54', 'C', '无', '', 50, '1', '', '/calendar/index', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (55, 'Menber', '会员管理', 'vip', 'member', '/0/50/55', 'C', '无', '', 50, '1', '', '/member/index', 0, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (56, 'Dept', '部门管理', 'tree', 'dept', '/0/2/56', 'C', '无', 'system:sysdept:list', 2, '0', '', '/dept/index', 4, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:47', NULL); INSERT INTO `sys_menu` VALUES (57, 'post', '岗位管理', 'pass', 'post', '/0/2/57', 'C', '无', 'system:syspost:list', 2, '0', '', '/post/index', 5, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:16:53', NULL); INSERT INTO `sys_menu` VALUES (58, 'Dict', '字典管理', 'education', 'dict', '/0/2/58', 'C', '无', 'system:sysdicttype:list', 2, '0', '', '/dict/index', 6, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:17:04', NULL); @@ -382,11 +379,6 @@ INSERT INTO `sys_menu` VALUES (94, NULL, '获取菜单树', 'bug', '/api/v1/menu INSERT INTO `sys_menu` VALUES (95, NULL, '获取角色菜单', 'bug', '/api/v1/rolemenu', '/0/63/205/95', 'A', 'GET', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (96, NULL, '创建角色菜单', 'bug', '/api/v1/rolemenu', '/0/63/205/96', 'A', 'POST', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (97, NULL, '删除用户菜单数据', 'bug', '/api/v1/rolemenu/:id', '/0/63/205/97', 'A', 'DELETE', NULL, 205, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (98, NULL, '医生获取', 'bug', '/api/v1/doctor', '/0/63/208/98', 'A', 'GET', NULL, 208, NULL, NULL, NULL, 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (99, NULL, '创建医生', 'bug', '/api/v1/doctor', '/0/63/208/99', 'A', 'POST', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (100, NULL, '修改医生', 'bug', '/api/v1/doctor/:id', '/0/63/208/100', 'A', 'PUT', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (101, NULL, '删除医生', 'bug', '/api/v1/doctor/:id', '/0/63/208/101', 'A', 'DELETE', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (102, NULL, '添加医生头像', 'bug', '/api/v1/doctor/pic/', '/0/63/208/102', 'A', 'POST', NULL, 208, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (103, NULL, '部门菜单列表', 'bug', '/api/v1/deptList', '/0/63/203/103', 'A', 'GET', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (104, NULL, '根据id获取部门信息', 'bug', '/api/v1/dept/:id', '/0/63/203/104', 'A', 'GET', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (105, NULL, '创建部门', 'bug', '/api/v1/dept', '/0/63/203/105', 'A', 'POST', NULL, 203, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); @@ -433,10 +425,6 @@ INSERT INTO `sys_menu` VALUES (203, '', '部门管理', 'tree', '', '/0/63/203', INSERT INTO `sys_menu` VALUES (204, '', '岗位管理', 'pass', '', '/0/63/204', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (205, '', '角色菜单管理', 'nested', '', '/0/63/205', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (206, '', '数据', '', '', '/0/63/69/206', 'C', 'PUT', '', 69, '0', '', '', 2, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (207, '', '会员管理', 'vip', '', '/0/63/207', 'C', 'DELETE', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (208, '', '医生管理', 'theme', '', '/0/63/208', 'C', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (209, '', '订单管理', 'tab', '', '/0/63/209', 'M', '', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); -INSERT INTO `sys_menu` VALUES (210, '', '排班管理', 'calendar', '', '/0/63/210', 'C', 'DELETE', '', 63, '0', '', '', 1, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (211, 'Log', '日志管理', 'log', '/log', '/0/2/211', 'M', '', '', 2, '0', '', '/log/index', 8, '0', '1', '1', 0, '2020-04-11 15:52:48', '2020-04-12 11:15:32', NULL); INSERT INTO `sys_menu` VALUES (212, 'LoginLog', '登录日志', 'logininfor', '/loginlog', '/0/2/211/212', 'C', '', 'system:sysloginlog:list', 211, '0', '', '/loginlog/index', 1, '0', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); INSERT INTO `sys_menu` VALUES (213, NULL, '获取登录日志', 'bug', '/api/v1/loginloglist', '/0/63/214/213', 'A', 'GET', NULL, 214, NULL, NULL, NULL, 0, '1', '1', '1', 0, '2020-04-11 15:52:48', NULL, NULL); diff --git a/config/settings.yml b/config/settings.yml index 4487df1..90f87ce 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -3,7 +3,6 @@ settings: mode: dev # dev开发环境 test测试环境 prod线上环境 demomsg: "谢谢您的参与,但为了大家更好的体验,所以本次提交就算了吧!\U0001F600\U0001F600\U0001F600" host: 0.0.0.0 - isinit: false name: testApp port: 8000 readtimeout: 1 diff --git a/database/mysql.go b/database/mysql.go index f9d414b..378f107 100644 --- a/database/mysql.go +++ b/database/mysql.go @@ -52,14 +52,14 @@ func Setup() { panic("db type unknow") } if err != nil { - log.Fatalln("%s connect error %v", DbType, err) + log.Fatalf("%s connect error %v", DbType, err) } else { - log.Println("%s connect success!", DbType) + log.Printf("%s connect success!", DbType) } - log.Println("%s connect success!", DbType) + if Eloquent.Error != nil { - log.Fatalln("database error %v", Eloquent.Error) + log.Fatalf("database error %v", Eloquent.Error) } Eloquent.LogMode(true) diff --git a/docs/docs.go b/docs/docs.go index 213f327..d6ea2dd 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,6 +1,6 @@ // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag at -// 2020-03-19 00:24:21.426215 +0800 CST m=+0.087420189 +// 2020-04-29 23:00:58.67458 +0800 CST m=+0.080406457 package docs @@ -52,7 +52,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Config" + "$ref": "#/definitions/models.SysConfig" } } ], @@ -91,7 +91,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -146,7 +146,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -200,7 +200,81 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/db/columns/page": { + "get": { + "description": "数据库表列分页列表 / database table column 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/app.Response" + } + } + } + } + }, + "/api/v1/db/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/app.Response" } } } @@ -315,7 +389,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -383,7 +457,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -436,9 +510,9 @@ var doc = `{ "application/json" ], "tags": [ - "配置" + "字典数据" ], - "summary": "添加配置", + "summary": "添加字典数据", "parameters": [ { "description": "data", @@ -447,7 +521,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Config" + "$ref": "#/definitions/models.DictType" } } ], @@ -509,7 +583,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -540,7 +614,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -595,7 +669,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -721,7 +795,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -752,7 +826,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -879,7 +953,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -957,7 +1031,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1306,7 +1380,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1386,7 +1460,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1428,7 +1502,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1531,7 +1605,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1637,7 +1711,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Config" + "$ref": "#/definitions/models.SysRole" } } ], @@ -1725,7 +1799,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1759,40 +1833,6 @@ var doc = `{ } } } - }, - "post": { - "description": "获取JSON", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "tags": [ - "角色菜单" - ], - "summary": "创建角色菜单", - "parameters": [ - { - "type": "string", - "description": "role_id", - "name": "role_id", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "menu_id", - "name": "menu_id", - "in": "formData", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } } }, "/api/v1/rolemenu/{id}": { @@ -1827,6 +1867,166 @@ var doc = `{ } } }, + "/api/v1/sys/tables/info": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "修改表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "修改表结构", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "添加表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "添加表结构", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tables", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/info/{tableId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "工具 - 生成表" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "configKey", + "name": "configKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除表结构", + "tags": [ + "工具 - 生成表" + ], + "summary": "删除表结构", + "parameters": [ + { + "type": "integer", + "description": "tableId", + "name": "tableId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/page": { + "get": { + "description": "生成表分页列表", + "tags": [ + "工具 - 生成表" + ], + "summary": "分页列表数据", + "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/app.Response" + } + } + } + } + }, "/api/v1/sysUser": { "get": { "security": [ @@ -1843,7 +2043,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1904,7 +2104,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1996,43 +2196,6 @@ 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": { "get": { "security": [ @@ -2049,7 +2212,7 @@ var doc = `{ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -2147,19 +2310,7 @@ var doc = `{ "summary": "CPU 使用量", "responses": { "200": { - "description": "OK - Load average: 2.39, 2.13, 1.97 | Cores: 2", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", + "description": "OK", "schema": { "type": "string" } @@ -2231,19 +2382,7 @@ var doc = `{ "summary": "OS", "responses": { "200": { - "description": "OK - Free space: 455MB (0GB) / 8192MB (8GB) | Used: 5%", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", + "description": "OK", "schema": { "type": "string" } @@ -2263,19 +2402,7 @@ var doc = `{ "summary": "内存使用量", "responses": { "200": { - "description": "OK - Free space: 455MB (0GB) / 8192MB (8GB) | Used: 5%", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", + "description": "OK", "schema": { "type": "string" } @@ -2285,52 +2412,20 @@ var doc = `{ } }, "definitions": { - "models.Config": { + "app.Response": { "type": "object", "properties": { - "configId": { - "description": "编码", - "type": "integer" + "code": { + "description": "代码", + "type": "integer", + "example": 200 }, - "configKey": { - "description": "参数键名", - "type": "string" + "data": { + "description": "数据集", + "type": "object" }, - "configName": { - "description": "参数名称", - "type": "string" - }, - "configType": { - "description": "是否系统内置", - "type": "string" - }, - "configValue": { - "description": "参数键值", - "type": "string" - }, - "createBy": { - "type": "string" - }, - "createTime": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "isDel": { - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updateTime": { + "msg": { + "description": "消息", "type": "string" } } @@ -2347,32 +2442,30 @@ var doc = `{ "createBy": { "type": "string" }, - "createTime": { + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, - "deptId": { - "description": "部门编码", - "type": "integer", - "x-description": "标示", - "example": 1 - }, - "deptath": { + "deletedAt": { "type": "string" }, - "deptname": { + "deptId": { + "description": "部门编码", + "type": "integer" + }, + "deptName": { "description": "部门名称", "type": "string" }, + "deptPath": { + "type": "string" + }, "email": { "description": "邮箱", "type": "string" }, - "isDel": { - "type": "string" - }, "leader": { "description": "负责人", "type": "string" @@ -2380,7 +2473,7 @@ var doc = `{ "params": { "type": "string" }, - "parent_id": { + "parentId": { "description": "上级部门", "type": "integer" }, @@ -2399,7 +2492,7 @@ var doc = `{ "updateBy": { "type": "string" }, - "updateTime": { + "updatedAt": { "type": "string" } } @@ -2411,16 +2504,17 @@ var doc = `{ "description": "创建者", "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "dictId": { - "type": "integer", - "example": 1 + "type": "integer" }, "dictName": { "description": "字典名称", @@ -2430,9 +2524,6 @@ var doc = `{ "description": "字典类型", "type": "string" }, - "isDel": { - "type": "string" - }, "params": { "type": "string" }, @@ -2448,8 +2539,7 @@ var doc = `{ "description": "更新者", "type": "string" }, - "updateTime": { - "description": "更新时间", + "updatedAt": { "type": "string" } } @@ -2488,14 +2578,16 @@ var doc = `{ "description": "创建人", "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "description": "数据", "type": "string" }, + "deletedAt": { + "type": "string" + }, "infoId": { "description": "主键", "type": "integer" @@ -2504,10 +2596,6 @@ var doc = `{ "description": "ip地址", "type": "string" }, - "isDel": { - "description": "是否删除", - "type": "string" - }, "loginLocation": { "description": "归属地", "type": "string" @@ -2524,7 +2612,6 @@ var doc = `{ "type": "string" }, "params": { - "description": "参数", "type": "string" }, "platform": { @@ -2543,11 +2630,10 @@ var doc = `{ "description": "更新者", "type": "string" }, - "updateTime": { - "description": "更新时间", + "updatedAt": { "type": "string" }, - "userName": { + "username": { "description": "用户名", "type": "string" } @@ -2574,16 +2660,19 @@ var doc = `{ "createBy": { "type": "string" }, - "createTime": { + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "icon": { "type": "string" }, - "isDel": { + "isFrame": { "type": "string" }, "is_select": { @@ -2628,7 +2717,7 @@ var doc = `{ "updateBy": { "type": "string" }, - "updateTime": { + "updatedAt": { "type": "string" }, "visible": { @@ -2642,16 +2731,14 @@ var doc = `{ "createBy": { "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, - "isDel": { - "description": "是否删除", - "type": "integer" + "deletedAt": { + "type": "string" }, "params": { "type": "string" @@ -2662,9 +2749,7 @@ var doc = `{ }, "postId": { "description": "岗位编号", - "type": "integer", - "x-description": "标示", - "example": 1 + "type": "integer" }, "postName": { "description": "岗位名称", @@ -2685,26 +2770,57 @@ var doc = `{ "updateBy": { "type": "string" }, - "updateTime": { - "description": "最后修改时间", + "updatedAt": { "type": "string" } } }, - "models.Response": { + "models.SysConfig": { "type": "object", "properties": { - "code": { - "description": "代码", - "type": "integer", - "example": 200 + "configId": { + "description": "编码", + "type": "integer" }, - "data": { - "description": "数据集", - "type": "object" + "configKey": { + "description": "参数键名", + "type": "string" }, - "msg": { - "description": "错误消息", + "configName": { + "description": "参数名称", + "type": "string" + }, + "configType": { + "description": "是否系统内置", + "type": "string" + }, + "configValue": { + "description": "参数键值", + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { "type": "string" } } @@ -2723,20 +2839,18 @@ var doc = `{ "description": "创建人", "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "description": "数据", "type": "string" }, - "deptName": { - "description": "部门名称", + "deletedAt": { "type": "string" }, - "isDel": { - "description": "是否删除", + "deptName": { + "description": "部门名称", "type": "string" }, "jsonResult": { @@ -2807,12 +2921,11 @@ var doc = `{ "description": "更新者", "type": "string" }, - "updateTime": { - "description": "更新时间", + "updatedAt": { "type": "string" }, "userAgent": { - "description": "us", + "description": "ua", "type": "string" } } @@ -2826,12 +2939,15 @@ var doc = `{ "createBy": { "type": "string" }, - "createTime": { + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "deptIds": { "type": "array", "items": { @@ -2841,9 +2957,6 @@ var doc = `{ "flag": { "type": "string" }, - "isDel": { - "type": "string" - }, "menuIds": { "type": "array", "items": { @@ -2879,7 +2992,7 @@ var doc = `{ "updateBy": { "type": "string" }, - "updateTime": { + "updatedAt": { "type": "string" } } @@ -2894,13 +3007,15 @@ var doc = `{ "createBy": { "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "deptId": { "description": "部门编码", "type": "integer" @@ -2909,9 +3024,6 @@ var doc = `{ "description": "邮箱", "type": "string" }, - "isDel": { - "type": "string" - }, "nickName": { "description": "昵称", "type": "string" @@ -2953,8 +3065,7 @@ var doc = `{ "updateBy": { "type": "string" }, - "updateTime": { - "description": "修改时间", + "updatedAt": { "type": "string" }, "userId": { diff --git a/docs/swagger.json b/docs/swagger.json index 062c21e..6bf520f 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -34,7 +34,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Config" + "$ref": "#/definitions/models.SysConfig" } } ], @@ -73,7 +73,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -128,7 +128,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -182,7 +182,81 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" + } + } + } + } + }, + "/api/v1/db/columns/page": { + "get": { + "description": "数据库表列分页列表 / database table column 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/app.Response" + } + } + } + } + }, + "/api/v1/db/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/app.Response" } } } @@ -297,7 +371,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -365,7 +439,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -418,9 +492,9 @@ "application/json" ], "tags": [ - "配置" + "字典数据" ], - "summary": "添加配置", + "summary": "添加字典数据", "parameters": [ { "description": "data", @@ -429,7 +503,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Config" + "$ref": "#/definitions/models.DictType" } } ], @@ -491,7 +565,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -522,7 +596,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -577,7 +651,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -703,7 +777,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -734,7 +808,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -861,7 +935,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -939,7 +1013,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1288,7 +1362,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1368,7 +1442,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1410,7 +1484,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1513,7 +1587,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1619,7 +1693,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/models.Config" + "$ref": "#/definitions/models.SysRole" } } ], @@ -1707,7 +1781,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1741,40 +1815,6 @@ } } } - }, - "post": { - "description": "获取JSON", - "consumes": [ - "application/x-www-form-urlencoded" - ], - "tags": [ - "角色菜单" - ], - "summary": "创建角色菜单", - "parameters": [ - { - "type": "string", - "description": "role_id", - "name": "role_id", - "in": "formData", - "required": true - }, - { - "type": "string", - "description": "menu_id", - "name": "menu_id", - "in": "formData", - "required": true - } - ], - "responses": { - "200": { - "description": "{\"code\": -1, \"message\": \"添加失败\"}", - "schema": { - "type": "string" - } - } - } } }, "/api/v1/rolemenu/{id}": { @@ -1809,6 +1849,166 @@ } } }, + "/api/v1/sys/tables/info": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "修改表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "修改表结构", + "parameters": [ + { + "description": "body", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/models.Dept" + } + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + }, + "post": { + "security": [ + { + "Bearer": [] + } + ], + "description": "添加表结构", + "consumes": [ + "application/json" + ], + "tags": [ + "工具 - 生成表" + ], + "summary": "添加表结构", + "parameters": [ + { + "type": "string", + "description": "tableName / 数据表名称", + "name": "tables", + "in": "query" + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"添加失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/info/{tableId}": { + "get": { + "security": [ + { + "": [] + } + ], + "description": "获取JSON", + "tags": [ + "工具 - 生成表" + ], + "summary": "获取配置", + "parameters": [ + { + "type": "integer", + "description": "configKey", + "name": "configKey", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": 200, \"data\": [...]}", + "schema": { + "$ref": "#/definitions/app.Response" + } + } + } + }, + "delete": { + "description": "删除表结构", + "tags": [ + "工具 - 生成表" + ], + "summary": "删除表结构", + "parameters": [ + { + "type": "integer", + "description": "tableId", + "name": "tableId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "{\"code\": -1, \"message\": \"删除失败\"}", + "schema": { + "type": "string" + } + } + } + } + }, + "/api/v1/sys/tables/page": { + "get": { + "description": "生成表分页列表", + "tags": [ + "工具 - 生成表" + ], + "summary": "分页列表数据", + "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/app.Response" + } + } + } + } + }, "/api/v1/sysUser": { "get": { "security": [ @@ -1825,7 +2025,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1886,7 +2086,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -1978,43 +2178,6 @@ } } }, - "/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": { "get": { "security": [ @@ -2031,7 +2194,7 @@ "200": { "description": "{\"code\": 200, \"data\": [...]}", "schema": { - "$ref": "#/definitions/models.Response" + "$ref": "#/definitions/app.Response" } } } @@ -2129,19 +2292,7 @@ "summary": "CPU 使用量", "responses": { "200": { - "description": "OK - Load average: 2.39, 2.13, 1.97 | Cores: 2", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", + "description": "OK", "schema": { "type": "string" } @@ -2213,19 +2364,7 @@ "summary": "OS", "responses": { "200": { - "description": "OK - Free space: 455MB (0GB) / 8192MB (8GB) | Used: 5%", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", + "description": "OK", "schema": { "type": "string" } @@ -2245,19 +2384,7 @@ "summary": "内存使用量", "responses": { "200": { - "description": "OK - Free space: 455MB (0GB) / 8192MB (8GB) | Used: 5%", - "schema": { - "type": "string" - } - }, - "429": { - "description": "WARNING", - "schema": { - "type": "string" - } - }, - "500": { - "description": "CRITICAL", + "description": "OK", "schema": { "type": "string" } @@ -2267,52 +2394,20 @@ } }, "definitions": { - "models.Config": { + "app.Response": { "type": "object", "properties": { - "configId": { - "description": "编码", - "type": "integer" + "code": { + "description": "代码", + "type": "integer", + "example": 200 }, - "configKey": { - "description": "参数键名", - "type": "string" + "data": { + "description": "数据集", + "type": "object" }, - "configName": { - "description": "参数名称", - "type": "string" - }, - "configType": { - "description": "是否系统内置", - "type": "string" - }, - "configValue": { - "description": "参数键值", - "type": "string" - }, - "createBy": { - "type": "string" - }, - "createTime": { - "type": "string" - }, - "dataScope": { - "type": "string" - }, - "isDel": { - "type": "string" - }, - "params": { - "type": "string" - }, - "remark": { - "description": "备注", - "type": "string" - }, - "updateBy": { - "type": "string" - }, - "updateTime": { + "msg": { + "description": "消息", "type": "string" } } @@ -2329,32 +2424,30 @@ "createBy": { "type": "string" }, - "createTime": { + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, - "deptId": { - "description": "部门编码", - "type": "integer", - "x-description": "标示", - "example": 1 - }, - "deptath": { + "deletedAt": { "type": "string" }, - "deptname": { + "deptId": { + "description": "部门编码", + "type": "integer" + }, + "deptName": { "description": "部门名称", "type": "string" }, + "deptPath": { + "type": "string" + }, "email": { "description": "邮箱", "type": "string" }, - "isDel": { - "type": "string" - }, "leader": { "description": "负责人", "type": "string" @@ -2362,7 +2455,7 @@ "params": { "type": "string" }, - "parent_id": { + "parentId": { "description": "上级部门", "type": "integer" }, @@ -2381,7 +2474,7 @@ "updateBy": { "type": "string" }, - "updateTime": { + "updatedAt": { "type": "string" } } @@ -2393,16 +2486,17 @@ "description": "创建者", "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "dictId": { - "type": "integer", - "example": 1 + "type": "integer" }, "dictName": { "description": "字典名称", @@ -2412,9 +2506,6 @@ "description": "字典类型", "type": "string" }, - "isDel": { - "type": "string" - }, "params": { "type": "string" }, @@ -2430,8 +2521,7 @@ "description": "更新者", "type": "string" }, - "updateTime": { - "description": "更新时间", + "updatedAt": { "type": "string" } } @@ -2470,14 +2560,16 @@ "description": "创建人", "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "description": "数据", "type": "string" }, + "deletedAt": { + "type": "string" + }, "infoId": { "description": "主键", "type": "integer" @@ -2486,10 +2578,6 @@ "description": "ip地址", "type": "string" }, - "isDel": { - "description": "是否删除", - "type": "string" - }, "loginLocation": { "description": "归属地", "type": "string" @@ -2506,7 +2594,6 @@ "type": "string" }, "params": { - "description": "参数", "type": "string" }, "platform": { @@ -2525,11 +2612,10 @@ "description": "更新者", "type": "string" }, - "updateTime": { - "description": "更新时间", + "updatedAt": { "type": "string" }, - "userName": { + "username": { "description": "用户名", "type": "string" } @@ -2556,16 +2642,19 @@ "createBy": { "type": "string" }, - "createTime": { + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "icon": { "type": "string" }, - "isDel": { + "isFrame": { "type": "string" }, "is_select": { @@ -2610,7 +2699,7 @@ "updateBy": { "type": "string" }, - "updateTime": { + "updatedAt": { "type": "string" }, "visible": { @@ -2624,16 +2713,14 @@ "createBy": { "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, - "isDel": { - "description": "是否删除", - "type": "integer" + "deletedAt": { + "type": "string" }, "params": { "type": "string" @@ -2644,9 +2731,7 @@ }, "postId": { "description": "岗位编号", - "type": "integer", - "x-description": "标示", - "example": 1 + "type": "integer" }, "postName": { "description": "岗位名称", @@ -2667,26 +2752,57 @@ "updateBy": { "type": "string" }, - "updateTime": { - "description": "最后修改时间", + "updatedAt": { "type": "string" } } }, - "models.Response": { + "models.SysConfig": { "type": "object", "properties": { - "code": { - "description": "代码", - "type": "integer", - "example": 200 + "configId": { + "description": "编码", + "type": "integer" }, - "data": { - "description": "数据集", - "type": "object" + "configKey": { + "description": "参数键名", + "type": "string" }, - "msg": { - "description": "错误消息", + "configName": { + "description": "参数名称", + "type": "string" + }, + "configType": { + "description": "是否系统内置", + "type": "string" + }, + "configValue": { + "description": "参数键值", + "type": "string" + }, + "createBy": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "dataScope": { + "type": "string" + }, + "deletedAt": { + "type": "string" + }, + "params": { + "type": "string" + }, + "remark": { + "description": "备注", + "type": "string" + }, + "updateBy": { + "type": "string" + }, + "updatedAt": { "type": "string" } } @@ -2705,20 +2821,18 @@ "description": "创建人", "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "description": "数据", "type": "string" }, - "deptName": { - "description": "部门名称", + "deletedAt": { "type": "string" }, - "isDel": { - "description": "是否删除", + "deptName": { + "description": "部门名称", "type": "string" }, "jsonResult": { @@ -2789,12 +2903,11 @@ "description": "更新者", "type": "string" }, - "updateTime": { - "description": "更新时间", + "updatedAt": { "type": "string" }, "userAgent": { - "description": "us", + "description": "ua", "type": "string" } } @@ -2808,12 +2921,15 @@ "createBy": { "type": "string" }, - "createTime": { + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "deptIds": { "type": "array", "items": { @@ -2823,9 +2939,6 @@ "flag": { "type": "string" }, - "isDel": { - "type": "string" - }, "menuIds": { "type": "array", "items": { @@ -2861,7 +2974,7 @@ "updateBy": { "type": "string" }, - "updateTime": { + "updatedAt": { "type": "string" } } @@ -2876,13 +2989,15 @@ "createBy": { "type": "string" }, - "createTime": { - "description": "创建时间", + "createdAt": { "type": "string" }, "dataScope": { "type": "string" }, + "deletedAt": { + "type": "string" + }, "deptId": { "description": "部门编码", "type": "integer" @@ -2891,9 +3006,6 @@ "description": "邮箱", "type": "string" }, - "isDel": { - "type": "string" - }, "nickName": { "description": "昵称", "type": "string" @@ -2935,8 +3047,7 @@ "updateBy": { "type": "string" }, - "updateTime": { - "description": "修改时间", + "updatedAt": { "type": "string" }, "userId": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0269582..6cd4c29 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,37 +1,15 @@ definitions: - models.Config: + app.Response: properties: - configId: - description: 编码 + code: + description: 代码 + example: 200 type: integer - configKey: - description: 参数键名 - type: string - configName: - description: 参数名称 - type: string - configType: - description: 是否系统内置 - type: string - configValue: - description: 参数键值 - type: string - createBy: - type: string - createTime: - type: string - dataScope: - type: string - isDel: - type: string - params: - type: string - remark: - description: 备注 - type: string - updateBy: - type: string - updateTime: + data: + description: 数据集 + type: object + msg: + description: 消息 type: string type: object models.Dept: @@ -42,31 +20,29 @@ definitions: type: array createBy: type: string - createTime: + createdAt: type: string dataScope: type: string + deletedAt: + type: string deptId: description: 部门编码 - example: 1 type: integer - x-description: 标示 - deptath: - type: string - deptname: + deptName: description: 部门名称 type: string + deptPath: + type: string email: description: 邮箱 type: string - isDel: - type: string leader: description: 负责人 type: string params: type: string - parent_id: + parentId: description: 上级部门 type: integer phone: @@ -80,7 +56,7 @@ definitions: type: string updateBy: type: string - updateTime: + updatedAt: type: string type: object models.DictType: @@ -88,13 +64,13 @@ definitions: createBy: description: 创建者 type: string - createTime: - description: 创建时间 + createdAt: type: string dataScope: type: string + deletedAt: + type: string dictId: - example: 1 type: integer dictName: description: 字典名称 @@ -102,8 +78,6 @@ definitions: dictType: description: 字典类型 type: string - isDel: - type: string params: type: string remark: @@ -115,8 +89,7 @@ definitions: updateBy: description: 更新者 type: string - updateTime: - description: 更新时间 + updatedAt: type: string type: object models.Login: @@ -143,21 +116,19 @@ definitions: createBy: description: 创建人 type: string - createTime: - description: 创建时间 + createdAt: type: string dataScope: description: 数据 type: string + deletedAt: + type: string infoId: description: 主键 type: integer ipaddr: description: ip地址 type: string - isDel: - description: 是否删除 - type: string loginLocation: description: 归属地 type: string @@ -170,7 +141,6 @@ definitions: description: 系统 type: string params: - description: 参数 type: string platform: description: 固件 @@ -184,10 +154,9 @@ definitions: updateBy: description: 更新者 type: string - updateTime: - description: 更新时间 + updatedAt: type: string - userName: + username: description: 用户名 type: string type: object @@ -205,15 +174,17 @@ definitions: type: string createBy: type: string - createTime: + createdAt: type: string dataScope: type: string + deletedAt: + type: string icon: type: string is_select: type: boolean - isDel: + isFrame: type: string menuId: type: integer @@ -241,7 +212,7 @@ definitions: type: string updateBy: type: string - updateTime: + updatedAt: type: string visible: type: string @@ -250,14 +221,12 @@ definitions: properties: createBy: type: string - createTime: - description: 创建时间 + createdAt: type: string dataScope: type: string - isDel: - description: 是否删除 - type: integer + deletedAt: + type: string params: type: string postCode: @@ -265,9 +234,7 @@ definitions: type: string postId: description: 岗位编号 - example: 1 type: integer - x-description: 标示 postName: description: 岗位名称 type: string @@ -282,21 +249,42 @@ definitions: type: string updateBy: type: string - updateTime: - description: 最后修改时间 + updatedAt: type: string type: object - models.Response: + models.SysConfig: properties: - code: - description: 代码 - example: 200 + configId: + description: 编码 type: integer - data: - description: 数据集 - type: object - msg: - description: 错误消息 + configKey: + description: 参数键名 + type: string + configName: + description: 参数名称 + type: string + configType: + description: 是否系统内置 + type: string + configValue: + description: 参数键值 + type: string + createBy: + type: string + createdAt: + type: string + dataScope: + type: string + deletedAt: + type: string + params: + type: string + remark: + description: 备注 + type: string + updateBy: + type: string + updatedAt: type: string type: object models.SysOperLog: @@ -309,18 +297,16 @@ definitions: createBy: description: 创建人 type: string - createTime: - description: 创建时间 + createdAt: type: string dataScope: description: 数据 type: string + deletedAt: + type: string deptName: description: 部门名称 type: string - isDel: - description: 是否删除 - type: string jsonResult: description: 返回数据 type: string @@ -372,11 +358,10 @@ definitions: updateBy: description: 更新者 type: string - updateTime: - description: 更新时间 + updatedAt: type: string userAgent: - description: us + description: ua type: string type: object models.SysRole: @@ -385,18 +370,18 @@ definitions: type: boolean createBy: type: string - createTime: + createdAt: type: string dataScope: type: string + deletedAt: + type: string deptIds: items: type: integer type: array flag: type: string - isDel: - type: string menuIds: items: type: integer @@ -422,7 +407,7 @@ definitions: type: string updateBy: type: string - updateTime: + updatedAt: type: string type: object models.SysUser: @@ -432,19 +417,18 @@ definitions: type: string createBy: type: string - createTime: - description: 创建时间 + createdAt: type: string dataScope: type: string + deletedAt: + type: string deptId: description: 部门编码 type: integer email: description: 邮箱 type: string - isDel: - type: string nickName: description: 昵称 type: string @@ -475,8 +459,7 @@ definitions: type: string updateBy: type: string - updateTime: - description: 修改时间 + updatedAt: type: string userId: description: 编码 @@ -506,7 +489,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.Config' + $ref: '#/definitions/models.SysConfig' type: object responses: "200": @@ -547,7 +530,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 获取配置 @@ -566,7 +549,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 获取配置 @@ -600,12 +583,60 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 配置列表数据 tags: - 配置 + /api/v1/db/columns/page: + get: + description: 数据库表列分页列表 / database table column 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/app.Response' + summary: 分页列表数据 / page list data + tags: + - 工具 / Tools + /api/v1/db/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/app.Response' + summary: 分页列表数据 / page list data + tags: + - 工具 / Tools /api/v1/dept: post: consumes: @@ -672,7 +703,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 部门列表数据 @@ -715,7 +746,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 分页部门列表数据 @@ -732,7 +763,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.Config' + $ref: '#/definitions/models.DictType' type: object responses: "200": @@ -741,9 +772,9 @@ paths: type: string security: - Bearer: [] - summary: 添加配置 + summary: 添加字典数据 tags: - - 配置 + - 字典数据 put: consumes: - application/json @@ -795,7 +826,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 通过编码获取字典数据 @@ -829,7 +860,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 字典数据列表 @@ -848,7 +879,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 通过字典类型获取字典数据 @@ -928,7 +959,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 通过字典id获取字典类型 @@ -962,7 +993,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 字典类型列表数据 @@ -1042,7 +1073,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 通过编码获取登录日志 @@ -1076,7 +1107,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 登录日志列表 @@ -1295,7 +1326,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 通过编码获取登录日志 @@ -1346,7 +1377,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 登录日志列表 @@ -1372,7 +1403,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 职位列表数据 @@ -1452,7 +1483,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 获取字典数据 @@ -1486,7 +1517,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/models.Config' + $ref: '#/definitions/models.SysRole' type: object responses: "200": @@ -1561,7 +1592,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 角色列表数据 @@ -1585,29 +1616,6 @@ paths: summary: RoleMenu列表数据 tags: - 角色菜单 - post: - consumes: - - application/x-www-form-urlencoded - description: 获取JSON - parameters: - - description: role_id - in: formData - name: role_id - required: true - type: string - - description: menu_id - in: formData - name: menu_id - required: true - type: string - responses: - "200": - description: '{"code": -1, "message": "添加失败"}' - schema: - type: string - summary: 创建角色菜单 - tags: - - 角色菜单 /api/v1/rolemenu/{id}: delete: description: 删除数据 @@ -1629,6 +1637,107 @@ paths: summary: 删除用户菜单数据 tags: - 角色菜单 + /api/v1/sys/tables/info: + post: + consumes: + - application/json + description: 添加表结构 + parameters: + - description: tableName / 数据表名称 + in: query + name: tables + type: string + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 添加表结构 + tags: + - 工具 - 生成表 + put: + consumes: + - application/json + description: 修改表结构 + parameters: + - description: body + in: body + name: data + required: true + schema: + $ref: '#/definitions/models.Dept' + type: object + responses: + "200": + description: '{"code": -1, "message": "添加失败"}' + schema: + type: string + security: + - Bearer: [] + summary: 修改表结构 + tags: + - 工具 - 生成表 + /api/v1/sys/tables/info/{tableId}: + delete: + description: 删除表结构 + parameters: + - description: tableId + in: path + name: tableId + required: true + type: integer + responses: + "200": + description: '{"code": -1, "message": "删除失败"}' + schema: + type: string + summary: 删除表结构 + tags: + - 工具 - 生成表 + get: + description: 获取JSON + parameters: + - description: configKey + in: path + name: configKey + required: true + type: integer + responses: + "200": + description: '{"code": 200, "data": [...]}' + schema: + $ref: '#/definitions/app.Response' + security: + - "": [] + summary: 获取配置 + tags: + - 工具 - 生成表 + /api/v1/sys/tables/page: + get: + description: 生成表分页列表 + 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/app.Response' + summary: 分页列表数据 + tags: + - 工具 - 生成表 /api/v1/sysUser: get: description: 获取JSON @@ -1636,7 +1745,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 获取用户角色和职位 @@ -1675,7 +1784,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 获取用户 @@ -1736,30 +1845,6 @@ paths: summary: 修改用户数据 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: get: description: 获取JSON @@ -1767,7 +1852,7 @@ paths: "200": description: '{"code": 200, "data": [...]}' schema: - $ref: '#/definitions/models.Response' + $ref: '#/definitions/app.Response' security: - "": [] summary: 获取当前登录用户 @@ -1835,15 +1920,7 @@ paths: - text/html responses: "200": - description: 'OK - Load average: 2.39, 2.13, 1.97 | Cores: 2' - schema: - type: string - "429": - description: WARNING - schema: - type: string - "500": - description: CRITICAL + description: OK schema: type: string summary: CPU 使用量 @@ -1890,15 +1967,7 @@ paths: - text/html responses: "200": - description: 'OK - Free space: 455MB (0GB) / 8192MB (8GB) | Used: 5%' - schema: - type: string - "429": - description: WARNING - schema: - type: string - "500": - description: CRITICAL + description: OK schema: type: string summary: OS @@ -1911,15 +1980,7 @@ paths: - text/html responses: "200": - description: 'OK - Free space: 455MB (0GB) / 8192MB (8GB) | Used: 5%' - schema: - type: string - "429": - description: WARNING - schema: - type: string - "500": - description: CRITICAL + description: OK schema: type: string summary: 内存使用量 diff --git a/models/config.go b/models/config.go index a812444..cb8a19b 100644 --- a/models/config.go +++ b/models/config.go @@ -3,6 +3,7 @@ package models import ( orm "go-admin/database" "go-admin/tools" + _ "time" ) type SysConfig struct { diff --git a/models/dept.go b/models/dept.go index b7cb20c..a679fe9 100644 --- a/models/dept.go +++ b/models/dept.go @@ -3,6 +3,7 @@ package models import ( orm "go-admin/database" "go-admin/tools" + _ "time" ) type Dept struct { diff --git a/template/api.go.template b/template/api.go.template index 7e54117..06c3973 100644 --- a/template/api.go.template +++ b/template/api.go.template @@ -4,6 +4,7 @@ import ( "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "go-admin/models" + "go-admin/tools/app" "go-admin/pkg" "go-admin/utils" "net/http" diff --git a/template/js.go.template b/template/js.go.template new file mode 100644 index 0000000..9c7ca82 --- /dev/null +++ b/template/js.go.template @@ -0,0 +1,46 @@ +import request from '@/utils/request' + +// 查询参数列表 +export function list{{.ClassName}}(query) { +return request({ +url: '/api/v1/{{.ModuleName}}List', +method: 'get', +params: query +}) +} + +// 查询参数详细 +export function get{{.ClassName}} ({{.PkJsonField}}) { +return request({ +url: '/api/v1/{{.ModuleName}}/' + {{.PkJsonField}}, +method: 'get' +}) +} + + +// 新增参数配置 +export function add{{.ClassName}}(data) { +return request({ +url: '/api/v1/{{.ModuleName}}', +method: 'post', +data: data +}) +} + +// 修改参数配置 +export function update{{.ClassName}}(data) { +return request({ +url: '/api/v1/{{.ModuleName}}', +method: 'put', +data: data +}) +} + +// 删除参数配置 +export function del{{.ClassName}}({{.PkJsonField}}) { +return request({ +url: '/api/v1/{{.ModuleName}}/' + {{.PkJsonField}}, +method: 'delete' +}) +} + diff --git a/template/vue.go.template b/template/vue.go.template new file mode 100644 index 0000000..4173b5c --- /dev/null +++ b/template/vue.go.template @@ -0,0 +1,271 @@ + + + diff --git a/test/api.go.template b/test/api.go.template index a9595e0..ad50d11 100644 --- a/test/api.go.template +++ b/test/api.go.template @@ -81,7 +81,7 @@ func Get{{.ClassName}}(c *gin.Context) { // @Tags 配置 // @Accept application/json // @Product application/json -// @Param data body models.Config true "data" +// @Param data body models.{{.ClassName}} true "data" // @Success 200 {string} string "{"code": 200, "message": "添加成功"}" // @Success 200 {string} string "{"code": -1, "message": "添加失败"}" // @Router /api/v1/dict/data [post] diff --git a/tools/config/application.go b/tools/config/application.go index 91562e7..9a1bd86 100644 --- a/tools/config/application.go +++ b/tools/config/application.go @@ -3,7 +3,6 @@ package config import "github.com/spf13/viper" type Application struct { - IsInit bool ReadTimeout int WriterTimeout int Host string @@ -16,7 +15,6 @@ type Application struct { func InitApplication(cfg *viper.Viper) *Application { return &Application{ - IsInit: cfg.GetBool("isInit"), ReadTimeout: cfg.GetInt("readTimeout"), WriterTimeout: cfg.GetInt("writerTimeout"), Host: cfg.GetString("host"),