diff --git a/server/api/v1/exa_customer.go b/server/api/v1/exa_customer.go index b7021f77..bb244c41 100644 --- a/server/api/v1/exa_customer.go +++ b/server/api/v1/exa_customer.go @@ -95,7 +95,7 @@ func GetExaCustomer(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "获取权限客户列表" +// @Param data body request.PageInfo true "获取权限客户列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /customer/customerList [get] func GetExaCustomerList(c *gin.Context) { diff --git a/server/api/v1/exa_file_upload_download.go b/server/api/v1/exa_file_upload_download.go index 50253c28..2aeb468a 100644 --- a/server/api/v1/exa_file_upload_download.go +++ b/server/api/v1/exa_file_upload_download.go @@ -85,7 +85,7 @@ func DeleteFile(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取文件户列表" +// @Param data body request.PageInfo true "分页获取文件户列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /fileUploadAndDownload/getFileList [post] func GetFileList(c *gin.Context) { diff --git a/server/api/v1/sys_api.go b/server/api/v1/sys_api.go index 98198430..7fb6926a 100644 --- a/server/api/v1/sys_api.go +++ b/server/api/v1/sys_api.go @@ -55,7 +55,7 @@ func DeleteApi(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.SearchApiParams true "分页获取API列表" +// @Param data body request.SearchApiParams true "分页获取API列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getApiList [post] func GetApiList(c *gin.Context) { @@ -80,7 +80,7 @@ func GetApiList(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.GetById true "根据id获取api" +// @Param data body request.GetById true "根据id获取api" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /api/getApiById [post] func GetApiById(c *gin.Context) { diff --git a/server/api/v1/sys_authority.go b/server/api/v1/sys_authority.go index 48a845ad..7ce4a2fa 100644 --- a/server/api/v1/sys_authority.go +++ b/server/api/v1/sys_authority.go @@ -49,12 +49,31 @@ func DeleteAuthority(c *gin.Context) { } } +// @Tags authority +// @Summary 设置角色资源权限 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body model.SysAuthority true "设置角色资源权限" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Router /authority/updateAuthority [post] +func UpdateAuthority(c *gin.Context) { + var auth model.SysAuthority + _ = c.ShouldBindJSON(&auth) + err, authority := service.UpdateAuthority(auth) + if err != nil { + response.FailWithMessage(fmt.Sprintf("更新失败,%v", err), c) + } else { + response.OkWithData(resp.SysAuthorityResponse{authority}, c) + } +} + // @Tags authority // @Summary 分页获取角色列表 // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取用户列表" +// @Param data body request.PageInfo true "分页获取用户列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /authority/getAuthorityList [post] func GetAuthorityList(c *gin.Context) { diff --git a/server/api/v1/sys_casbin.go b/server/api/v1/sys_casbin.go index 11e4d41a..c6f7a3e1 100644 --- a/server/api/v1/sys_casbin.go +++ b/server/api/v1/sys_casbin.go @@ -14,7 +14,7 @@ import ( // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.CasbinInReceive true "更改角色api权限" +// @Param data body request.CasbinInReceive true "更改角色api权限" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/UpdateCasbin [post] func UpdateCasbin(c *gin.Context) { @@ -33,7 +33,7 @@ func UpdateCasbin(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.CasbinInReceive true "获取权限列表" +// @Param data body request.CasbinInReceive true "获取权限列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/getPolicyPathByAuthorityId [post] func GetPolicyPathByAuthorityId(c *gin.Context) { @@ -48,7 +48,7 @@ func GetPolicyPathByAuthorityId(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.CasbinInReceive true "获取权限列表" +// @Param data body request.CasbinInReceive true "获取权限列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /casbin/CasbinTest [get] func CasbinTest(c *gin.Context) { diff --git a/server/api/v1/sys_menu.go b/server/api/v1/sys_menu.go index e131de24..bd421e18 100644 --- a/server/api/v1/sys_menu.go +++ b/server/api/v1/sys_menu.go @@ -14,7 +14,7 @@ import ( // @Summary 获取用户动态路由 // @Security ApiKeyAuth // @Produce application/json -// @Param data body api.RegisterAndLoginStruct true "可以什么都不填" +// @Param data body request.RegisterAndLoginStruct true "可以什么都不填" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /menu/getMenu [post] func GetMenu(c *gin.Context) { @@ -33,7 +33,7 @@ func GetMenu(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取基础menu列表" +// @Param data body request.PageInfo true "分页获取基础menu列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/getMenuList [post] func GetMenuList(c *gin.Context) { @@ -75,7 +75,7 @@ func AddBaseMenu(c *gin.Context) { // @Summary 获取用户动态路由 // @Security ApiKeyAuth // @Produce application/json -// @Param data body api.RegisterAndLoginStruct true "可以什么都不填" +// @Param data body request.RegisterAndLoginStruct true "可以什么都不填" // @Success 200 {string} string "{"success":true,"data":{},"msg":"返回成功"}" // @Router /menu/getBaseMenuTree [post] func GetBaseMenuTree(c *gin.Context) { @@ -84,7 +84,6 @@ func GetBaseMenuTree(c *gin.Context) { response.FailWithMessage(fmt.Sprintf("获取失败,%v", err), c) } else { response.OkWithData(resp.SysBaseMenusResponse{Menus: menus}, c) - } } @@ -93,7 +92,7 @@ func GetBaseMenuTree(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.AddMenuAuthorityInfo true "增加menu和角色关联关系" +// @Param data body request.AddMenuAuthorityInfo true "增加menu和角色关联关系" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/addMenuAuthority [post] func AddMenuAuthority(c *gin.Context) { @@ -113,7 +112,7 @@ func AddMenuAuthority(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.AuthorityIdInfo true "增加menu和角色关联关系" +// @Param data body request.AuthorityIdInfo true "增加menu和角色关联关系" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/GetMenuAuthority [post] func GetMenuAuthority(c *gin.Context) { @@ -132,7 +131,7 @@ func GetMenuAuthority(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.GetById true "删除菜单" +// @Param data body request.GetById true "删除菜单" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/deleteBaseMenu [post] func DeleteBaseMenu(c *gin.Context) { @@ -171,7 +170,7 @@ func UpdateBaseMenu(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.GetById true "根据id获取菜单" +// @Param data body request.GetById true "根据id获取菜单" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /menu/getBaseMenuById [post] func GetBaseMenuById(c *gin.Context) { diff --git a/server/api/v1/sys_user.go b/server/api/v1/sys_user.go index b1266adf..146a5291 100644 --- a/server/api/v1/sys_user.go +++ b/server/api/v1/sys_user.go @@ -44,7 +44,7 @@ func Register(c *gin.Context) { // @Tags Base // @Summary 用户登录 // @Produce application/json -// @Param data body model.RegisterAndLoginStruct true "用户登录接口" +// @Param data body request.RegisterAndLoginStruct true "用户登录接口" // @Success 200 {string} string "{"success":true,"data":{},"msg":"登陆成功"}" // @Router /base/login [post] func Login(c *gin.Context) { @@ -133,7 +133,7 @@ func tokenNext(c *gin.Context, user model.SysUser) { // @Summary 用户修改密码 // @Security ApiKeyAuth // @Produce application/json -// @Param data body model.ChangePasswordStutrc true "用户修改密码" +// @Param data body request.ChangePasswordStruct true "用户修改密码" // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" // @Router /user/changePassword [put] func ChangePassword(c *gin.Context) { @@ -192,7 +192,7 @@ func UploadHeaderImg(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取用户列表" +// @Param data body request.PageInfo true "分页获取用户列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /user/getUserList [post] func GetUserList(c *gin.Context) { @@ -216,7 +216,7 @@ func GetUserList(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.SetUserAuth true "设置用户权限" +// @Param data body request.SetUserAuth true "设置用户权限" // @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" // @Router /user/setUserAuthority [post] func SetUserAuthority(c *gin.Context) { @@ -229,3 +229,22 @@ func SetUserAuthority(c *gin.Context) { response.OkWithMessage("修改成功", c) } } + +// @Tags SysUser +// @Summary 删除用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.SetUserAuth true "删除用户" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Router /user/deleteUser [delete] +func DeleteUser(c *gin.Context) { + var reqId request.GetById + _ = c.ShouldBindJSON(&reqId) + err := service.DeleteUser(reqId.Id) + if err != nil { + response.FailWithMessage(fmt.Sprintf("删除失败,%v", err), c) + } else { + response.OkWithMessage("删除成功", c) + } +} diff --git a/server/api/v1/sys_work_flow.go b/server/api/v1/sys_work_flow.go index 530d9679..9e59c715 100644 --- a/server/api/v1/sys_work_flow.go +++ b/server/api/v1/sys_work_flow.go @@ -11,7 +11,7 @@ import ( // @Tags workflow // @Summary 注册工作流 // @Produce application/json -// @Param data body sysModel.SysWorkflow true "注册工作流接口" +// @Param data body model.SysWorkflow true "注册工作流接口" // @Success 200 {string} string "{"success":true,"data":{},"msg":"注册成功"}" // @Router /workflow/createWorkFlow [post] func CreateWorkFlow(c *gin.Context) { diff --git a/server/db/qmplus.sql b/server/db/qmplus.sql index 85ed7bd4..6c5b0eac 100644 --- a/server/db/qmplus.sql +++ b/server/db/qmplus.sql @@ -11,7 +11,7 @@ Target Server Version : 50644 File Encoding : 65001 - Date: 13/04/2020 09:48:03 + Date: 15/04/2020 17:48:50 */ SET NAMES utf8mb4; @@ -125,6 +125,7 @@ INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/createAuthority', 'POS INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/deleteAuthority', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/getAuthorityList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/setDataAuthority', 'POST', '', '', ''); +INSERT INTO `casbin_rule` VALUES ('p', '888', '/authority/updateAuthority', 'PUT', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenu', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/getMenuList', 'POST', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/menu/addBaseMenu', 'POST', '', '', ''); @@ -154,28 +155,6 @@ INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'DELETE', '' INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customer', 'GET', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/customer/customerList', 'GET', '', '', ''); INSERT INTO `casbin_rule` VALUES ('p', '888', '/autoCode/createTemp', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/base/login', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/base/register', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/createApi', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/getApiList', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/getApiById', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/deleteApi', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/updateApi', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/getAllApis', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/api/createApi', 'GET', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/createAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/deleteAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/getAuthorityList', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/authority/setDataAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getMenuList', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/addBaseMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getBaseMenuTree', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/addMenuAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getMenuAuthority', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/deleteBaseMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/updateBaseMenu', 'POST', '', '', ''); -INSERT INTO `casbin_rule` VALUES ('p', 'asdasd', '/menu/getBaseMenuById', 'POST', '', '', ''); -- ---------------------------- -- Table structure for ch_cities @@ -3835,7 +3814,7 @@ CREATE TABLE `exa_file_chunks` ( `file_chunk_number` int(11) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_exa_file_chunks_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Table structure for exa_file_upload_and_downloads @@ -3855,15 +3834,6 @@ CREATE TABLE `exa_file_upload_and_downloads` ( INDEX `idx_exa_file_upload_and_downloads_deleted_at`(`deleted_at`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; --- ---------------------------- --- Records of exa_file_upload_and_downloads --- ---------------------------- -INSERT INTO `exa_file_upload_and_downloads` VALUES (7, '2019-10-26 22:46:32', '2019-10-26 22:46:32', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572101191logo.png', 'png', '1572101191logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (10, '2019-10-26 23:10:44', '2019-10-26 23:10:44', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572102643logo.png', 'png', '1572102643logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (12, '2019-10-26 23:14:08', '2019-10-26 23:14:08', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572102846logo.png', 'png', '1572102846logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (13, '2019-10-26 23:18:17', '2019-10-26 23:18:17', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1572103096logo.png', 'png', '1572103096logo.png'); -INSERT INTO `exa_file_upload_and_downloads` VALUES (15, '2019-12-15 14:31:00', '2019-12-15 14:31:00', NULL, 'logo.png', 'http://qmplusimg.henrongyi.top/1576391451logo.png', 'png', '1576391451logo.png'); - -- ---------------------------- -- Table structure for exa_files -- ---------------------------- @@ -3880,7 +3850,7 @@ CREATE TABLE `exa_files` ( `is_finish` tinyint(1) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_exa_files_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Table structure for jwt_blacklists @@ -3894,7 +3864,7 @@ CREATE TABLE `jwt_blacklists` ( `jwt` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_jwt_blacklists_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 39 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of jwt_blacklists @@ -3935,6 +3905,14 @@ INSERT INTO `jwt_blacklists` VALUES (35, '2020-01-06 16:59:26', '2020-01-06 16:5 INSERT INTO `jwt_blacklists` VALUES (36, '2020-03-21 14:46:14', '2020-03-21 14:46:14', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg1Mzc3ODY3LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODQ3NzIwNjd9.DLhWhD1FdcWLyFLcXQynKJnenbVHrSiKhlDGFRzgo5k'); INSERT INTO `jwt_blacklists` VALUES (37, '2020-03-31 14:24:35', '2020-03-31 14:24:35', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MTM4MTA4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU1MzIzMDh9.Ro2F2dZLfOk2Z_OPRbweOuCpchr6HlHfQIF5qjfc8y4'); INSERT INTO `jwt_blacklists` VALUES (38, '2020-04-01 16:07:57', '2020-04-01 16:07:57', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg2MjQwNzQyLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODU2MzQ5NDJ9.9qaOFu7D5cq4vxTfLi4pyO_JGcKjVAEJIcoStJWJlYg'); +INSERT INTO `jwt_blacklists` VALUES (39, '2020-04-15 16:30:41', '2020-04-15 16:30:41', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3MDk1Njg5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY0ODk4ODl9.-cNmRAyqhylZlzakwoFY08x7RnjI3CiWTiQc_Iabb-c'); +INSERT INTO `jwt_blacklists` VALUES (40, '2020-04-15 16:39:26', '2020-04-15 16:39:26', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ0MjUwLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5Mzg0NTB9.smVP-Rl1EkAuUVqXW7z0mpxA5O86vXj0oH4FukG-NVA'); +INSERT INTO `jwt_blacklists` VALUES (41, '2020-04-15 17:08:06', '2020-04-15 17:08:06', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ0NzgxLCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5Mzg5ODF9.OMZ08Y8aPuj40-NGEQ402LyRFBpkLWzzaqD3_tvj1h8'); +INSERT INTO `jwt_blacklists` VALUES (42, '2020-04-15 17:08:28', '2020-04-15 17:08:28', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NDk0LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA2OTR9.9lsoTbZrwhZ8kMXiH-Ta3A4h_yp7SwLj57mo_u5mrk4'); +INSERT INTO `jwt_blacklists` VALUES (43, '2020-04-15 17:10:24', '2020-04-15 17:10:24', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NTE1LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA3MTV9.5SrUrUmd4YhzlGmSpA9xJW_wbjV6yI6ty_NriIceOQo'); +INSERT INTO `jwt_blacklists` VALUES (44, '2020-04-15 17:11:43', '2020-04-15 17:11:43', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NjI5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA4Mjl9.SFiomEpOshboOe0JGDa1HlJt5aQIF7IeyOsoDwl1o8E'); +INSERT INTO `jwt_blacklists` VALUES (45, '2020-04-15 17:12:54', '2020-04-15 17:12:54', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2NzE4LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA5MTh9.xrwEknZQN2J3poarMTQvb7mX1Icicz2_f60kw36g9og'); +INSERT INTO `jwt_blacklists` VALUES (46, '2020-04-15 17:14:47', '2020-04-15 17:14:47', NULL, 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVVUlEIjoiY2UwZDY2ODUtYzE1Zi00MTI2LWE1YjQtODkwYmM5ZDIzNTZkIiwiSUQiOjEwLCJOaWNrTmFtZSI6Iui2hee6p-euoeeQhuWRmCIsIkF1dGhvcml0eUlkIjoiODg4IiwiZXhwIjoxNTg3NTQ2Nzg5LCJpc3MiOiJxbVBsdXMiLCJuYmYiOjE1ODY5NDA5ODl9.3jbdl1N0KA8ExFMWXHi3ha4aESKq8yDKDgpSH4Xdsnk'); -- ---------------------------- -- Table structure for sys_apis @@ -3953,7 +3931,7 @@ CREATE TABLE `sys_apis` ( PRIMARY KEY (`id`) USING BTREE, INDEX `idx_apis_deleted_at`(`deleted_at`) USING BTREE, INDEX `idx_sys_apis_deleted_at`(`deleted_at`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 46 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; +) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Compact; -- ---------------------------- -- Records of sys_apis @@ -3999,6 +3977,7 @@ INSERT INTO `sys_apis` VALUES (42, '2020-02-25 15:36:48', '2020-02-25 15:37:16', INSERT INTO `sys_apis` VALUES (43, '2020-02-25 15:37:06', '2020-02-25 15:37:06', NULL, NULL, '/customer/customerList', '获取客户列表', 'customer', 'GET'); INSERT INTO `sys_apis` VALUES (44, '2020-03-12 14:36:54', '2020-03-12 14:56:50', NULL, NULL, '/casbin/casbinTest/:pathParam', 'RESTFUL模式测试', 'casbin', 'GET'); INSERT INTO `sys_apis` VALUES (45, '2020-03-29 23:01:28', '2020-03-29 23:01:28', NULL, NULL, '/autoCode/createTemp', '自动化代码', 'autoCode', 'POST'); +INSERT INTO `sys_apis` VALUES (46, '2020-04-15 12:46:58', '2020-04-15 12:46:58', NULL, NULL, '/authority/updateAuthority', '更新角色信息', 'authority', 'PUT'); -- ---------------------------- -- Table structure for sys_authorities @@ -4019,7 +3998,7 @@ CREATE TABLE `sys_authorities` ( -- ---------------------------- -- Records of sys_authorities -- ---------------------------- -INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', NULL, NULL); +INSERT INTO `sys_authorities` VALUES ('888', '普通用户', '0', '2020-04-04 11:44:56', '2020-04-15 13:15:24', NULL); INSERT INTO `sys_authorities` VALUES ('8881', '普通用户子角色', '888', '2020-04-04 11:44:56', NULL, NULL); INSERT INTO `sys_authorities` VALUES ('9528', '测试角色', '0', '2020-04-04 11:44:56', NULL, NULL); @@ -4104,6 +4083,8 @@ CREATE TABLE `sys_base_menus` ( `icon` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `nick_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, `sort` int(255) NULL DEFAULT NULL, + `keep_alive` tinyint(1) NULL DEFAULT NULL, + `default_menu` tinyint(1) NULL DEFAULT NULL, PRIMARY KEY (`id`) USING BTREE, INDEX `idx_base_menus_deleted_at`(`deleted_at`) USING BTREE, INDEX `idx_sys_base_menus_deleted_at`(`deleted_at`) USING BTREE @@ -4112,26 +4093,26 @@ CREATE TABLE `sys_base_menus` ( -- ---------------------------- -- Records of sys_base_menus -- ---------------------------- -INSERT INTO `sys_base_menus` VALUES (1, '2019-09-19 22:05:18', '2020-04-07 21:48:04', NULL, 0, 0, 'dashboard', 'dashboard', 0, 'view/dashboard/index.vue', '仪表盘', 'setting', '仪表盘', 1); -INSERT INTO `sys_base_menus` VALUES (2, '2019-09-19 22:06:17', '2020-03-27 20:33:58', NULL, 0, 0, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', '测试菜单', 2); -INSERT INTO `sys_base_menus` VALUES (3, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 0, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', '超级管理员', 3); -INSERT INTO `sys_base_menus` VALUES (4, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 3, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', '角色管理', 1); -INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 3, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', '菜单管理', 2); -INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2019-12-12 16:57:30', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', 3); -INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', 4); -INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', '个人信息', 4); -INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-03-29 21:39:18', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6); -INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', 1); -INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', 2); -INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', 3); -INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', 4); -INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', 5); -INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', 6); -INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-03-27 20:10:02', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7); -INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', 5); -INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', 1); -INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2); -INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', 3); +INSERT INTO `sys_base_menus` VALUES (1, '2019-09-19 22:05:18', '2020-04-07 21:48:04', NULL, 0, 0, 'dashboard', 'dashboard', 0, 'view/dashboard/index.vue', '仪表盘', 'setting', '仪表盘', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (2, '2019-09-19 22:06:17', '2020-04-15 17:22:51', NULL, 0, 0, 'test', 'test', 0, 'view/test/index.vue', '测试菜单', 'info', '测试菜单', 2, 0, 0); +INSERT INTO `sys_base_menus` VALUES (3, '2019-09-19 22:06:38', '2019-12-12 16:51:31', NULL, 0, 0, 'admin', 'superAdmin', 0, 'view/superAdmin/index.vue', '超级管理员', 'user-solid', '超级管理员', 3, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (4, '2019-09-19 22:11:53', '2019-09-19 22:11:53', NULL, 0, 3, 'authority', 'authority', 0, 'view/superAdmin/authority/authority.vue', '角色管理', 's-custom', '角色管理', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (5, '2019-09-19 22:13:18', '2019-12-12 16:57:20', NULL, 0, 3, 'menu', 'menu', 0, 'view/superAdmin/menu/menu.vue', '菜单管理', 's-order', '菜单管理', 2, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (6, '2019-09-19 22:13:36', '2020-04-15 17:37:39', NULL, 0, 3, 'api', 'api', 0, 'view/superAdmin/api/api.vue', 'api管理', 's-platform', 'api管理', 3, 1, 0); +INSERT INTO `sys_base_menus` VALUES (17, '2019-10-09 15:12:29', '2019-12-12 16:57:25', NULL, 0, 3, 'user', 'user', 0, 'view/superAdmin/user/user.vue', '用户管理', 'coordinate', '用户管理', 4, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (18, '2019-10-15 22:27:22', '2019-12-12 16:51:33', NULL, 0, 0, 'person', 'person', 1, 'view/person/person.vue', '个人信息', 'user-solid', '个人信息', 4, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (19, '2019-10-20 11:14:42', '2020-04-15 16:35:28', NULL, 0, 0, 'example', 'example', 0, 'view/example/index.vue', '示例文件', 's-management', '示例文件', 6, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (20, '2019-10-20 11:18:11', '2019-10-20 11:18:11', NULL, 0, 19, 'table', 'table', 0, 'view/example/table/table.vue', '表格示例', 's-order', '表格示例', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (21, '2019-10-20 11:19:52', '2019-12-12 16:58:15', NULL, 0, 19, 'form', 'form', 0, 'view/example/form/form.vue', '表单示例', 'document', '表单示例', 2, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (22, '2019-10-20 11:22:19', '2019-12-12 16:58:20', NULL, 0, 19, 'rte', 'rte', 0, 'view/example/rte/rte.vue', '富文本编辑器', 'reading', '富文本编辑器', 3, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (23, '2019-10-20 11:23:39', '2019-12-12 16:58:23', NULL, 0, 19, 'excel', 'excel', 0, 'view/example/excel/excel.vue', 'excel导入导出', 's-marketing', 'excel导入导出', 4, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (26, '2019-10-20 11:27:02', '2019-12-12 16:58:27', NULL, 0, 19, 'upload', 'upload', 0, 'view/example/upload/upload.vue', '上传下载', 'upload', '上传下载', 5, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (33, '2020-02-17 16:20:47', '2020-02-24 19:45:40', NULL, 0, 19, 'breakpoint', 'breakpoint', 0, 'view/example/breakpoint/breakpoint.vue', '断点续传', 'upload', '断点续传', 6, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (34, '2020-02-24 19:48:37', '2020-04-15 16:26:21', NULL, 0, 19, 'customer', 'customer', 0, 'view/example/customer/customer.vue', '客户列表(资源示例)', 's-custom', '客户列表(资源示例)', 7, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (38, '2020-03-29 21:31:03', '2020-03-29 21:31:03', NULL, 0, 0, 'systemTools', 'systemTools', 0, 'view/systemTools/index.vue', '系统工具', 's-cooperation', '系统工具', 5, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (40, '2020-03-29 21:35:10', '2020-03-29 21:35:10', NULL, 0, 38, 'autoCode', 'autoCode', 0, 'view/systemTools/autoCode/index.vue', '代码生成器', 'cpu', '代码生成器', 1, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (41, '2020-03-29 21:36:26', '2020-03-29 21:36:26', NULL, 0, 38, 'formCreate', 'formCreate', 0, 'view/systemTools/formCreate/index.vue', '表单生成器', 'magic-stick', '表单生成器', 2, NULL, NULL); +INSERT INTO `sys_base_menus` VALUES (42, '2020-04-02 14:19:36', '2020-04-02 14:20:16', NULL, 0, 38, 'system', 'system', 0, 'view/systemTools/system/system.vue', '系统配置', 's-operation', '系统配置', 3, NULL, NULL); -- ---------------------------- -- Table structure for sys_data_authority_id @@ -4232,6 +4213,6 @@ INSERT INTO `sys_workflows` VALUES (8, '2019-12-09 15:20:21', '2019-12-09 15:20: -- View structure for authority_menu -- ---------------------------- DROP VIEW IF EXISTS `authority_menu`; -CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`localhost` SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id` from (`sys_authority_menus` join `sys_base_menus` on((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`))); +CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`localhost` SQL SECURITY DEFINER VIEW `authority_menu` AS select `sys_base_menus`.`id` AS `id`,`sys_base_menus`.`created_at` AS `created_at`,`sys_base_menus`.`updated_at` AS `updated_at`,`sys_base_menus`.`deleted_at` AS `deleted_at`,`sys_base_menus`.`menu_level` AS `menu_level`,`sys_base_menus`.`parent_id` AS `parent_id`,`sys_base_menus`.`path` AS `path`,`sys_base_menus`.`name` AS `name`,`sys_base_menus`.`hidden` AS `hidden`,`sys_base_menus`.`component` AS `component`,`sys_base_menus`.`title` AS `title`,`sys_base_menus`.`icon` AS `icon`,`sys_base_menus`.`nick_name` AS `nick_name`,`sys_base_menus`.`sort` AS `sort`,`sys_authority_menus`.`sys_authority_authority_id` AS `authority_id`,`sys_authority_menus`.`sys_base_menu_id` AS `menu_id`,`sys_base_menus`.`keep_alive` AS `keep_alive`,`sys_base_menus`.`default_menu` AS `default_menu` from (`sys_authority_menus` join `sys_base_menus` on((`sys_authority_menus`.`sys_base_menu_id` = `sys_base_menus`.`id`))); SET FOREIGN_KEY_CHECKS = 1; diff --git a/server/docs/docs.go b/server/docs/docs.go index 6052e82f..766d7c9c 100644 --- a/server/docs/docs.go +++ b/server/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-17 15:18:08.5115326 +0800 CST m=+0.098737601 +// 2020-04-15 09:37:13.5084762 +0800 CST m=+0.126566601 package docs @@ -51,7 +51,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateApiParams" + "$ref": "#/definitions/model.SysApi" } } ], @@ -90,7 +90,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysApi" + "$ref": "#/definitions/model.SysApi" } } ], @@ -150,13 +150,13 @@ var doc = `{ "summary": "根据id获取api", "parameters": [ { - "description": "分页获取用户列表", + "description": "根据id获取api", "name": "data", "in": "body", "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.GetById" } } ], @@ -195,7 +195,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.SearchApiParams" } } ], @@ -234,7 +234,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateApiParams" + "$ref": "#/definitions/model.SysApi" } } ], @@ -273,7 +273,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/model.SysAuthority" } } ], @@ -312,7 +312,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.DeleteAuthorityPatams" + "$ref": "#/definitions/model.SysAuthority" } } ], @@ -351,7 +351,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -390,7 +390,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" } } ], @@ -404,6 +404,45 @@ var doc = `{ } } }, + "/autoCode/createTemp": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "自动代码模板", + "parameters": [ + { + "description": "创建自动代码", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/model.AutoCodeStruct" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/base/captcha": { "post": { "security": [ @@ -475,7 +514,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegisterAndLoginStruct" + "$ref": "#/definitions/request.RegisterAndLoginStruct" } } ], @@ -506,7 +545,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysUser" + "$ref": "#/definitions/model.SysUser" } } ], @@ -545,7 +584,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/request.CasbinInReceive" } } ], @@ -584,7 +623,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.CasbinInReceive" + "$ref": "#/definitions/request.CasbinInReceive" } } ], @@ -623,7 +662,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/request.CasbinInReceive" } } ], @@ -637,7 +676,81 @@ var doc = `{ } } }, - "/customer/createExaCustomer": { + "/customer/customer": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "获取单一客户信息", + "parameters": [ + { + "description": "获取单一客户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/model.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + }, + "put": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "更新客户信息", + "parameters": [ + { + "description": "创建客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/model.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + }, "post": { "security": [ { @@ -662,7 +775,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" + "$ref": "#/definitions/model.ExaCustomer" } } ], @@ -674,10 +787,8 @@ var doc = `{ } } } - } - }, - "/customer/deleteExaCustomer": { - "post": { + }, + "delete": { "security": [ { "ApiKeyAuth": [] @@ -701,7 +812,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" + "$ref": "#/definitions/model.ExaCustomer" } } ], @@ -715,47 +826,8 @@ var doc = `{ } } }, - "/customer/getExaCustomer": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "SysApi" - ], - "summary": "获取单一客户信息", - "parameters": [ - { - "description": "获取单一客户信息", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" - } - } - ], - "responses": { - "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/customer/getExaCustomerList": { - "post": { + "/customer/customerList": { + "get": { "security": [ { "ApiKeyAuth": [] @@ -779,46 +851,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" - } - } - ], - "responses": { - "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/customer/updateExaCustomer": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "SysApi" - ], - "summary": "更新客户信息", - "parameters": [ - { - "description": "创建客户", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -852,7 +885,7 @@ var doc = `{ "parameters": [ { "type": "file", - "description": "断点续传示例", + "description": "an example for breakpoint resume, 断点续传示例", "name": "file", "in": "formData", "required": true @@ -890,7 +923,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaFileUploadAndDownload" + "$ref": "#/definitions/model.ExaFileUploadAndDownload" } } ], @@ -924,7 +957,7 @@ var doc = `{ "parameters": [ { "type": "file", - "description": "查找文件", + "description": "上传文件完成", "name": "file", "in": "formData", "required": true @@ -932,7 +965,7 @@ var doc = `{ ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"查找成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"file uploaded, 文件创建成功\"}", "schema": { "type": "string" } @@ -965,7 +998,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -999,7 +1032,7 @@ var doc = `{ "parameters": [ { "type": "file", - "description": "查找文件", + "description": "删除缓存切片", "name": "file", "in": "formData", "required": true @@ -1078,6 +1111,45 @@ var doc = `{ } } }, + "/menu/GetMenuAuthority": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "authorityAndMenu" + ], + "summary": "获取指定角色menu", + "parameters": [ + { + "description": "增加menu和角色关联关系", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/request.AuthorityIdInfo" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/menu/addBaseMenu": { "post": { "security": [ @@ -1103,7 +1175,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysBaseMenu" + "$ref": "#/definitions/model.SysBaseMenu" } } ], @@ -1133,7 +1205,7 @@ var doc = `{ "tags": [ "authorityAndMenu" ], - "summary": "获取指定角色menu", + "summary": "增加menu和角色关联关系", "parameters": [ { "description": "增加menu和角色关联关系", @@ -1142,7 +1214,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.AuthorityIdInfo" + "$ref": "#/definitions/request.AddMenuAuthorityInfo" } } ], @@ -1181,7 +1253,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.IdInfo" + "$ref": "#/definitions/request.GetById" } } ], @@ -1220,7 +1292,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.GetById" + "$ref": "#/definitions/request.GetById" } } ], @@ -1256,7 +1328,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegisterAndLoginStruct" + "$ref": "#/definitions/request.RegisterAndLoginStruct" } } ], @@ -1292,7 +1364,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegisterAndLoginStruct" + "$ref": "#/definitions/request.RegisterAndLoginStruct" } } ], @@ -1331,7 +1403,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -1345,7 +1417,7 @@ var doc = `{ } } }, - "/menu/updateBaseMen": { + "/menu/updateBaseMenu": { "post": { "security": [ { @@ -1370,7 +1442,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysBaseMenu" + "$ref": "#/definitions/model.SysBaseMenu" } } ], @@ -1406,7 +1478,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.System" + "$ref": "#/definitions/model.System" } } ], @@ -1466,7 +1538,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.System" + "$ref": "#/definitions/model.System" } } ], @@ -1481,7 +1553,7 @@ var doc = `{ } }, "/user/changePassword": { - "post": { + "put": { "security": [ { "ApiKeyAuth": [] @@ -1502,7 +1574,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.ChangePasswordStutrc" + "$ref": "#/definitions/request.ChangePasswordStruct" } } ], @@ -1541,7 +1613,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -1580,7 +1652,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.SetUserAuth" + "$ref": "#/definitions/request.SetUserAuth" } } ], @@ -1654,7 +1726,7 @@ var doc = `{ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysWorkflow" + "$ref": "#/definitions/model.SysWorkflow" } } ], @@ -1670,154 +1742,28 @@ var doc = `{ } }, "definitions": { - "api.AddMenuAuthorityInfo": { + "config.Captcha": { "type": "object", "properties": { - "authorityId": { - "type": "string" + "imgHeight": { + "type": "integer" }, - "menus": { - "type": "array", - "items": { - "$ref": "#/definitions/sysModel.SysBaseMenu" - } - } - } - }, - "api.AuthorityIdInfo": { - "type": "object", - "properties": { - "authorityId": { - "type": "string" - } - } - }, - "api.ChangePasswordStutrc": { - "type": "object", - "properties": { - "newPassword": { - "type": "string" + "imgWidth": { + "type": "integer" }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "api.CreateApiParams": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "path": { - "type": "string" - } - } - }, - "api.CreateAuthorityParams": { - "type": "object", - "properties": { - "authorityId": { - "type": "string" - }, - "authorityName": { - "type": "string" - } - } - }, - "api.DeleteAuthorityPatams": { - "type": "object", - "properties": { - "authorityId": { + "keyLong": { "type": "integer" } } }, - "api.GetById": { - "type": "object", - "properties": { - "id": { - "type": "number" - } - } - }, - "api.IdInfo": { - "type": "object", - "properties": { - "id": { - "type": "number" - } - } - }, - "api.RegisterAndLoginStruct": { - "type": "object", - "properties": { - "captcha": { - "type": "string" - }, - "captchaId": { - "type": "string" - }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "api.SetUserAuth": { - "type": "object", - "properties": { - "authorityId": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - }, - "config.CasbinConfig": { + "config.Casbin": { "type": "object", "properties": { "modelPath": { - "description": "casbin model地址配置", "type": "string" } } }, - "config.Config": { - "type": "object", - "properties": { - "casbinConfig": { - "type": "object", - "$ref": "#/definitions/config.CasbinConfig" - }, - "jwt": { - "type": "object", - "$ref": "#/definitions/config.JWT" - }, - "mysqlAdmin": { - "type": "object", - "$ref": "#/definitions/config.MysqlAdmin" - }, - "qiniu": { - "type": "object", - "$ref": "#/definitions/config.Qiniu" - }, - "redisAdmin": { - "type": "object", - "$ref": "#/definitions/config.RedisAdmin" - }, - "system": { - "type": "object", - "$ref": "#/definitions/config.System" - } - } - }, "config.JWT": { "type": "object", "properties": { @@ -1826,7 +1772,24 @@ var doc = `{ } } }, - "config.MysqlAdmin": { + "config.Log": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "logFile": { + "type": "boolean" + }, + "prefix": { + "type": "string" + }, + "stdout": { + "type": "string" + } + } + }, + "config.Mysql": { "type": "object", "properties": { "config": { @@ -1835,6 +1798,15 @@ var doc = `{ "dbname": { "type": "string" }, + "logMode": { + "type": "boolean" + }, + "maxIdleConns": { + "type": "integer" + }, + "maxOpenConns": { + "type": "integer" + }, "password": { "type": "string" }, @@ -1857,7 +1829,7 @@ var doc = `{ } } }, - "config.RedisAdmin": { + "config.Redis": { "type": "object", "properties": { "addr": { @@ -1871,12 +1843,76 @@ var doc = `{ } } }, + "config.Server": { + "type": "object", + "properties": { + "captcha": { + "type": "object", + "$ref": "#/definitions/config.Captcha" + }, + "casbin": { + "type": "object", + "$ref": "#/definitions/config.Casbin" + }, + "jwt": { + "type": "object", + "$ref": "#/definitions/config.JWT" + }, + "log": { + "type": "object", + "$ref": "#/definitions/config.Log" + }, + "mysql": { + "type": "object", + "$ref": "#/definitions/config.Mysql" + }, + "qiniu": { + "type": "object", + "$ref": "#/definitions/config.Qiniu" + }, + "redis": { + "type": "object", + "$ref": "#/definitions/config.Redis" + }, + "sqlite": { + "type": "object", + "$ref": "#/definitions/config.Sqlite" + }, + "system": { + "type": "object", + "$ref": "#/definitions/config.System" + } + } + }, + "config.Sqlite": { + "type": "object", + "properties": { + "config": { + "type": "string" + }, + "logMode": { + "type": "boolean" + }, + "password": { + "type": "string" + }, + "path": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "config.System": { "type": "object", "properties": { "addr": { "type": "integer" }, + "dbType": { + "type": "string" + }, "env": { "type": "string" }, @@ -1885,7 +1921,27 @@ var doc = `{ } } }, - "dbModel.ExaCustomer": { + "model.AutoCodeStruct": { + "type": "object", + "properties": { + "abbreviation": { + "type": "string" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Field" + } + }, + "packageName": { + "type": "string" + }, + "structName": { + "type": "string" + } + } + }, + "model.ExaCustomer": { "type": "object", "properties": { "customerName": { @@ -1896,7 +1952,7 @@ var doc = `{ }, "sysUser": { "type": "object", - "$ref": "#/definitions/sysModel.SysUser" + "$ref": "#/definitions/model.SysUser" }, "sysUserAuthorityID": { "type": "string" @@ -1906,7 +1962,7 @@ var doc = `{ } } }, - "dbModel.ExaFileUploadAndDownload": { + "model.ExaFileUploadAndDownload": { "type": "object", "properties": { "key": { @@ -1923,51 +1979,32 @@ var doc = `{ } } }, - "model.PageInfo": { + "model.Field": { "type": "object", "properties": { - "page": { - "type": "integer" - }, - "pageSize": { - "type": "integer" - } - } - }, - "sysModel.CasbinInReceive": { - "type": "object", - "properties": { - "authorityId": { + "columnName": { "type": "string" }, - "casbinInfos": { - "type": "array", - "items": { - "$ref": "#/definitions/sysModel.CasbinInfo" - } - } - } - }, - "sysModel.CasbinInfo": { - "type": "object", - "properties": { - "method": { + "fieldJson": { "type": "string" }, - "path": { + "fieldName": { + "type": "string" + }, + "fieldType": { "type": "string" } } }, - "sysModel.SysApi": { + "model.SysApi": { "type": "object", "properties": { + "apiGroup": { + "type": "string" + }, "description": { "type": "string" }, - "group": { - "type": "string" - }, "method": { "type": "string" }, @@ -1976,7 +2013,7 @@ var doc = `{ } } }, - "sysModel.SysAuthority": { + "model.SysAuthority": { "type": "object", "properties": { "authorityId": { @@ -1988,27 +2025,48 @@ var doc = `{ "children": { "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" } }, + "createdAt": { + "type": "string" + }, "dataAuthorityId": { "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" + } + }, + "deletedAt": { + "type": "string" + }, + "menus": { + "type": "array", + "items": { + "$ref": "#/definitions/model.SysBaseMenu" } }, "parentId": { "type": "string" + }, + "updatedAt": { + "type": "string" } } }, - "sysModel.SysBaseMenu": { + "model.SysBaseMenu": { "type": "object", "properties": { + "authoritys": { + "type": "array", + "items": { + "$ref": "#/definitions/model.SysAuthority" + } + }, "children": { "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysBaseMenu" + "$ref": "#/definitions/model.SysBaseMenu" } }, "component": { @@ -2023,9 +2081,6 @@ var doc = `{ "name": { "type": "string" }, - "nickName": { - "type": "string" - }, "parentId": { "type": "string" }, @@ -2033,19 +2088,19 @@ var doc = `{ "type": "string" }, "sort": { - "type": "string" + "type": "integer" }, "title": { "type": "string" } } }, - "sysModel.SysUser": { + "model.SysUser": { "type": "object", "properties": { "authority": { "type": "object", - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" }, "authorityId": { "type": "string" @@ -2064,7 +2119,7 @@ var doc = `{ } } }, - "sysModel.SysWorkflow": { + "model.SysWorkflow": { "type": "object", "properties": { "workflowDescription": { @@ -2083,12 +2138,12 @@ var doc = `{ "description": "工作流步骤", "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysWorkflowStepInfo" + "$ref": "#/definitions/model.SysWorkflowStepInfo" } } } }, - "sysModel.SysWorkflowStepInfo": { + "model.SysWorkflowStepInfo": { "type": "object", "properties": { "isEnd": { @@ -2117,21 +2172,151 @@ var doc = `{ } } }, - "sysModel.System": { + "model.System": { "type": "object", "properties": { "config": { "type": "object", - "$ref": "#/definitions/config.Config" + "$ref": "#/definitions/config.Server" + } + } + }, + "request.AddMenuAuthorityInfo": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "menus": { + "type": "array", + "items": { + "$ref": "#/definitions/model.SysBaseMenu" + } + } + } + }, + "request.AuthorityIdInfo": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + } + } + }, + "request.CasbinInReceive": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "casbinInfos": { + "type": "array", + "items": { + "$ref": "#/definitions/request.CasbinInfo" + } + } + } + }, + "request.CasbinInfo": { + "type": "object", + "properties": { + "method": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, + "request.ChangePasswordStruct": { + "type": "object", + "properties": { + "newPassword": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "request.GetById": { + "type": "object", + "properties": { + "id": { + "type": "number" + } + } + }, + "request.PageInfo": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + } + } + }, + "request.RegisterAndLoginStruct": { + "type": "object", + "properties": { + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "request.SearchApiParams": { + "type": "object", + "properties": { + "apiGroup": { + "type": "string" + }, + "desc": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "method": { + "type": "string" + }, + "orderKey": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "path": { + "type": "string" + } + } + }, + "request.SetUserAuth": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "uuid": { + "type": "string" } } - } - }, - "securityDefinitions": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "x-token", - "in": "header" } } }` @@ -2147,12 +2332,12 @@ type swaggerInfo struct { // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = swaggerInfo{ - Version: "0.0.1", + Version: "", Host: "", - BasePath: "/", + BasePath: "", Schemes: []string{}, - Title: "Swagger Example API", - Description: "This is a sample Server pets", + Title: "", + Description: "", } type s struct{} diff --git a/server/docs/swagger.json b/server/docs/swagger.json index 1aeca8f3..b17f8cc2 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -1,13 +1,9 @@ { "swagger": "2.0", "info": { - "description": "This is a sample Server pets", - "title": "Swagger Example API", "contact": {}, - "license": {}, - "version": "0.0.1" + "license": {} }, - "basePath": "/", "paths": { "/api/createApi": { "post": { @@ -34,7 +30,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateApiParams" + "$ref": "#/definitions/model.SysApi" } } ], @@ -73,7 +69,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysApi" + "$ref": "#/definitions/model.SysApi" } } ], @@ -133,13 +129,13 @@ "summary": "根据id获取api", "parameters": [ { - "description": "分页获取用户列表", + "description": "根据id获取api", "name": "data", "in": "body", "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.GetById" } } ], @@ -178,7 +174,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.SearchApiParams" } } ], @@ -217,7 +213,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateApiParams" + "$ref": "#/definitions/model.SysApi" } } ], @@ -256,7 +252,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/model.SysAuthority" } } ], @@ -295,7 +291,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.DeleteAuthorityPatams" + "$ref": "#/definitions/model.SysAuthority" } } ], @@ -334,7 +330,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -373,7 +369,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" } } ], @@ -387,6 +383,45 @@ } } }, + "/autoCode/createTemp": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "自动代码模板", + "parameters": [ + { + "description": "创建自动代码", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/model.AutoCodeStruct" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/base/captcha": { "post": { "security": [ @@ -458,7 +493,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegisterAndLoginStruct" + "$ref": "#/definitions/request.RegisterAndLoginStruct" } } ], @@ -489,7 +524,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysUser" + "$ref": "#/definitions/model.SysUser" } } ], @@ -528,7 +563,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/request.CasbinInReceive" } } ], @@ -567,7 +602,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.CasbinInReceive" + "$ref": "#/definitions/request.CasbinInReceive" } } ], @@ -606,7 +641,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.CreateAuthorityParams" + "$ref": "#/definitions/request.CasbinInReceive" } } ], @@ -620,7 +655,81 @@ } } }, - "/customer/createExaCustomer": { + "/customer/customer": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "获取单一客户信息", + "parameters": [ + { + "description": "获取单一客户信息", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/model.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + }, + "put": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "SysApi" + ], + "summary": "更新客户信息", + "parameters": [ + { + "description": "创建客户", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/model.ExaCustomer" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + }, "post": { "security": [ { @@ -645,7 +754,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" + "$ref": "#/definitions/model.ExaCustomer" } } ], @@ -657,10 +766,8 @@ } } } - } - }, - "/customer/deleteExaCustomer": { - "post": { + }, + "delete": { "security": [ { "ApiKeyAuth": [] @@ -684,7 +791,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" + "$ref": "#/definitions/model.ExaCustomer" } } ], @@ -698,47 +805,8 @@ } } }, - "/customer/getExaCustomer": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "SysApi" - ], - "summary": "获取单一客户信息", - "parameters": [ - { - "description": "获取单一客户信息", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" - } - } - ], - "responses": { - "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/customer/getExaCustomerList": { - "post": { + "/customer/customerList": { + "get": { "security": [ { "ApiKeyAuth": [] @@ -762,46 +830,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" - } - } - ], - "responses": { - "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", - "schema": { - "type": "string" - } - } - } - } - }, - "/customer/updateExaCustomer": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "SysApi" - ], - "summary": "更新客户信息", - "parameters": [ - { - "description": "创建客户", - "name": "data", - "in": "body", - "required": true, - "schema": { - "type": "object", - "$ref": "#/definitions/dbModel.ExaCustomer" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -835,7 +864,7 @@ "parameters": [ { "type": "file", - "description": "断点续传示例", + "description": "an example for breakpoint resume, 断点续传示例", "name": "file", "in": "formData", "required": true @@ -873,7 +902,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/dbModel.ExaFileUploadAndDownload" + "$ref": "#/definitions/model.ExaFileUploadAndDownload" } } ], @@ -907,7 +936,7 @@ "parameters": [ { "type": "file", - "description": "查找文件", + "description": "上传文件完成", "name": "file", "in": "formData", "required": true @@ -915,7 +944,7 @@ ], "responses": { "200": { - "description": "{\"success\":true,\"data\":{},\"msg\":\"查找成功\"}", + "description": "{\"success\":true,\"data\":{},\"msg\":\"file uploaded, 文件创建成功\"}", "schema": { "type": "string" } @@ -948,7 +977,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -982,7 +1011,7 @@ "parameters": [ { "type": "file", - "description": "查找文件", + "description": "删除缓存切片", "name": "file", "in": "formData", "required": true @@ -1061,6 +1090,45 @@ } } }, + "/menu/GetMenuAuthority": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "authorityAndMenu" + ], + "summary": "获取指定角色menu", + "parameters": [ + { + "description": "增加menu和角色关联关系", + "name": "data", + "in": "body", + "required": true, + "schema": { + "type": "object", + "$ref": "#/definitions/request.AuthorityIdInfo" + } + } + ], + "responses": { + "200": { + "description": "{\"success\":true,\"data\":{},\"msg\":\"获取成功\"}", + "schema": { + "type": "string" + } + } + } + } + }, "/menu/addBaseMenu": { "post": { "security": [ @@ -1086,7 +1154,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysBaseMenu" + "$ref": "#/definitions/model.SysBaseMenu" } } ], @@ -1116,7 +1184,7 @@ "tags": [ "authorityAndMenu" ], - "summary": "获取指定角色menu", + "summary": "增加menu和角色关联关系", "parameters": [ { "description": "增加menu和角色关联关系", @@ -1125,7 +1193,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.AuthorityIdInfo" + "$ref": "#/definitions/request.AddMenuAuthorityInfo" } } ], @@ -1164,7 +1232,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.IdInfo" + "$ref": "#/definitions/request.GetById" } } ], @@ -1203,7 +1271,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.GetById" + "$ref": "#/definitions/request.GetById" } } ], @@ -1239,7 +1307,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegisterAndLoginStruct" + "$ref": "#/definitions/request.RegisterAndLoginStruct" } } ], @@ -1275,7 +1343,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.RegisterAndLoginStruct" + "$ref": "#/definitions/request.RegisterAndLoginStruct" } } ], @@ -1314,7 +1382,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -1328,7 +1396,7 @@ } } }, - "/menu/updateBaseMen": { + "/menu/updateBaseMenu": { "post": { "security": [ { @@ -1353,7 +1421,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysBaseMenu" + "$ref": "#/definitions/model.SysBaseMenu" } } ], @@ -1389,7 +1457,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.System" + "$ref": "#/definitions/model.System" } } ], @@ -1449,7 +1517,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.System" + "$ref": "#/definitions/model.System" } } ], @@ -1464,7 +1532,7 @@ } }, "/user/changePassword": { - "post": { + "put": { "security": [ { "ApiKeyAuth": [] @@ -1485,7 +1553,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.ChangePasswordStutrc" + "$ref": "#/definitions/request.ChangePasswordStruct" } } ], @@ -1524,7 +1592,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/model.PageInfo" + "$ref": "#/definitions/request.PageInfo" } } ], @@ -1563,7 +1631,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/api.SetUserAuth" + "$ref": "#/definitions/request.SetUserAuth" } } ], @@ -1637,7 +1705,7 @@ "required": true, "schema": { "type": "object", - "$ref": "#/definitions/sysModel.SysWorkflow" + "$ref": "#/definitions/model.SysWorkflow" } } ], @@ -1653,154 +1721,28 @@ } }, "definitions": { - "api.AddMenuAuthorityInfo": { + "config.Captcha": { "type": "object", "properties": { - "authorityId": { - "type": "string" + "imgHeight": { + "type": "integer" }, - "menus": { - "type": "array", - "items": { - "$ref": "#/definitions/sysModel.SysBaseMenu" - } - } - } - }, - "api.AuthorityIdInfo": { - "type": "object", - "properties": { - "authorityId": { - "type": "string" - } - } - }, - "api.ChangePasswordStutrc": { - "type": "object", - "properties": { - "newPassword": { - "type": "string" + "imgWidth": { + "type": "integer" }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "api.CreateApiParams": { - "type": "object", - "properties": { - "description": { - "type": "string" - }, - "path": { - "type": "string" - } - } - }, - "api.CreateAuthorityParams": { - "type": "object", - "properties": { - "authorityId": { - "type": "string" - }, - "authorityName": { - "type": "string" - } - } - }, - "api.DeleteAuthorityPatams": { - "type": "object", - "properties": { - "authorityId": { + "keyLong": { "type": "integer" } } }, - "api.GetById": { - "type": "object", - "properties": { - "id": { - "type": "number" - } - } - }, - "api.IdInfo": { - "type": "object", - "properties": { - "id": { - "type": "number" - } - } - }, - "api.RegisterAndLoginStruct": { - "type": "object", - "properties": { - "captcha": { - "type": "string" - }, - "captchaId": { - "type": "string" - }, - "password": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "api.SetUserAuth": { - "type": "object", - "properties": { - "authorityId": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - }, - "config.CasbinConfig": { + "config.Casbin": { "type": "object", "properties": { "modelPath": { - "description": "casbin model地址配置", "type": "string" } } }, - "config.Config": { - "type": "object", - "properties": { - "casbinConfig": { - "type": "object", - "$ref": "#/definitions/config.CasbinConfig" - }, - "jwt": { - "type": "object", - "$ref": "#/definitions/config.JWT" - }, - "mysqlAdmin": { - "type": "object", - "$ref": "#/definitions/config.MysqlAdmin" - }, - "qiniu": { - "type": "object", - "$ref": "#/definitions/config.Qiniu" - }, - "redisAdmin": { - "type": "object", - "$ref": "#/definitions/config.RedisAdmin" - }, - "system": { - "type": "object", - "$ref": "#/definitions/config.System" - } - } - }, "config.JWT": { "type": "object", "properties": { @@ -1809,7 +1751,24 @@ } } }, - "config.MysqlAdmin": { + "config.Log": { + "type": "object", + "properties": { + "file": { + "type": "string" + }, + "logFile": { + "type": "boolean" + }, + "prefix": { + "type": "string" + }, + "stdout": { + "type": "string" + } + } + }, + "config.Mysql": { "type": "object", "properties": { "config": { @@ -1818,6 +1777,15 @@ "dbname": { "type": "string" }, + "logMode": { + "type": "boolean" + }, + "maxIdleConns": { + "type": "integer" + }, + "maxOpenConns": { + "type": "integer" + }, "password": { "type": "string" }, @@ -1840,7 +1808,7 @@ } } }, - "config.RedisAdmin": { + "config.Redis": { "type": "object", "properties": { "addr": { @@ -1854,12 +1822,76 @@ } } }, + "config.Server": { + "type": "object", + "properties": { + "captcha": { + "type": "object", + "$ref": "#/definitions/config.Captcha" + }, + "casbin": { + "type": "object", + "$ref": "#/definitions/config.Casbin" + }, + "jwt": { + "type": "object", + "$ref": "#/definitions/config.JWT" + }, + "log": { + "type": "object", + "$ref": "#/definitions/config.Log" + }, + "mysql": { + "type": "object", + "$ref": "#/definitions/config.Mysql" + }, + "qiniu": { + "type": "object", + "$ref": "#/definitions/config.Qiniu" + }, + "redis": { + "type": "object", + "$ref": "#/definitions/config.Redis" + }, + "sqlite": { + "type": "object", + "$ref": "#/definitions/config.Sqlite" + }, + "system": { + "type": "object", + "$ref": "#/definitions/config.System" + } + } + }, + "config.Sqlite": { + "type": "object", + "properties": { + "config": { + "type": "string" + }, + "logMode": { + "type": "boolean" + }, + "password": { + "type": "string" + }, + "path": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "config.System": { "type": "object", "properties": { "addr": { "type": "integer" }, + "dbType": { + "type": "string" + }, "env": { "type": "string" }, @@ -1868,7 +1900,27 @@ } } }, - "dbModel.ExaCustomer": { + "model.AutoCodeStruct": { + "type": "object", + "properties": { + "abbreviation": { + "type": "string" + }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/model.Field" + } + }, + "packageName": { + "type": "string" + }, + "structName": { + "type": "string" + } + } + }, + "model.ExaCustomer": { "type": "object", "properties": { "customerName": { @@ -1879,7 +1931,7 @@ }, "sysUser": { "type": "object", - "$ref": "#/definitions/sysModel.SysUser" + "$ref": "#/definitions/model.SysUser" }, "sysUserAuthorityID": { "type": "string" @@ -1889,7 +1941,7 @@ } } }, - "dbModel.ExaFileUploadAndDownload": { + "model.ExaFileUploadAndDownload": { "type": "object", "properties": { "key": { @@ -1906,51 +1958,32 @@ } } }, - "model.PageInfo": { + "model.Field": { "type": "object", "properties": { - "page": { - "type": "integer" - }, - "pageSize": { - "type": "integer" - } - } - }, - "sysModel.CasbinInReceive": { - "type": "object", - "properties": { - "authorityId": { + "columnName": { "type": "string" }, - "casbinInfos": { - "type": "array", - "items": { - "$ref": "#/definitions/sysModel.CasbinInfo" - } - } - } - }, - "sysModel.CasbinInfo": { - "type": "object", - "properties": { - "method": { + "fieldJson": { "type": "string" }, - "path": { + "fieldName": { + "type": "string" + }, + "fieldType": { "type": "string" } } }, - "sysModel.SysApi": { + "model.SysApi": { "type": "object", "properties": { + "apiGroup": { + "type": "string" + }, "description": { "type": "string" }, - "group": { - "type": "string" - }, "method": { "type": "string" }, @@ -1959,7 +1992,7 @@ } } }, - "sysModel.SysAuthority": { + "model.SysAuthority": { "type": "object", "properties": { "authorityId": { @@ -1971,27 +2004,48 @@ "children": { "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" } }, + "createdAt": { + "type": "string" + }, "dataAuthorityId": { "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" + } + }, + "deletedAt": { + "type": "string" + }, + "menus": { + "type": "array", + "items": { + "$ref": "#/definitions/model.SysBaseMenu" } }, "parentId": { "type": "string" + }, + "updatedAt": { + "type": "string" } } }, - "sysModel.SysBaseMenu": { + "model.SysBaseMenu": { "type": "object", "properties": { + "authoritys": { + "type": "array", + "items": { + "$ref": "#/definitions/model.SysAuthority" + } + }, "children": { "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysBaseMenu" + "$ref": "#/definitions/model.SysBaseMenu" } }, "component": { @@ -2006,9 +2060,6 @@ "name": { "type": "string" }, - "nickName": { - "type": "string" - }, "parentId": { "type": "string" }, @@ -2016,19 +2067,19 @@ "type": "string" }, "sort": { - "type": "string" + "type": "integer" }, "title": { "type": "string" } } }, - "sysModel.SysUser": { + "model.SysUser": { "type": "object", "properties": { "authority": { "type": "object", - "$ref": "#/definitions/sysModel.SysAuthority" + "$ref": "#/definitions/model.SysAuthority" }, "authorityId": { "type": "string" @@ -2047,7 +2098,7 @@ } } }, - "sysModel.SysWorkflow": { + "model.SysWorkflow": { "type": "object", "properties": { "workflowDescription": { @@ -2066,12 +2117,12 @@ "description": "工作流步骤", "type": "array", "items": { - "$ref": "#/definitions/sysModel.SysWorkflowStepInfo" + "$ref": "#/definitions/model.SysWorkflowStepInfo" } } } }, - "sysModel.SysWorkflowStepInfo": { + "model.SysWorkflowStepInfo": { "type": "object", "properties": { "isEnd": { @@ -2100,21 +2151,151 @@ } } }, - "sysModel.System": { + "model.System": { "type": "object", "properties": { "config": { "type": "object", - "$ref": "#/definitions/config.Config" + "$ref": "#/definitions/config.Server" + } + } + }, + "request.AddMenuAuthorityInfo": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "menus": { + "type": "array", + "items": { + "$ref": "#/definitions/model.SysBaseMenu" + } + } + } + }, + "request.AuthorityIdInfo": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + } + } + }, + "request.CasbinInReceive": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "casbinInfos": { + "type": "array", + "items": { + "$ref": "#/definitions/request.CasbinInfo" + } + } + } + }, + "request.CasbinInfo": { + "type": "object", + "properties": { + "method": { + "type": "string" + }, + "path": { + "type": "string" + } + } + }, + "request.ChangePasswordStruct": { + "type": "object", + "properties": { + "newPassword": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "request.GetById": { + "type": "object", + "properties": { + "id": { + "type": "number" + } + } + }, + "request.PageInfo": { + "type": "object", + "properties": { + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + } + } + }, + "request.RegisterAndLoginStruct": { + "type": "object", + "properties": { + "captcha": { + "type": "string" + }, + "captchaId": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "request.SearchApiParams": { + "type": "object", + "properties": { + "apiGroup": { + "type": "string" + }, + "desc": { + "type": "boolean" + }, + "description": { + "type": "string" + }, + "method": { + "type": "string" + }, + "orderKey": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "path": { + "type": "string" + } + } + }, + "request.SetUserAuth": { + "type": "object", + "properties": { + "authorityId": { + "type": "string" + }, + "uuid": { + "type": "string" } } } - }, - "securityDefinitions": { - "ApiKeyAuth": { - "type": "apiKey", - "name": "x-token", - "in": "header" - } } } \ No newline at end of file diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index 56079809..6231d64c 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -1,113 +1,46 @@ -basePath: / definitions: - api.AddMenuAuthorityInfo: + config.Captcha: properties: - authorityId: - type: string - menus: - items: - $ref: '#/definitions/sysModel.SysBaseMenu' - type: array - type: object - api.AuthorityIdInfo: - properties: - authorityId: - type: string - type: object - api.ChangePasswordStutrc: - properties: - newPassword: - type: string - password: - type: string - username: - type: string - type: object - api.CreateApiParams: - properties: - description: - type: string - path: - type: string - type: object - api.CreateAuthorityParams: - properties: - authorityId: - type: string - authorityName: - type: string - type: object - api.DeleteAuthorityPatams: - properties: - authorityId: + imgHeight: + type: integer + imgWidth: + type: integer + keyLong: type: integer type: object - api.GetById: - properties: - id: - type: number - type: object - api.IdInfo: - properties: - id: - type: number - type: object - api.RegisterAndLoginStruct: - properties: - captcha: - type: string - captchaId: - type: string - password: - type: string - username: - type: string - type: object - api.SetUserAuth: - properties: - authorityId: - type: string - uuid: - type: string - type: object - config.CasbinConfig: + config.Casbin: properties: modelPath: - description: casbin model地址配置 type: string type: object - config.Config: - properties: - casbinConfig: - $ref: '#/definitions/config.CasbinConfig' - type: object - jwt: - $ref: '#/definitions/config.JWT' - type: object - mysqlAdmin: - $ref: '#/definitions/config.MysqlAdmin' - type: object - qiniu: - $ref: '#/definitions/config.Qiniu' - type: object - redisAdmin: - $ref: '#/definitions/config.RedisAdmin' - type: object - system: - $ref: '#/definitions/config.System' - type: object - type: object config.JWT: properties: signingKey: type: string type: object - config.MysqlAdmin: + config.Log: + properties: + file: + type: string + logFile: + type: boolean + prefix: + type: string + stdout: + type: string + type: object + config.Mysql: properties: config: type: string dbname: type: string + logMode: + type: boolean + maxIdleConns: + type: integer + maxOpenConns: + type: integer password: type: string path: @@ -122,7 +55,7 @@ definitions: secretKey: type: string type: object - config.RedisAdmin: + config.Redis: properties: addr: type: string @@ -131,30 +64,88 @@ definitions: password: type: string type: object + config.Server: + properties: + captcha: + $ref: '#/definitions/config.Captcha' + type: object + casbin: + $ref: '#/definitions/config.Casbin' + type: object + jwt: + $ref: '#/definitions/config.JWT' + type: object + log: + $ref: '#/definitions/config.Log' + type: object + mysql: + $ref: '#/definitions/config.Mysql' + type: object + qiniu: + $ref: '#/definitions/config.Qiniu' + type: object + redis: + $ref: '#/definitions/config.Redis' + type: object + sqlite: + $ref: '#/definitions/config.Sqlite' + type: object + system: + $ref: '#/definitions/config.System' + type: object + type: object + config.Sqlite: + properties: + config: + type: string + logMode: + type: boolean + password: + type: string + path: + type: string + username: + type: string + type: object config.System: properties: addr: type: integer + dbType: + type: string env: type: string useMultipoint: type: boolean type: object - dbModel.ExaCustomer: + model.AutoCodeStruct: + properties: + abbreviation: + type: string + fields: + items: + $ref: '#/definitions/model.Field' + type: array + packageName: + type: string + structName: + type: string + type: object + model.ExaCustomer: properties: customerName: type: string customerPhoneData: type: string sysUser: - $ref: '#/definitions/sysModel.SysUser' + $ref: '#/definitions/model.SysUser' type: object sysUserAuthorityID: type: string sysUserId: type: integer type: object - dbModel.ExaFileUploadAndDownload: + model.ExaFileUploadAndDownload: properties: key: type: string @@ -165,41 +156,29 @@ definitions: url: type: string type: object - model.PageInfo: + model.Field: properties: - page: - type: integer - pageSize: - type: integer - type: object - sysModel.CasbinInReceive: - properties: - authorityId: + columnName: type: string - casbinInfos: - items: - $ref: '#/definitions/sysModel.CasbinInfo' - type: array - type: object - sysModel.CasbinInfo: - properties: - method: + fieldJson: type: string - path: + fieldName: + type: string + fieldType: type: string type: object - sysModel.SysApi: + model.SysApi: properties: + apiGroup: + type: string description: type: string - group: - type: string method: type: string path: type: string type: object - sysModel.SysAuthority: + model.SysAuthority: properties: authorityId: type: string @@ -207,20 +186,34 @@ definitions: type: string children: items: - $ref: '#/definitions/sysModel.SysAuthority' + $ref: '#/definitions/model.SysAuthority' type: array + createdAt: + type: string dataAuthorityId: items: - $ref: '#/definitions/sysModel.SysAuthority' + $ref: '#/definitions/model.SysAuthority' + type: array + deletedAt: + type: string + menus: + items: + $ref: '#/definitions/model.SysBaseMenu' type: array parentId: type: string + updatedAt: + type: string type: object - sysModel.SysBaseMenu: + model.SysBaseMenu: properties: + authoritys: + items: + $ref: '#/definitions/model.SysAuthority' + type: array children: items: - $ref: '#/definitions/sysModel.SysBaseMenu' + $ref: '#/definitions/model.SysBaseMenu' type: array component: type: string @@ -230,21 +223,19 @@ definitions: type: string name: type: string - nickName: - type: string parentId: type: string path: type: string sort: - type: string + type: integer title: type: string type: object - sysModel.SysUser: + model.SysUser: properties: authority: - $ref: '#/definitions/sysModel.SysAuthority' + $ref: '#/definitions/model.SysAuthority' type: object authorityId: type: string @@ -257,7 +248,7 @@ definitions: uuid: type: string type: object - sysModel.SysWorkflow: + model.SysWorkflow: properties: workflowDescription: description: 工作流描述 @@ -271,10 +262,10 @@ definitions: workflowStep: description: 工作流步骤 items: - $ref: '#/definitions/sysModel.SysWorkflowStepInfo' + $ref: '#/definitions/model.SysWorkflowStepInfo' type: array type: object - sysModel.SysWorkflowStepInfo: + model.SysWorkflowStepInfo: properties: isEnd: description: 是否是完结流节点 @@ -295,18 +286,103 @@ definitions: description: 所属工作流ID type: integer type: object - sysModel.System: + model.System: properties: config: - $ref: '#/definitions/config.Config' + $ref: '#/definitions/config.Server' type: object type: object + request.AddMenuAuthorityInfo: + properties: + authorityId: + type: string + menus: + items: + $ref: '#/definitions/model.SysBaseMenu' + type: array + type: object + request.AuthorityIdInfo: + properties: + authorityId: + type: string + type: object + request.CasbinInReceive: + properties: + authorityId: + type: string + casbinInfos: + items: + $ref: '#/definitions/request.CasbinInfo' + type: array + type: object + request.CasbinInfo: + properties: + method: + type: string + path: + type: string + type: object + request.ChangePasswordStruct: + properties: + newPassword: + type: string + password: + type: string + username: + type: string + type: object + request.GetById: + properties: + id: + type: number + type: object + request.PageInfo: + properties: + page: + type: integer + pageSize: + type: integer + type: object + request.RegisterAndLoginStruct: + properties: + captcha: + type: string + captchaId: + type: string + password: + type: string + username: + type: string + type: object + request.SearchApiParams: + properties: + apiGroup: + type: string + desc: + type: boolean + description: + type: string + method: + type: string + orderKey: + type: string + page: + type: integer + pageSize: + type: integer + path: + type: string + type: object + request.SetUserAuth: + properties: + authorityId: + type: string + uuid: + type: string + type: object info: contact: {} - description: This is a sample Server pets license: {} - title: Swagger Example API - version: 0.0.1 paths: /api/createApi: post: @@ -318,7 +394,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.CreateApiParams' + $ref: '#/definitions/model.SysApi' type: object produces: - application/json @@ -342,7 +418,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.SysApi' + $ref: '#/definitions/model.SysApi' type: object produces: - application/json @@ -377,12 +453,12 @@ paths: consumes: - application/json parameters: - - description: 分页获取用户列表 + - description: 根据id获取api in: body name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/request.GetById' type: object produces: - application/json @@ -406,7 +482,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/request.SearchApiParams' type: object produces: - application/json @@ -430,7 +506,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.CreateApiParams' + $ref: '#/definitions/model.SysApi' type: object produces: - application/json @@ -454,7 +530,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.CreateAuthorityParams' + $ref: '#/definitions/model.SysAuthority' type: object produces: - application/json @@ -478,7 +554,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.DeleteAuthorityPatams' + $ref: '#/definitions/model.SysAuthority' type: object produces: - application/json @@ -502,7 +578,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/request.PageInfo' type: object produces: - application/json @@ -526,7 +602,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.SysAuthority' + $ref: '#/definitions/model.SysAuthority' type: object produces: - application/json @@ -540,6 +616,30 @@ paths: summary: 设置角色资源权限 tags: - authority + /autoCode/createTemp: + post: + consumes: + - application/json + parameters: + - description: 创建自动代码 + in: body + name: data + required: true + schema: + $ref: '#/definitions/model.AutoCodeStruct' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"创建成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 自动代码模板 + tags: + - SysApi /base/captcha: post: consumes: @@ -580,7 +680,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.RegisterAndLoginStruct' + $ref: '#/definitions/request.RegisterAndLoginStruct' type: object produces: - application/json @@ -600,7 +700,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.SysUser' + $ref: '#/definitions/model.SysUser' type: object produces: - application/json @@ -622,7 +722,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.CreateAuthorityParams' + $ref: '#/definitions/request.CasbinInReceive' type: object produces: - application/json @@ -646,7 +746,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.CasbinInReceive' + $ref: '#/definitions/request.CasbinInReceive' type: object produces: - application/json @@ -670,7 +770,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.CreateAuthorityParams' + $ref: '#/definitions/request.CasbinInReceive' type: object produces: - application/json @@ -684,32 +784,8 @@ paths: summary: 获取权限列表 tags: - casbin - /customer/createExaCustomer: - post: - consumes: - - application/json - parameters: - - description: 创建客户 - in: body - name: data - required: true - schema: - $ref: '#/definitions/dbModel.ExaCustomer' - type: object - produces: - - application/json - responses: - "200": - description: '{"success":true,"data":{},"msg":"获取成功"}' - schema: - type: string - security: - - ApiKeyAuth: [] - summary: 创建客户 - tags: - - SysApi - /customer/deleteExaCustomer: - post: + /customer/customer: + delete: consumes: - application/json parameters: @@ -718,7 +794,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/dbModel.ExaCustomer' + $ref: '#/definitions/model.ExaCustomer' type: object produces: - application/json @@ -732,8 +808,7 @@ paths: summary: 删除客户 tags: - SysApi - /customer/getExaCustomer: - post: + get: consumes: - application/json parameters: @@ -742,7 +817,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/dbModel.ExaCustomer' + $ref: '#/definitions/model.ExaCustomer' type: object produces: - application/json @@ -756,17 +831,16 @@ paths: summary: 获取单一客户信息 tags: - SysApi - /customer/getExaCustomerList: post: consumes: - application/json parameters: - - description: 获取权限客户列表 + - description: 创建客户 in: body name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/model.ExaCustomer' type: object produces: - application/json @@ -777,11 +851,10 @@ paths: type: string security: - ApiKeyAuth: [] - summary: 获取权限客户列表 + summary: 创建客户 tags: - SysApi - /customer/updateExaCustomer: - post: + put: consumes: - application/json parameters: @@ -790,7 +863,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/dbModel.ExaCustomer' + $ref: '#/definitions/model.ExaCustomer' type: object produces: - application/json @@ -804,12 +877,36 @@ paths: summary: 更新客户信息 tags: - SysApi + /customer/customerList: + get: + consumes: + - application/json + parameters: + - description: 获取权限客户列表 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.PageInfo' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 获取权限客户列表 + tags: + - SysApi /fileUploadAndDownload/breakpointContinue: post: consumes: - multipart/form-data parameters: - - description: 断点续传示例 + - description: an example for breakpoint resume, 断点续传示例 in: formData name: file required: true @@ -834,7 +931,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/dbModel.ExaFileUploadAndDownload' + $ref: '#/definitions/model.ExaFileUploadAndDownload' type: object produces: - application/json @@ -853,7 +950,7 @@ paths: consumes: - multipart/form-data parameters: - - description: 查找文件 + - description: 上传文件完成 in: formData name: file required: true @@ -862,7 +959,7 @@ paths: - application/json responses: "200": - description: '{"success":true,"data":{},"msg":"查找成功"}' + description: '{"success":true,"data":{},"msg":"file uploaded, 文件创建成功"}' schema: type: string security: @@ -880,7 +977,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/request.PageInfo' type: object produces: - application/json @@ -899,7 +996,7 @@ paths: consumes: - multipart/form-data parameters: - - description: 查找文件 + - description: 删除缓存切片 in: formData name: file required: true @@ -954,6 +1051,30 @@ paths: summary: jwt加入黑名单 tags: - jwt + /menu/GetMenuAuthority: + post: + consumes: + - application/json + parameters: + - description: 增加menu和角色关联关系 + in: body + name: data + required: true + schema: + $ref: '#/definitions/request.AuthorityIdInfo' + type: object + produces: + - application/json + responses: + "200": + description: '{"success":true,"data":{},"msg":"获取成功"}' + schema: + type: string + security: + - ApiKeyAuth: [] + summary: 获取指定角色menu + tags: + - authorityAndMenu /menu/addBaseMenu: post: consumes: @@ -964,7 +1085,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.SysBaseMenu' + $ref: '#/definitions/model.SysBaseMenu' type: object produces: - application/json @@ -988,7 +1109,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.AuthorityIdInfo' + $ref: '#/definitions/request.AddMenuAuthorityInfo' type: object produces: - application/json @@ -999,7 +1120,7 @@ paths: type: string security: - ApiKeyAuth: [] - summary: 获取指定角色menu + summary: 增加menu和角色关联关系 tags: - authorityAndMenu /menu/deleteBaseMenu: @@ -1012,7 +1133,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.IdInfo' + $ref: '#/definitions/request.GetById' type: object produces: - application/json @@ -1036,7 +1157,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.GetById' + $ref: '#/definitions/request.GetById' type: object produces: - application/json @@ -1058,7 +1179,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.RegisterAndLoginStruct' + $ref: '#/definitions/request.RegisterAndLoginStruct' type: object produces: - application/json @@ -1080,7 +1201,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.RegisterAndLoginStruct' + $ref: '#/definitions/request.RegisterAndLoginStruct' type: object produces: - application/json @@ -1104,7 +1225,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/request.PageInfo' type: object produces: - application/json @@ -1118,7 +1239,7 @@ paths: summary: 分页获取基础menu列表 tags: - menu - /menu/updateBaseMen: + /menu/updateBaseMenu: post: consumes: - application/json @@ -1128,7 +1249,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.SysBaseMenu' + $ref: '#/definitions/model.SysBaseMenu' type: object produces: - application/json @@ -1150,7 +1271,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.System' + $ref: '#/definitions/model.System' type: object produces: - application/json @@ -1186,7 +1307,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.System' + $ref: '#/definitions/model.System' type: object produces: - application/json @@ -1201,14 +1322,14 @@ paths: tags: - system /user/changePassword: - post: + put: parameters: - description: 用户修改密码 in: body name: data required: true schema: - $ref: '#/definitions/api.ChangePasswordStutrc' + $ref: '#/definitions/request.ChangePasswordStruct' type: object produces: - application/json @@ -1232,7 +1353,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/model.PageInfo' + $ref: '#/definitions/request.PageInfo' type: object produces: - application/json @@ -1256,7 +1377,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/api.SetUserAuth' + $ref: '#/definitions/request.SetUserAuth' type: object produces: - application/json @@ -1305,7 +1426,7 @@ paths: name: data required: true schema: - $ref: '#/definitions/sysModel.SysWorkflow' + $ref: '#/definitions/model.SysWorkflow' type: object produces: - application/json @@ -1317,9 +1438,4 @@ paths: summary: 注册工作流 tags: - workflow -securityDefinitions: - ApiKeyAuth: - in: header - name: x-token - type: apiKey swagger: "2.0" diff --git a/server/model/sys_base_menu.go b/server/model/sys_base_menu.go index d17223f5..81c71173 100644 --- a/server/model/sys_base_menu.go +++ b/server/model/sys_base_menu.go @@ -19,6 +19,8 @@ type SysBaseMenu struct { } type Meta struct { - Title string `json:"title"` - Icon string `json:"icon"` -} \ No newline at end of file + KeepAlive bool `json:"keepAlive"` + DefaultMenu bool `json:"defaultMenu"` + Title string `json:"title"` + Icon string `json:"icon"` +} diff --git a/server/resource/template/fe/api.js.tpl b/server/resource/template/fe/api.js.tpl index de2b802c..2bb5c130 100644 --- a/server/resource/template/fe/api.js.tpl +++ b/server/resource/template/fe/api.js.tpl @@ -72,7 +72,7 @@ export const create{{.StructName}} = (data) => { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取{{.StructName}}列表" +// @Param data body request.PageInfo true "分页获取{{.StructName}}列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /{{.Abbreviation}}/get{{.StructName}}List [post] export const get{{.StructName}}List = (data) => { diff --git a/server/resource/template/te/api.go.tpl b/server/resource/template/te/api.go.tpl index dd245a84..75a15cc0 100644 --- a/server/resource/template/te/api.go.tpl +++ b/server/resource/template/te/api.go.tpl @@ -97,11 +97,11 @@ func Find{{.StructName}}(c *gin.Context) { // @Security ApiKeyAuth // @accept application/json // @Produce application/json -// @Param data body model.PageInfo true "分页获取{{.StructName}}列表" +// @Param data body request.PageInfo true "分页获取{{.StructName}}列表" // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}" // @Router /{{.Abbreviation}}/get{{.StructName}}List [post] func Get{{.StructName}}List(c *gin.Context) { - var pageInfo model.PageInfo + var pageInfo request.PageInfo _ = c.ShouldBindJSON(&pageInfo) err, list, total := new({{.PackageName}}.{{.StructName}}).GetInfoList(pageInfo) if err != nil { diff --git a/server/router/sys_authority.go b/server/router/sys_authority.go index f93b794c..933f10e9 100644 --- a/server/router/sys_authority.go +++ b/server/router/sys_authority.go @@ -11,6 +11,7 @@ func InitAuthorityRouter(Router *gin.RouterGroup) { { AuthorityRouter.POST("createAuthority", v1.CreateAuthority) //创建角色 AuthorityRouter.POST("deleteAuthority", v1.DeleteAuthority) //删除角色 + AuthorityRouter.PUT("updateAuthority", v1.UpdateAuthority) //更新角色 AuthorityRouter.POST("getAuthorityList", v1.GetAuthorityList) //获取角色列表 AuthorityRouter.POST("setDataAuthority", v1.SetDataAuthority) //设置角色资源权限 } diff --git a/server/router/sys_user.go b/server/router/sys_user.go index d59660a3..7c4369ca 100644 --- a/server/router/sys_user.go +++ b/server/router/sys_user.go @@ -13,5 +13,6 @@ func InitUserRouter(Router *gin.RouterGroup) { UserRouter.POST("uploadHeaderImg", v1.UploadHeaderImg) //上传头像 UserRouter.POST("getUserList", v1.GetUserList) // 分页获取用户列表 UserRouter.POST("setUserAuthority", v1.SetUserAuthority) //设置用户权限 + UserRouter.DELETE("deleteUser", v1.DeleteUser) //删除用户 } } diff --git a/server/service/exa_breakpoint_continue.go b/server/service/exa_breakpoint_continue.go index 8c3d8a90..a0a6236c 100644 --- a/server/service/exa_breakpoint_continue.go +++ b/server/service/exa_breakpoint_continue.go @@ -14,7 +14,8 @@ import ( // @param chunkTotal int // @return err error // @return file ExaFile -func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err error, file model.ExaFile) { + +func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err error, file model.ExaFile) { var cfile model.ExaFile cfile.FileMd5 = fileMd5 cfile.FileName = fileName @@ -31,7 +32,6 @@ func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err err } } - // @title CreateFileChunk // @description create a chunk of the file, 创建文件切片记录 // @auth (2020/04/05 20:22) @@ -39,6 +39,7 @@ func FindOrCreateFile(fileMd5 string, fileName string, chunkTotal int) (err err // @param fileChunkPath string // @param fileChunkNumber int // @return error + func CreateFileChunk(id uint, fileChunkPath string, fileChunkNumber int) error { var chunk model.ExaFileChunk chunk.FileChunkPath = fileChunkPath @@ -55,6 +56,7 @@ func CreateFileChunk(id uint, fileChunkPath string, fileChunkNumber int) error { // @param fileName string // @param filePath string // @return error + func FileCreateComplete(fileMd5 string, fileName string, filePath string) error { var file model.ExaFile upDateFile := make(map[string]interface{}) @@ -71,6 +73,7 @@ func FileCreateComplete(fileMd5 string, fileName string, filePath string) error // @param FileName string // @param FilePath string // @return error + func DeleteFileChunk(fileMd5 string, fileName string, filePath string) error { var chunks []model.ExaFileChunk var file model.ExaFile diff --git a/server/service/exa_customer.go b/server/service/exa_customer.go index 2e9d927c..05e9310c 100644 --- a/server/service/exa_customer.go +++ b/server/service/exa_customer.go @@ -11,6 +11,7 @@ import ( // @param e model.ExaCustomer // @auth (2020/04/05 20:22) // @return err error + func CreateExaCustomer(e model.ExaCustomer) (err error) { err = global.GVA_DB.Create(&e).Error return err @@ -21,6 +22,7 @@ func CreateExaCustomer(e model.ExaCustomer) (err error) { // @auth (2020/04/05 20:22) // @param e *model.ExaCustomer // @return error + func DeleteExaCustomer(e model.ExaCustomer) (err error) { err = global.GVA_DB.Delete(e).Error return err @@ -31,6 +33,7 @@ func DeleteExaCustomer(e model.ExaCustomer) (err error) { // @param e *model.ExaCustomer // @auth (2020/04/05 20:22) // @return error + func UpdateExaCustomer(e *model.ExaCustomer) (err error) { err = global.GVA_DB.Save(e).Error return err @@ -42,6 +45,7 @@ func UpdateExaCustomer(e *model.ExaCustomer) (err error) { // @param id uint // @return error // @return customer ExaCustomer + func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) { err = global.GVA_DB.Where("id = ?", id).First(&customer).Error return @@ -53,6 +57,7 @@ func GetExaCustomer(id uint) (err error, customer model.ExaCustomer) { // @param sysUserAuthorityID string // @param info PageInfo // @return error + func GetCustomerInfoList(sysUserAuthorityID string, info request.PageInfo) (err error, list interface{}, total int) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) diff --git a/server/service/exa_file_upload_download.go b/server/service/exa_file_upload_download.go index a9a314d1..af2117a3 100644 --- a/server/service/exa_file_upload_download.go +++ b/server/service/exa_file_upload_download.go @@ -11,6 +11,7 @@ import ( // @param file model.ExaFileUploadAndDownload // @auth (2020/04/05 20:22) // @return error + func Upload(file model.ExaFileUploadAndDownload) error { err := global.GVA_DB.Create(&file).Error return err @@ -21,6 +22,7 @@ func Upload(file model.ExaFileUploadAndDownload) error { // @auth (2020/04/05 20:22) // @param id uint // @return error + func FindFile(id uint) (error, model.ExaFileUploadAndDownload) { var file model.ExaFileUploadAndDownload err := global.GVA_DB.Where("id = ?", id).First(&file).Error @@ -32,6 +34,7 @@ func FindFile(id uint) (error, model.ExaFileUploadAndDownload) { // @auth (2020/04/05 20:22) // @param file model.ExaFileUploadAndDownload // @return error + func DeleteFile(file model.ExaFileUploadAndDownload) error { err := global.GVA_DB.Where("id = ?", file.ID).Unscoped().Delete(file).Error return err @@ -44,6 +47,7 @@ func DeleteFile(file model.ExaFileUploadAndDownload) error { // @return err error // @return list error // @return total error + func GetFileRecordInfoList(info request.PageInfo) (err error, list interface{}, total int) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) diff --git a/server/service/jwt_black_list.go b/server/service/jwt_black_list.go index 236cfcbd..73c163e8 100644 --- a/server/service/jwt_black_list.go +++ b/server/service/jwt_black_list.go @@ -10,6 +10,7 @@ import ( // @param jwtList model.JwtBlacklist // @auth (2020/04/05 20:22) // @return err error + func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) { err = global.GVA_DB.Create(&jwtList).Error return @@ -21,6 +22,7 @@ func JsonInBlacklist(jwtList model.JwtBlacklist) (err error) { // @param jwt string // @param jwtList model.JwtBlacklist // @return err error + func IsBlacklist(jwt string, jwtList model.JwtBlacklist) bool { isNotFound := global.GVA_DB.Where("jwt = ?", jwt).First(&jwtList).RecordNotFound() return !isNotFound @@ -32,6 +34,7 @@ func IsBlacklist(jwt string, jwtList model.JwtBlacklist) bool { // @param userName string // @return err error // @return redisJWT string + func GetRedisJWT(userName string) (err error, redisJWT string) { redisJWT, err = global.GVA_REDIS.Get(userName).Result() return err, redisJWT @@ -43,6 +46,7 @@ func GetRedisJWT(userName string) (err error, redisJWT string) { // @param jwtList model.JwtBlacklist // @param userName string // @return err error + func SetRedisJWT(jwtList model.JwtBlacklist, userName string) (err error) { err = global.GVA_REDIS.Set(userName, jwtList.Jwt, 1000*1000*1000*60*60*24*7).Err() return err diff --git a/server/service/sys_api.go b/server/service/sys_api.go index 71e25897..b3bf56c1 100644 --- a/server/service/sys_api.go +++ b/server/service/sys_api.go @@ -12,6 +12,7 @@ import ( // @auth (2020/04/05 20:22) // @param api model.SysApi // @return error + func CreateApi(api model.SysApi) (err error) { findOne := global.GVA_DB.Where("path = ? AND method = ?", api.Path, api.Method).Find(&model.SysApi{}).Error if findOne == nil { @@ -27,6 +28,7 @@ func CreateApi(api model.SysApi) (err error) { // @param api model.SysApi // @auth (2020/04/05 20:22) // @return error + func DeleteApi(api model.SysApi) (err error) { err = global.GVA_DB.Delete(api).Error ClearCasbin(1, api.Path, api.Method) @@ -43,6 +45,7 @@ func DeleteApi(api model.SysApi) (err error) { // @return err error // @return list interface{} // @return total int + func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc bool) (err error, list interface{}, total int) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) @@ -91,6 +94,7 @@ func GetAPIInfoList(api model.SysApi, info request.PageInfo, order string, desc // @auth (2020/04/05 20:22) // @return err error // @return apis []SysApi + func GetAllApis() (err error, apis []model.SysApi) { err = global.GVA_DB.Find(&apis).Error return @@ -102,6 +106,7 @@ func GetAllApis() (err error, apis []model.SysApi) { // @param api model.SysApi // @param id float64 // @return error + func GetApiById(id float64) (err error, api model.SysApi) { err = global.GVA_DB.Where("id = ?", id).First(&api).Error return @@ -112,6 +117,7 @@ func GetApiById(id float64) (err error, api model.SysApi) { // @auth (2020/04/05 20:22) // @param api model.SysApi // @return error + func UpdateApi(api model.SysApi) (err error) { var oldA model.SysApi diff --git a/server/service/sys_authority.go b/server/service/sys_authority.go index 39788fea..fc4de8a8 100644 --- a/server/service/sys_authority.go +++ b/server/service/sys_authority.go @@ -13,17 +13,31 @@ import ( // @param auth model.SysAuthority // @return error // @return authority model.SysAuthority + func CreateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) { err = global.GVA_DB.Create(&auth).Error return err, auth } +// @title UpdateAuthority +// @description 更改一个角色 +// @auth (2020/04/05 20:22) +// @param auth model.SysAuthority +// @return error +// @return authority model.SysAuthority + +func UpdateAuthority(auth model.SysAuthority) (err error, authority model.SysAuthority) { + err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).First(&model.SysAuthority{}).Updates(&auth).Error + return err, auth +} + // @title DeleteAuthority // @description 删除角色 // @auth (2020/04/05 20:22) // @param auth model.SysAuthority // @return error // 删除角色 + func DeleteAuthority(auth *model.SysAuthority) (err error) { err = global.GVA_DB.Where("authority_id = ?", auth.AuthorityId).Find(&model.SysUser{}).Error if err == nil { @@ -51,6 +65,7 @@ func DeleteAuthority(auth *model.SysAuthority) (err error) { // @param info request.PaveInfo // @return error // 分页获取数据 + func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, total int) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) @@ -71,6 +86,7 @@ func GetAuthorityInfoList(info request.PageInfo) (err error, list interface{}, t // @param auth model.SysAuthority // @return error // @param authority model.SysAuthority + func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority) { err = global.GVA_DB.Preload("DataAuthorityId").Where("authority_id = ?", auth.AuthorityId).First(&sa).Error return err, sa @@ -81,6 +97,7 @@ func GetAuthorityInfo(auth model.SysAuthority) (err error, sa model.SysAuthority // @auth (2020/04/05 20:22) // @param auth model.SysAuthority // @return error + func SetDataAuthority(auth model.SysAuthority) error { var s model.SysAuthority global.GVA_DB.Preload("DataAuthorityId").First(&s, "authority_id = ?", auth.AuthorityId) @@ -93,6 +110,7 @@ func SetDataAuthority(auth model.SysAuthority) error { // @auth (2020/04/05 20:22) // @param auth *model.SysAuthority // @return error + func SetMenuAuthority(auth *model.SysAuthority) error { var s model.SysAuthority global.GVA_DB.Preload("SysBaseMenus").First(&s, "authority_id = ?", auth.AuthorityId) @@ -105,6 +123,7 @@ func SetMenuAuthority(auth *model.SysAuthority) error { // @auth (2020/04/05 20:22) // @param auth *model.SysAuthority // @return error + func findChildrenAuthority(authority *model.SysAuthority) (err error) { err = global.GVA_DB.Preload("DataAuthorityId").Where("parent_id = ?", authority.AuthorityId).Find(&authority.Children).Error if len(authority.Children) > 0 { diff --git a/server/service/sys_auto_code.go b/server/service/sys_auto_code.go index f5501f05..1df73211 100644 --- a/server/service/sys_auto_code.go +++ b/server/service/sys_auto_code.go @@ -12,6 +12,7 @@ import ( // @auth (2020/04/05 20:22) // @param autoCode model.AutoCodeStruct // @return err error + func CreateTemp(autoCode model.AutoCodeStruct) (err error) { basePath := "./resource/template" modelTmpl, err := template.ParseFiles(basePath + "/te/model.go.tpl") diff --git a/server/service/sys_base_menu.go b/server/service/sys_base_menu.go index 5c47cf55..093699d7 100644 --- a/server/service/sys_base_menu.go +++ b/server/service/sys_base_menu.go @@ -11,7 +11,8 @@ import ( // @auth (2020/04/05 20:22) // @param id float64 // @return err error -func DeleteBaseMenu(id float64) (err error) { + +func DeleteBaseMenu(id float64) (err error) { err = global.GVA_DB.Where("parent_id = ?", id).First(&model.SysBaseMenu{}).Error if err != nil { var menu model.SysBaseMenu @@ -31,9 +32,13 @@ func DeleteBaseMenu(id float64) (err error) { // @description 更新路由 // @auth (2020/04/05 20:22) // @param menu model.SysBaseMenu -// @return err error -func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { +// @return err errorgetMenu + +func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { + var oldMenu model.SysBaseMenu upDateMap := make(map[string]interface{}) + upDateMap["keep_alive"] = menu.KeepAlive + upDateMap["default_menu"] = menu.DefaultMenu upDateMap["parent_id"] = menu.ParentId upDateMap["path"] = menu.Path upDateMap["name"] = menu.Name @@ -42,7 +47,15 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { upDateMap["title"] = menu.Title upDateMap["icon"] = menu.Icon upDateMap["sort"] = menu.Sort - err = global.GVA_DB.Where("id = ?", menu.ID).Find(&model.SysBaseMenu{}).Updates(upDateMap).Error + db := global.GVA_DB.Where("id = ?", menu.ID).Find(&oldMenu) + if oldMenu.Name != menu.Name { + notSame := global.GVA_DB.Where("id <> ? AND name = ?", menu.ID, menu.Name).First(&model.SysBaseMenu{}).RecordNotFound() + if !notSame { + global.GVA_LOG.Debug("存在相同name修改失败") + return errors.New("存在相同name修改失败") + } + } + err = db.Updates(upDateMap).Error global.GVA_LOG.Debug("菜单修改时候,关联菜单err:%v", err) return err } @@ -52,6 +65,7 @@ func UpdateBaseMenu(menu model.SysBaseMenu) (err error) { // @auth (2020/04/05 20:22) // @param id float64 // @return err error + func GetBaseMenuById(id float64) (err error, menu model.SysBaseMenu) { err = global.GVA_DB.Where("id = ?", id).First(&menu).Error return diff --git a/server/service/sys_casbin.go b/server/service/sys_casbin.go index 29b1e26f..976dfd60 100644 --- a/server/service/sys_casbin.go +++ b/server/service/sys_casbin.go @@ -17,6 +17,7 @@ import ( // @param authorityId string // @param casbinInfos []CasbinInfo // @return error + func UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error { ClearCasbin(0, authorityId) for _, v := range casbinInfos { @@ -40,6 +41,7 @@ func UpdateCasbin(authorityId string, casbinInfos []request.CasbinInfo) error { // @auth (2020/04/05 20:22) // @param cm model.CasbinModel // @return bool + func AddCasbin(cm model.CasbinModel) bool { e := Casbin() return e.AddPolicy(cm.AuthorityId, cm.Path, cm.Method) @@ -53,6 +55,7 @@ func AddCasbin(cm model.CasbinModel) bool { // @param oldMethod string // @param newMethod string // @return error + func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod string) error { var cs []model.CasbinModel err := global.GVA_DB.Table("casbin_rule").Where("v1 = ? AND v2 = ?", oldPath, oldMethod).Find(&cs).Updates(map[string]string{ @@ -67,6 +70,7 @@ func UpdateCasbinApi(oldPath string, newPath string, oldMethod string, newMethod // @auth (2020/04/05 20:22) // @param authorityId string // @return []string + func GetPolicyPathByAuthorityId(authorityId string) (pathMaps []map[string]string) { e := Casbin() list := e.GetFilteredPolicy(0, authorityId) @@ -85,6 +89,7 @@ func GetPolicyPathByAuthorityId(authorityId string) (pathMaps []map[string]strin // @param v int // @param p string // @return bool + func ClearCasbin(v int, p ...string) bool { e := Casbin() return e.RemoveFilteredPolicy(v, p...) @@ -94,6 +99,7 @@ func ClearCasbin(v int, p ...string) bool { // @title Casbin // @description store to DB, 持久化到数据库 引入自定义规则 // @auth (2020/04/05 20:22) + func Casbin() *casbin.Enforcer { a := gormadapter.NewAdapterByDB(global.GVA_DB) e := casbin.NewEnforcer(global.GVA_CONFIG.Casbin.ModelPath, a) @@ -108,6 +114,7 @@ func Casbin() *casbin.Enforcer { // @param fullNameKey1 string // @param key2 string // @return bool + func ParamsMatch(fullNameKey1 string, key2 string) bool { key1 := strings.Split(fullNameKey1, "?")[0] //剥离路径后再使用casbin的keyMatch2 @@ -120,6 +127,7 @@ func ParamsMatch(fullNameKey1 string, key2 string) bool { // @param args ...interface{} // @return interface{} // @return error + func ParamsMatchFunc(args ...interface{}) (interface{}, error) { name1 := args[0].(string) name2 := args[1].(string) diff --git a/server/service/sys_menu.go b/server/service/sys_menu.go index 02b11da2..6c9bd140 100644 --- a/server/service/sys_menu.go +++ b/server/service/sys_menu.go @@ -13,9 +13,9 @@ import ( // @param authorityId string // @return err error // @return menus []model.SysMenu -func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { - sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ?" +func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { + sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? AND authority_menu.parent_id = ? ORDER BY authority_menu.sort ASC" err = global.GVA_DB.Raw(sql, authorityId, 0).Scan(&menus).Error for i := 0; i < len(menus); i++ { err = getChildrenList(&menus[i], sql) @@ -29,6 +29,7 @@ func GetMenuTree(authorityId string) (err error, menus []model.SysMenu) { // @param menu *model.SysMenu // @param sql string // @return err error + func getChildrenList(menu *model.SysMenu, sql string) (err error) { err = global.GVA_DB.Raw(sql, menu.AuthorityId, menu.MenuId).Scan(&menu.Children).Error for i := 0; i < len(menu.Children); i++ { @@ -44,6 +45,7 @@ func getChildrenList(menu *model.SysMenu, sql string) (err error) { // @return err error // @return list interface{} // @return total int + func GetInfoList(info request.PageInfo) (err error, list interface{}, total int) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) @@ -61,6 +63,7 @@ func GetInfoList(info request.PageInfo) (err error, list interface{}, total int) // @auth (2020/04/05 20:22) // @param menu *model.SysBaseMenu // @return err error + func getBaseChildrenList(menu *model.SysBaseMenu) (err error) { err = global.GVA_DB.Where("parent_id = ?", menu.ID).Order("sort", true).Find(&menu.Children).Error for i := 0; i < len(menu.Children); i++ { @@ -75,6 +78,7 @@ func getBaseChildrenList(menu *model.SysBaseMenu) (err error) { // @param menu *model.SysBaseMenu // @return err error //增加基础路由 + func AddBaseMenu(menu model.SysBaseMenu) (err error) { findOne := global.GVA_DB.Where("name = ?", menu.Name).Find(&model.SysBaseMenu{}).Error if findOne != nil { @@ -90,6 +94,7 @@ func AddBaseMenu(menu model.SysBaseMenu) (err error) { // @auth (2020/04/05 20:22) // @return err error // @return menus []SysBaseMenu + func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) { err = global.GVA_DB.Where(" parent_id = ?", 0).Order("sort", true).Find(&menus).Error for i := 0; i < len(menus); i++ { @@ -104,6 +109,7 @@ func GetBaseMenuTree() (err error, menus []model.SysBaseMenu) { // @param menus []model.SysBaseMenu // @param authorityId string // @return error + func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) { var auth model.SysAuthority auth.AuthorityId = authorityId @@ -118,8 +124,9 @@ func AddMenuAuthority(menus []model.SysBaseMenu, authorityId string) (err error) // @param authorityId string // @return err error // @return menus []SysBaseMenu + func GetMenuAuthority(authorityId string) (err error, menus []model.SysMenu) { - sql := "SELECT authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ?" + sql := "SELECT authority_menu.keep_alive,authority_menu.default_menu,authority_menu.created_at,authority_menu.updated_at,authority_menu.deleted_at,authority_menu.menu_level,authority_menu.parent_id,authority_menu.path,authority_menu.`name`,authority_menu.hidden,authority_menu.component,authority_menu.title,authority_menu.icon,authority_menu.sort,authority_menu.menu_id,authority_menu.authority_id FROM authority_menu WHERE authority_menu.authority_id = ? ORDER BY authority_menu.sort ASC" err = global.GVA_DB.Raw(sql, authorityId).Scan(&menus).Error return err, menus } diff --git a/server/service/sys_system.go b/server/service/sys_system.go index 4934ee21..b8a96b16 100644 --- a/server/service/sys_system.go +++ b/server/service/sys_system.go @@ -12,16 +12,17 @@ import ( // @auth (2020/04/05 20:22) // @return err error // @return conf Server + func GetSystemConfig() (err error, conf config.Server) { return nil, global.GVA_CONFIG } - // @title SetSystemConfig // @description set system config, 设置配置文件 // @auth (2020/04/05 20:22) // @param system model.System // @return err error + func SetSystemConfig(system model.System) (err error) { cs := utils.StructToMap(system.Config) for k, v := range cs { @@ -29,4 +30,4 @@ func SetSystemConfig(system model.System) (err error) { } err = global.GVA_VP.WriteConfig() return err -} \ No newline at end of file +} diff --git a/server/service/sys_user.go b/server/service/sys_user.go index 09c03323..4c340860 100644 --- a/server/service/sys_user.go +++ b/server/service/sys_user.go @@ -15,6 +15,7 @@ import ( // @param u model.SysUser // @return err error // @return userInter *SysUser + func Register(u model.SysUser) (err error, userInter model.SysUser) { var user model.SysUser //判断用户名是否注册 @@ -37,6 +38,7 @@ func Register(u model.SysUser) (err error, userInter model.SysUser) { // @param u *model.SysUser // @return err error // @return userInter *SysUser + func Login(u *model.SysUser) (err error, userInter *model.SysUser) { var user model.SysUser u.Password = utils.MD5V([]byte(u.Password)) @@ -55,6 +57,7 @@ func Login(u *model.SysUser) (err error, userInter *model.SysUser) { // @param newPassword string // @return err error // @return userInter *SysUser + func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter *model.SysUser) { var user model.SysUser //后期修改jwt+password模式 @@ -70,6 +73,7 @@ func ChangePassword(u *model.SysUser, newPassword string) (err error, userInter // @return err error // @return list interface{} // @return total int + func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total int) { limit := info.PageSize offset := info.PageSize * (info.Page - 1) @@ -85,11 +89,25 @@ func GetUserInfoList(info request.PageInfo) (err error, list interface{}, total // @param uuid UUID // @param authorityId string // @return err error + func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) { err = global.GVA_DB.Where("uuid = ?", uuid).First(&model.SysUser{}).Update("authority_id", authorityId).Error return err } +// @title SetUserAuthority +// @description set the authority of a certain user, 设置一个用户的权限 +// @auth (2020/04/05 20:22) +// @param uuid UUID +// @param authorityId string +// @return err error + +func DeleteUser(id float64) (err error) { + var user model.SysUser + err = global.GVA_DB.Where("id = ?", id).Delete(&user).Error + return err +} + // @title UploadHeaderImg // @description upload avatar, 用户头像上传更新地址 // @auth (2020/04/05 20:22) @@ -97,6 +115,7 @@ func SetUserAuthority(uuid uuid.UUID, authorityId string) (err error) { // @param filePath string // @return err error // @return userInter *SysUser + func UploadHeaderImg(uuid uuid.UUID, filePath string) (err error, userInter *model.SysUser) { var user model.SysUser err = global.GVA_DB.Where("uuid = ?", uuid).First(&user).Update("header_img", filePath).First(&user).Error diff --git a/server/service/sys_workflow.go b/server/service/sys_workflow.go index 8c2fe968..8b34aade 100644 --- a/server/service/sys_workflow.go +++ b/server/service/sys_workflow.go @@ -10,6 +10,7 @@ import ( // @auth (2020/04/05 20:22) // @param wk model.SysWorkflow // @return error + func Create(wk model.SysWorkflow) error { err := global.GVA_DB.Create(&wk).Error return err diff --git a/server/utils/directory.go b/server/utils/directory.go index 98128bf7..29fdda92 100644 --- a/server/utils/directory.go +++ b/server/utils/directory.go @@ -10,6 +10,7 @@ import ( // @auth (2020/04/05 20:22) // @param path string // @return err error + func PathExists(path string) (bool, error) { _, err := os.Stat(path) if err == nil { @@ -26,6 +27,7 @@ func PathExists(path string) (bool, error) { // @auth (2020/04/05 20:22) // @param dirs string // @return err error + func CreateDir(dirs ...string) (err error) { for _, v := range dirs { exist, err := PathExists(v) @@ -48,9 +50,11 @@ func CreateDir(dirs ...string) (err error) { } return err } + // @title cwd // @description 获取当前工作目录 // @return string + func CWD() string { path, err := os.Executable() if err != nil { diff --git a/web/src/api/authority.js b/web/src/api/authority.js index f900f602..c1463df0 100644 --- a/web/src/api/authority.js +++ b/web/src/api/authority.js @@ -59,4 +59,19 @@ export const setDataAuthority = (data) => { method: 'post', data }) +} + +// @Summary 修改角色 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body model.SysAuthority true "修改角色" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"设置成功"}" +// @Router /authority/setDataAuthority [post] +export const updateAuthority = (data) => { + return service({ + url: "/authority/updateAuthority", + method: 'put', + data + }) } \ No newline at end of file diff --git a/web/src/api/user.js b/web/src/api/user.js index fbe51f12..70b8d3fc 100644 --- a/web/src/api/user.js +++ b/web/src/api/user.js @@ -77,4 +77,21 @@ export const setUserAuthority = (data) => { method: 'post', data: data }) +} + + +// @Tags SysUser +// @Summary 删除用户 +// @Security ApiKeyAuth +// @accept application/json +// @Produce application/json +// @Param data body request.SetUserAuth true "删除用户" +// @Success 200 {string} string "{"success":true,"data":{},"msg":"修改成功"}" +// @Router /user/deleteUser [delete] +export const deleteUser = (data) => { + return service({ + url: "/user/deleteUser", + method: 'delete', + data: data + }) } \ No newline at end of file diff --git a/web/src/components/mixins/infoList.js b/web/src/components/mixins/infoList.js index ee820ef4..ed0e303a 100644 --- a/web/src/components/mixins/infoList.js +++ b/web/src/components/mixins/infoList.js @@ -24,9 +24,5 @@ export default { this.page = table.data.page this.pageSize = table.data.pageSize } - }, - mounted() { - this.getTableData() } - } \ No newline at end of file diff --git a/web/src/style/main.scss b/web/src/style/main.scss index 05116234..09bfe405 100644 --- a/web/src/style/main.scss +++ b/web/src/style/main.scss @@ -530,11 +530,12 @@ ol, li { list-style-type: none; } -.el-table__body-wrapper{ - tr{ - td{ - .cell{ - .el-button+.el-button{ + +.el-table__body-wrapper { + tr { + td { + .cell { + .el-button+.el-button { margin-left: 0; } } @@ -542,210 +543,204 @@ li { } } - // navbar -.aside{ -.el-scrollbar { - .el-scrollbar__view { - .el-menu-vertical{ - background-color: #001529; - } - .el-menu-item:hover i, - .el-menu-item:hover span{ - color:#fff; - } - li{ - background-color: #001529; - - ul{ - .el-menu-item{ - background-color: #000408; - height: 44px; - line-height: 44px; - } - - .is-active{ - background-color:#1890ff; - } +.aside { + .el-scrollbar { + .el-scrollbar__view { + .el-menu-vertical { + background-color: #001529; + } + .el-menu-item:hover i, + .el-menu-item:hover span { + color: #fff; + } + li { + background-color: #001529; + ul { + .el-menu-item { + background-color: #000408; + height: 44px; + line-height: 44px; + } + .is-active { + background-color: #1890ff; + } + } + } + .el-submenu__title:hover { + background-color: #001529; + } + .el-submenu__title:hover i, + .el-submenu__title:hover span { + color: #fff; + } + .el-menu--inline { + border-left: 5px solid #2c3b41; + } } - } - .el-submenu__title:hover{ - background-color: #001529; - } - .el-submenu__title:hover i, - .el-submenu__title:hover span{ - color:#fff; - } - - .el-menu--inline{ - border-left: 5px solid #2c3b41; - } } - } } // layout - .layout-cont{ - .main-cont{ - position: relative; - &.el-main { - background-color: #ecf0f5; - padding: 0; - } - .breadcrumb{ - background-color: #fff; - padding: 0 0 15px 15px; - } +.layout-cont { + .main-cont { + position: relative; + &.el-main { + background-color: #ecf0f5; + padding: 0; + } + .breadcrumb { + background-color: #fff; + padding: 0 0 15px 15px; } } +} - .admin-box { - padding: 15px 20px; - .el-button{ - padding: 7px 10px; - } - .el-input__inner{ - height: 30px; - line-height: 30px; - } - .el-input__icon{ - line-height: 30px; - } +.admin-box { + padding: 15px 20px; + .el-button { + padding: 7px 10px; } - .button-box{ - background: #fff; - border: 1px solid #ebeef5; - border-bottom: none; + .el-input__inner { + height: 30px; + line-height: 30px; + } + .el-input__icon { + line-height: 30px; + } +} - } - - .search-term{ - background: #fff; - padding: 0 15px; - border-left: 1px solid #ebeef5; - border-right: 1px solid #ebeef5; - } - +.button-box { + background: #fff; + border: 1px solid #ebeef5; + border-bottom: none; +} +.search-term { + background: #fff; + padding: 0 15px; + border-left: 1px solid #ebeef5; + border-right: 1px solid #ebeef5; +} // table -.has-gutter{ - tr{ - th{ +.has-gutter { + tr { + th { background-color: #fafafa; } } } -.el-table--striped{ - .el-table__body{ - tr.el-table__row--striped{ - td{ + +.el-table--striped { + .el-table__body { + tr.el-table__row--striped { + td { background: #fff!important; } } } -} -.el-table th, .el-table tr{ +} + +.el-table th, +.el-table tr { background-color: #fafafa; } -.el-pagination{ + +.el-pagination { .btn-prev, - .btn-next{ + .btn-next { border: 1px solid #ddd; border-radius: 4px; } - .el-pager{ - - - li{ + .el-pager { + li { color: #666; font-size: 12px; margin: 0 5px; border: 1px solid #ddd; border-radius: 4px; } - } + } } - - // el-form -.el-form{ +.el-form { background-color: #fff; padding: 10px 0; } -.el-row{ + +.el-row { padding: 10px 0; - .el-col>label{ - - line-height: 30px; - text-align: right; - width: 80%; - padding-right: 15px; - display: inline-block; - + .el-col>label { + line-height: 30px; + text-align: right; + width: 80%; + padding-right: 15px; + display: inline-block; } - - .line{ + .line { line-height: 30px; text-align: center; } } + // edit_container -.edit_container{ +.edit_container { background-color: #fff; padding: 15px; .el-button { margin: 15px 0; } } -.edit{ + +.edit { background-color: #fff; - padding: 15px; + padding: 15px; .el-button { margin: 15px 0; } } + // upload-demo .upload-demo, -.upload{ +.upload { background-color: #fff; - padding: 15px; - .el-upload-list__item-status-label{ + padding: 15px; + .el-upload-list__item-status-label { right: 0; left: 120px; } - .el-upload__tip{ + .el-upload__tip { margin: 10px 0; - } + } } // system -.system{ +.system { padding: 15px; - .el-input__inner{ + .el-input__inner { width: 80%; } } // 导航 #app { - .el-container{ + .el-container { position: relative; height: 100%; width: 100%; - } .el-container.mobile.openside { position: fixed; top: 0; } - .hideside{ - .aside{ + .hideside { + .aside { width: 54px!important; } } - .el-aside{ + .el-aside { -webkit-transition: width .2s; transition: width .2s; width: 220px; @@ -759,66 +754,57 @@ li { z-index: 1001; overflow: hidden; } - - .mobile.hideside{ - .el-aside{ + .mobile.hideside { + .el-aside { // pointer-events: none; -webkit-transition-duration: .2s; transition-duration: .2s; - -webkit-transform: translate3d(-210px,0,0); - transform: translate3d(-220px,0,0); + -webkit-transform: translate3d(-210px, 0, 0); + transform: translate3d(-220px, 0, 0); } - } - - .mobile{ - .el-aside{ + .mobile { + .el-aside { -webkit-transition: -webkit-transform .28s; transition: -webkit-transform .28s; transition: transform .28s; - transition: transform .28s,-webkit-transform .28s; + transition: transform .28s, -webkit-transform .28s; width: 210px!important } } - - - .el-container{ + .el-container { position: relative; height: 100%; width: 100%; - .el-aside{ + .el-aside { // transition: none; - .aside { + .aside { background: #000; - .el-menu{ + .el-menu { border-right: none; } } } } - - .main-cont.el-main{ + .main-cont.el-main { min-height: 100%; -webkit-transition: margin-left .28s; transition: margin-left .28s; margin-left: 220px; position: relative; } - - - .hideside{ - .main-cont.el-main{ + .hideside { + .main-cont.el-main { margin-left: 54px; } } - .mobile { - .main-cont.el-main{ + .mobile { + .main-cont.el-main { margin-left: 0px; } - } - .openside.mobile{ - .shadowBg{ + .openside.mobile { + .shadowBg { background: #000; opacity: .3; width: 100%; @@ -829,22 +815,39 @@ li { left: 0; } } - } -.el-menu--vertical{ - .el-menu{ + +.el-menu .el-menu--inline { + background: #2c3b41; +} + +.el-submenu .el-submenu { + background-color: #000408 !important; +} + +.aside .el-scrollbar .el-scrollbar__view .el-submenu__title:hover { + background-color: #000408 !important; +} + +.el-submenu { + .aside .el-scrollbar .el-scrollbar__view .el-submenu__title:hover { + background-color: #000408 !important; + } +} + +.el-menu--vertical { + .el-menu { margin-left: -8px; - background-color:rgb(48,65,86); - .el-menu-item{ - background-color:rgb(48,65,86); + background-color: rgb(48, 65, 86); + .el-menu-item { + background-color: rgb(48, 65, 86); } - .el-menu-item:focus, - .el-menu-item:hover{ + .el-menu-item:focus, + .el-menu-item:hover { background-color: #263445; color: #fff; } } } -// 导航***** - +// 导航***** \ No newline at end of file diff --git a/web/src/view/example/customer/customer.vue b/web/src/view/example/customer/customer.vue index ccb94f65..90c9d0d0 100644 --- a/web/src/view/example/customer/customer.vue +++ b/web/src/view/example/customer/customer.vue @@ -121,6 +121,10 @@ export default { }, closeDialog(){ this.dialogFormVisible = false + this.form = { + customerName:"", + customerPhoneData:"" + } }, async deleteCustomer(row){ this.visible = false @@ -149,7 +153,7 @@ export default { } if(res.code == 0){ - this.dialogFormVisible = false + this.closeDialog() this.getTableData() } }, @@ -157,6 +161,9 @@ export default { this.type = "create" this.dialogFormVisible = true } + }, + created(){ + this.getTableData() } } diff --git a/web/src/view/example/upload/upload.vue b/web/src/view/example/upload/upload.vue index 78d14868..f1d96e28 100644 --- a/web/src/view/example/upload/upload.vue +++ b/web/src/view/example/upload/upload.vue @@ -145,6 +145,9 @@ export default { downloadFile(row) { downloadImage(row.url, row.name) } + }, + created(){ + this.getTableData() } } \ No newline at end of file diff --git a/web/src/view/layout/index.vue b/web/src/view/layout/index.vue index 35632400..e504da6f 100644 --- a/web/src/view/layout/index.vue +++ b/web/src/view/layout/index.vue @@ -67,7 +67,12 @@ :to="{ path: item.path }" 暂时注释不用--> - + + + + + + diff --git a/web/src/view/superAdmin/api/api.vue b/web/src/view/superAdmin/api/api.vue index 98d383fc..29ebc6f8 100644 --- a/web/src/view/superAdmin/api/api.vue +++ b/web/src/view/superAdmin/api/api.vue @@ -181,6 +181,12 @@ export default { }, initForm() { this.$refs.apiForm.resetFields() + this.form= { + path: '', + apiGroup: '', + method: '', + description: '' + } }, closeDialog() { this.initForm() @@ -253,7 +259,7 @@ export default { if (res.code == 0) { this.$message({ type: 'success', - message: '添加成功', + message: '编辑成功', showClose: true }) } @@ -285,6 +291,9 @@ export default { const target = methodOptions.filter(item => item.value === value)[0] return target && `${target.type}` } + }, + created(){ + this.getTableData() } } diff --git a/web/src/view/superAdmin/authority/authority.vue b/web/src/view/superAdmin/authority/authority.vue index 5cf9e9e9..56cfde31 100644 --- a/web/src/view/superAdmin/authority/authority.vue +++ b/web/src/view/superAdmin/authority/authority.vue @@ -16,19 +16,34 @@ - - + + + + - + @@ -62,7 +77,8 @@ import { getAuthorityList, deleteAuthority, - createAuthority + createAuthority, + updateAuthority } from '@/api/authority' import Menus from '@/view/superAdmin/authority/components/menus' @@ -75,8 +91,13 @@ export default { mixins: [infoList], data() { return { + AuthorityOption:[{ + authorityId:"0", + authorityName:"根角色" + }], listApi: getAuthorityList, drawer: false, + dialogType:"add", activeRow: {}, activeUserId: 0, dialogTitle:"新增角色", @@ -137,6 +158,11 @@ export default { // 初始化表单 initForm() { this.$refs.authorityForm.resetFields() + this.form = { + authorityId: '', + authorityName: '', + parentId: '0' + } }, // 关闭窗口 closeDialog() { @@ -156,28 +182,96 @@ export default { } this.$refs.authorityForm.validate(async valid => { if (valid) { - const res = await createAuthority(this.form) - if (res.code == 0) { - this.$message({ - type: 'success', - message: '添加成功!' - }) - this.getTableData() - this.closeDialog() + switch (this.dialogType) { + case 'add': + { + const res = await createAuthority(this.form) + if (res.code == 0) { + this.$message({ + type: 'success', + message: '添加成功!' + }) + this.getTableData() + this.closeDialog() + } + } + break; + case 'edit': + { + const res = await updateAuthority(this.form) + if (res.code == 0) { + this.$message({ + type: 'success', + message: '添加成功!' + }) + this.getTableData() + this.closeDialog() + } + } + break; + default: + break; } + this.initForm() this.dialogFormVisible = false } }) }, + getAuthorityList(AuthorityData){ + AuthorityData.map(item=>{ + this.AuthorityOption.push({ + authorityId:item.authorityId, + authorityName:item.authorityName + }) + if(item.children){ + this.getAuthorityList(item.children) + } + }) + }, + findAuthoritySelf(authority,authData,outData){ + authData.some(item=>{ + if(item.authorityId == authority.authorityId){ + outData.push(item) + return true + } + this.findAuthoritySelf(authority,item.children,outData) + }) + }, + findAllChild(authority,array){ + authority&&authority.map(item=>{ + array.push(item.authorityId) + this.findAllChild(item.children,array) + }) + }, + canSelect(authority){ + const array = [] + const arrayIds = [] + this.findAuthoritySelf({authorityId:this.form.authorityId},this.tableData,array) + this.findAllChild(array,arrayIds) + return arrayIds.indexOf(authority.authorityId)>-1 + }, // 增加角色 addAuthority(parentId) { + this. dialogTitle = "新增角色" + this.dialogType = "add" this.form.parentId = parentId this.dialogFormVisible = true + }, + // 增加角色 + editAuthority(row) { + this. dialogTitle = "编辑角色" + this.dialogType = "edit" + for(let key in this.form){ + this.form[key] = row[key] + } + this.dialogFormVisible = true } }, - created() { + async created() { this.pageSize = 999 + await this.getTableData() + this.getAuthorityList(this.tableData) } } diff --git a/web/src/view/superAdmin/menu/menu.vue b/web/src/view/superAdmin/menu/menu.vue index 4fce4fdb..7c742f0e 100644 --- a/web/src/view/superAdmin/menu/menu.vue +++ b/web/src/view/superAdmin/menu/menu.vue @@ -47,7 +47,21 @@ - + + + + @@ -55,12 +69,18 @@ - + - + + + + + + +
新增菜单需要在角色管理内配置权限才可使用