This commit is contained in:
tanyp 2023-07-13 14:21:16 +08:00
parent 4417a6fad6
commit 116b3f2bdf

View File

@ -11,7 +11,7 @@
Target Server Version : 80032
File Encoding : 65001
Date: 07/07/2023 17:19:18
Date: 13/07/2023 14:20:00
*/
SET NAMES utf8mb4;
@ -144,7 +144,7 @@ INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/菜单管理/
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/菜单管理/修改.ms', '{\r\n \"properties\" : { },\r\n \"id\" : \"30ec3c62eca74e5695f2f96ddd6c1e10\",\r\n \"script\" : null,\r\n \"groupId\" : \"67b2ce258e24491194b74992958c74aa\",\r\n \"name\" : \"修改\",\r\n \"createTime\" : 1688627065519,\r\n \"updateTime\" : 1688517306762,\r\n \"lock\" : \"1\",\r\n \"createBy\" : null,\r\n \"updateBy\" : \"admin\",\r\n \"path\" : \"update\",\r\n \"method\" : \"POST\",\r\n \"parameters\" : [ ],\r\n \"options\" : [ ],\r\n \"requestBody\" : \"\",\r\n \"headers\" : [ ],\r\n \"paths\" : [ ],\r\n \"responseBody\" : null,\r\n \"description\" : null,\r\n \"requestBodyDefinition\" : null,\r\n \"responseBodyDefinition\" : null\r\n}\r\n================================\r\nreturn db.update(\"\"\"\r\n update sys_menu set \r\n update_time = now()\r\n ?{body.parentId, ,`parent_id` = #{body.parentId}}\r\n ?{body.name, ,`name` = #{body.name}}\r\n ?{body.url, ,`url` = #{body.url}}\r\n ?{body.icon, ,`icon` = #{body.icon}}\r\n ?{body.chineseName, ,`chinese_name` = #{body.chineseName}}\r\n ?{body.englishName, ,`english_name` = #{body.englishName}}\r\n ?{body.permission, ,`permission` = #{body.permission}}\r\n ?{body.sort, ,`sort` = #{body.sort}}\r\n ?{body.component, ,`component` = #{body.component}}\r\n ?{body.componentType, ,`component_type` = #{body.componentType}}\r\n ?{body.openMode != null, ,`open_mode` = #{body.openMode}}\r\n ?{body.isDel != null, ,`is_del` = #{body.isDel}}\r\n ?{body.keepAlive != null, ,`keep_alive` = #{body.keepAlive}}\r\n ?{body.isShow != null, ,`is_show` = #{body.isShow}}\r\n ?{body.remarks, ,`remarks` = #{body.remarks}}\r\n where id = #{body.id}\r\n\"\"\")');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/菜单管理/删除.ms', '{\r\n \"properties\" : { },\r\n \"id\" : \"26ff3d166de34575a3bf6d41465c80e7\",\r\n \"script\" : null,\r\n \"groupId\" : \"67b2ce258e24491194b74992958c74aa\",\r\n \"name\" : \"删除\",\r\n \"createTime\" : 1688627065524,\r\n \"updateTime\" : 1688517304774,\r\n \"lock\" : \"1\",\r\n \"createBy\" : null,\r\n \"updateBy\" : \"admin\",\r\n \"path\" : \"delete/{id}\",\r\n \"method\" : \"GET\",\r\n \"parameters\" : [ ],\r\n \"options\" : [ ],\r\n \"requestBody\" : \"\",\r\n \"headers\" : [ ],\r\n \"paths\" : [ ],\r\n \"responseBody\" : null,\r\n \"description\" : null,\r\n \"requestBodyDefinition\" : null,\r\n \"responseBodyDefinition\" : null\r\n}\r\n================================\r\nvar val = db.transaction(()=>{\r\n var list = db.select(\"\"\"\r\n with recursive t as ( \r\n select id from sys_menu where id = #{id}\r\n union all\r\n select a.id from sys_menu a \r\n join t on a.parent_id = t.id\r\n )\r\n select id from t\r\n \"\"\")\r\n\r\n for(item in list){\r\n db.table(\"sys_menu\").where().eq(\"id\", item.id).delete()\r\n db.table(\"sys_role_menu\").where().eq(\"menu_id\", item.id)\r\n }\r\n return \"OK\"\r\n});\r\n\r\nreturn val;');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/菜单管理/菜单树.ms', '{\r\n \"properties\" : { },\r\n \"id\" : \"f90132707c3e401c926eaf2ada6ec81a\",\r\n \"script\" : null,\r\n \"groupId\" : \"67b2ce258e24491194b74992958c74aa\",\r\n \"name\" : \"菜单树\",\r\n \"createTime\" : null,\r\n \"updateTime\" : 1688721005404,\r\n \"lock\" : \"1\",\r\n \"createBy\" : null,\r\n \"updateBy\" : null,\r\n \"path\" : \"tree\",\r\n \"method\" : \"GET\",\r\n \"parameters\" : [ ],\r\n \"options\" : [ ],\r\n \"requestBody\" : \"\",\r\n \"headers\" : [ ],\r\n \"paths\" : [ ],\r\n \"responseBody\" : null,\r\n \"description\" : null,\r\n \"requestBodyDefinition\" : null,\r\n \"responseBodyDefinition\" : null\r\n}\r\n================================\r\nimport \'cn.dev33.satoken.stp.StpUtil\';\r\n\r\nvar userId = StpUtil.getLoginId();\r\n\r\nvar menus = db.select(\"\"\"\r\n select m.* \r\n from sys_menu m\r\n where m.is_del = 0\r\n ?{isShow != null, and m.is_show = #{isShow}}\r\n ?{userId && userId != 1, and m.id in (\r\n select rm.menu_id \r\n from sys_role_menu rm\r\n left join sys_user_role ur on ur.role_id = rm.role_id\r\n where ur.user_id = #{userId})\r\n }\r\n order by sort asc\r\n\"\"\")\r\n\r\nif (menus.length == 1) {\r\n return menus;\r\n}\r\nmenus.filter(item => {\r\n var arr = menus.filter(child => item.id == child.parentId);\r\n arr.length > 0 ? (item.children = arr) : false;\r\n return item.parentId == 0;\r\n})\r\n\r\nreturn menus.filter(item => item.parentId == 0);');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/菜单管理/菜单路由.ms', '{\r\n \"properties\" : { },\r\n \"id\" : \"62020bd7a49949378e90ce2d14fef8f7\",\r\n \"script\" : null,\r\n \"groupId\" : \"67b2ce258e24491194b74992958c74aa\",\r\n \"name\" : \"菜单路由\",\r\n \"createTime\" : null,\r\n \"updateTime\" : 1688720686950,\r\n \"lock\" : \"1\",\r\n \"createBy\" : null,\r\n \"updateBy\" : null,\r\n \"path\" : \"menus\",\r\n \"method\" : \"GET\",\r\n \"parameters\" : [ ],\r\n \"options\" : [ ],\r\n \"requestBody\" : \"\",\r\n \"headers\" : [ ],\r\n \"paths\" : [ ],\r\n \"responseBody\" : null,\r\n \"description\" : null,\r\n \"requestBodyDefinition\" : null,\r\n \"responseBodyDefinition\" : null\r\n}\r\n================================\r\nimport \'cn.dev33.satoken.stp.StpUtil\';\r\n\r\nvar userId = StpUtil.getLoginId();\r\n\r\nvar list = db.select(\"\"\"\r\n select m.* \r\n from sys_menu m\r\n where m.is_del = 0\r\n and m.is_show = 1\r\n ?{userId && userId != 1, and m.id in (\r\n select rm.menu_id \r\n from sys_role_menu rm\r\n left join sys_user_role ur on ur.role_id = rm.role_id\r\n where ur.user_id = #{userId})\r\n }\r\n order by sort asc\r\n\"\"\")\r\n\r\nvar menus = []\r\nlist.each(item => {\r\n menus.push({\r\n id: item.id,\r\n parentId: item.parentId,\r\n path: item.url,\r\n name: item.name,\r\n icon: item.icon,\r\n sort: item.sort,\r\n component: item.component == null || item.component == \'\' ? \"Layout\" : item.component,\r\n componentType: item.componentType,\r\n isShow: item.isShow,\r\n meta: {\r\n title: item.chineseName,\r\n keepAlive: item.keepAlive,\r\n isShow: item.isShow,\r\n id: item.id,\r\n openMode: item.openMode,\r\n type: item.componentType,\r\n }\r\n })\r\n})\r\n\r\nif (menus.length == 1) {\r\n return menus;\r\n}\r\nmenus.filter(item => {\r\n var arr = menus.filter(child => item.id == child.parentId);\r\n arr.length > 0 ? (item.children = arr) : false;\r\n return item.parentId == 0;\r\n})\r\n\r\nvar _menus = menus.filter(item => item.parentId == 0);\r\n_menus.each(item=>{\r\n if(!item.children){\r\n item.children = [{\r\n id: item.id,\r\n parentId: item.parentId,\r\n path: item.path,\r\n name: item.name,\r\n icon: item.icon,\r\n sort: item.sort,\r\n component: item.component,\r\n componentType: item.componentType,\r\n isShow: item.isShow,\r\n meta: item.meta\r\n }]\r\n }\r\n})\r\n\r\n\r\nreturn _menus;');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/菜单管理/菜单路由.ms', '{\r\n \"properties\" : { },\r\n \"id\" : \"62020bd7a49949378e90ce2d14fef8f7\",\r\n \"script\" : null,\r\n \"groupId\" : \"67b2ce258e24491194b74992958c74aa\",\r\n \"name\" : \"菜单路由\",\r\n \"createTime\" : null,\r\n \"updateTime\" : 1689229170425,\r\n \"lock\" : \"1\",\r\n \"createBy\" : null,\r\n \"updateBy\" : null,\r\n \"path\" : \"menus\",\r\n \"method\" : \"GET\",\r\n \"parameters\" : [ ],\r\n \"options\" : [ ],\r\n \"requestBody\" : \"\",\r\n \"headers\" : [ ],\r\n \"paths\" : [ ],\r\n \"responseBody\" : null,\r\n \"description\" : null,\r\n \"requestBodyDefinition\" : null,\r\n \"responseBodyDefinition\" : null\r\n}\r\n================================\r\nimport \'cn.dev33.satoken.stp.StpUtil\';\r\n\r\nvar userId = StpUtil.getLoginId();\r\n\r\nvar list = db.select(\"\"\"\r\n select m.* \r\n from sys_menu m\r\n where m.is_del = 0\r\n and m.is_show = 1\r\n ?{userId && userId != 1, and m.id in (\r\n select rm.menu_id \r\n from sys_role_menu rm\r\n left join sys_user_role ur on ur.role_id = rm.role_id\r\n where ur.user_id = #{userId})\r\n }\r\n order by sort asc\r\n\"\"\")\r\n\r\nvar menus = []\r\nlist.each(item => {\r\n menus.push({\r\n id: item.id,\r\n parentId: item.parentId,\r\n path: item.url,\r\n name: item.name,\r\n icon: item.icon,\r\n sort: item.sort,\r\n component: item.component == null || item.component == \'\' ? \"Layout\" : item.component,\r\n componentType: item.componentType,\r\n isShow: item.isShow,\r\n meta: {\r\n title: item.chineseName,\r\n keepAlive: item.keepAlive,\r\n isShow: item.isShow,\r\n id: item.id,\r\n openMode: item.openMode,\r\n type: item.componentType,\r\n }\r\n })\r\n})\r\n\r\nif (menus.length == 1) {\r\n return menus;\r\n}\r\nmenus.filter(item => {\r\n var arr = menus.filter(child => item.id == child.parentId);\r\n arr.length > 0 ? (item.children = arr) : false;\r\n return item.parentId == 0;\r\n})\r\n\r\nvar _menus = menus.filter(item => item.parentId == 0);\r\n_menus.each(item=>{\r\n if(!item.children){\r\n item.children = [{\r\n id: item.id,\r\n parentId: item.parentId,\r\n path: item.path,\r\n name: item.name,\r\n icon: item.icon,\r\n sort: item.sort,\r\n component: item.component,\r\n componentType: item.componentType,\r\n isShow: item.isShow,\r\n meta: item.meta\r\n }]\r\n item.componentType = 0;\r\n }\r\n})\r\n\r\n\r\nreturn _menus;');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/角色管理/', 'this is directory');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/角色管理/group.json', '{\r\n \"properties\" : { },\r\n \"id\" : \"e3e7b79651ef4023bf808869bda70162\",\r\n \"name\" : \"角色管理\",\r\n \"type\" : \"api\",\r\n \"parentId\" : \"acff5ad7aae64de2acb03e1d16a58ce2\",\r\n \"path\" : \"role\",\r\n \"createTime\" : 1688627065453,\r\n \"updateTime\" : null,\r\n \"createBy\" : null,\r\n \"updateBy\" : null,\r\n \"paths\" : [ ],\r\n \"options\" : [ ]\r\n}');
INSERT INTO `magic_api_file` VALUES ('/tansci-api/api/系统管理/角色管理/保存.ms', '{\r\n \"properties\" : { },\r\n \"id\" : \"963fbdab7f1e4c5482d94467994e076b\",\r\n \"script\" : null,\r\n \"groupId\" : \"e3e7b79651ef4023bf808869bda70162\",\r\n \"name\" : \"保存\",\r\n \"createTime\" : 1688627065553,\r\n \"updateTime\" : 1688517313199,\r\n \"lock\" : \"1\",\r\n \"createBy\" : null,\r\n \"updateBy\" : \"admin\",\r\n \"path\" : \"save\",\r\n \"method\" : \"POST\",\r\n \"parameters\" : [ ],\r\n \"options\" : [ ],\r\n \"requestBody\" : \"\",\r\n \"headers\" : [ ],\r\n \"paths\" : [ ],\r\n \"responseBody\" : null,\r\n \"description\" : null,\r\n \"requestBodyDefinition\" : null,\r\n \"responseBodyDefinition\" : null\r\n}\r\n================================\r\nvar code = uuid().substring(0,10)\r\nreturn db.insert(\"\"\"\r\n INSERT INTO sys_role(`id`, `name`, `code`, `permission`, `sort`, `is_del`, `creator`, `update_time`, `create_time`, `remarks`) \r\n VALUES \r\n (uuid(), #{body.name},#{code},#{body.permission},#{body.sort},0,#{body.creator},now(),now(),#{body.remarks})\r\n\"\"\")');