-- 创建 page
INSERT INTO `_page` (`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT '{{pageId}}','权限管理','showInAvatarMenu','11','insert',NULL,NULL,NULL FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_page` WHERE `pageId`='{{pageId}}');
-- 创建 resource
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','selectItemList','✅权限管理页-查询已配置权限列表','sql',NULL,'{\"table\": \"_user_group_role\", \"operation\": \"select\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"where\": {\"userId\": \"001\"}, \"pageId\": \"{{pageId}}\", \"actionId\": \"selectItemList\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {}}, \"packageId\": \"1651476230231_7262893\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": [{\"id\": 597, \"roleId\": \"teacher\", \"userId\": \"001\", \"groupId\": \"adminGroup\", \"operation\": \"jhInsert\", \"operationAt\": \"2022-02-21T00:41:54+08:00\", \"operationByUser\": \"admin\", \"operationByUserId\": \"admin\"}, {\"id\": 598, \"roleId\": \"appAdmin\", \"userId\": \"001\", \"groupId\": \"adminGroup\", \"operation\": \"jhInsert\", \"operationAt\": \"2022-04-25T14:39:44+08:00\", \"operationByUser\": \"admin\", \"operationByUserId\": \"admin\"}], \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectItemList\", \"resultData\": {\"rows\": [{\"id\": 597, \"roleId\": \"teacher\", \"userId\": \"001\", \"groupId\": \"adminGroup\", \"operation\": \"jhInsert\", \"operationAt\": \"2022-02-21T00:41:54+08:00\", \"operationByUser\": \"admin\", \"operationByUserId\": \"admin\"}, {\"id\": 598, \"roleId\": \"appAdmin\", \"userId\": \"001\", \"groupId\": \"adminGroup\", \"operation\": \"jhInsert\", \"operationAt\": \"2022-04-25T14:39:44+08:00\", \"operationByUser\": \"admin\", \"operationByUserId\": \"admin\"}]}}, \"packageId\": \"1651476230231_7262893\", \"timestamp\": \"2022-05-02T15:23:50+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-02T15:23:51+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='selectItemList');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','selectUser','✅权限管理页-查询用户','sql',NULL,'{\"table\": \"_user\", \"operation\": \"select\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectUser\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {}}, \"packageId\": \"1651476237658_7645348\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"packageId\": \"1651476237658_7645348\", \"timestamp\": \"2022-05-02T15:23:58+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-02T15:23:58+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='selectUser');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','selectGroup','✅权限管理页-查询群组','sql',NULL,'{\"table\": \"_group\", \"operation\": \"select\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectGroup\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {}}, \"packageId\": \"1651476088200_6618462\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": [{\"id\": 1, \"groupId\": \"adminGroup\", \"groupDesc\": \"Ã§Â®Â¡Ã§ÂÂÃ§Â»Â\", \"groupName\": \"Ã§Â®Â¡Ã§ÂÂÃ§Â»Â\", \"operation\": \"jhUpdate\", \"groupAvatar\": null, \"groupExtend\": \"{}\", \"operationAt\": \"2022-02-18T20:45:25+08:00\", \"operationByUser\": \"admin\", \"operationByUserId\": \"admin\"}], \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectGroup\", \"resultData\": {\"rows\": [{\"id\": 1, \"groupId\": \"adminGroup\", \"groupDesc\": \"Ã§Â®Â¡Ã§ÂÂÃ§Â»Â\", \"groupName\": \"Ã§Â®Â¡Ã§ÂÂÃ§Â»Â\", \"operation\": \"jhUpdate\", \"groupAvatar\": null, \"groupExtend\": \"{}\", \"operationAt\": \"2022-02-18T20:45:25+08:00\", \"operationByUser\": \"admin\", \"operationByUserId\": \"admin\"}]}}, \"packageId\": \"1651476088200_6618462\", \"timestamp\": \"2022-05-02T15:21:29+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-02T15:21:29+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='selectGroup');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','insertItem','✅权限管理页-创建权限配置','sql',NULL,'{\"table\": \"_user_group_role\", \"operation\": \"jhInsert\", \"whereCondition\": \"\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"insertItem\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {\"roleId\": \"teacher\", \"userId\": \"admin2\", \"groupId\": \"adminGroup\"}}, \"packageId\": \"1651149371608_1485871\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": [599], \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"insertItem\", \"resultData\": {\"rows\": [599]}}, \"packageId\": \"1651149371608_1485871\", \"timestamp\": \"2022-04-28T20:36:12+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-28T20:36:12+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='insertItem');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','updateItem','✅权限管理页-更新权限配置','sql',NULL,'{\"table\": \"_user_group_role\", \"operation\": \"jhUpdate\", \"whereParamsCondition\": \".where(function() {this.where(whereParams)})\"}','{}','{}','update',NULL,NULL,'2022-02-18T12:09:29+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='updateItem');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','deleteItem','✅权限管理页-删除权限配置','sql',NULL,'{\"table\": \"_user_group_role\", \"operation\": \"jhDelete\", \"whereParamsCondition\": \".where(function() {this.where(whereParams)})\"}','{}','{}','update',NULL,NULL,'2022-02-18T21:03:41+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='deleteItem');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','selectRole','✅权限管理页-查询角色','sql',NULL,'{\"table\": \"_role\", \"operation\": \"select\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectRole\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {}}, \"packageId\": \"1651476088200_7966907\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": [{\"id\": 1, \"roleId\": \"appAdmin\", \"roleDesc\": null, \"roleName\": \"Ã§Â³Â»Ã§Â»ÂÃ§Â®Â¡Ã§ÂÂÃ¥ÂÂ\", \"operation\": null, \"operationAt\": null, \"operationByUser\": null, \"operationByUserId\": null}, {\"id\": 2, \"roleId\": \"teacher\", \"roleDesc\": null, \"roleName\": \"Ã¨ÂÂÃ¥Â¸Â\", \"operation\": null, \"operationAt\": null, \"operationByUser\": null, \"operationByUserId\": null}, {\"id\": 3, \"roleId\": \"student\", \"roleDesc\": null, \"roleName\": \"Ã¥Â­Â¦Ã§ÂÂ\", \"operation\": null, \"operationAt\": null, \"operationByUser\": null, \"operationByUserId\": null}], \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectRole\", \"resultData\": {\"rows\": [{\"id\": 1, \"roleId\": \"appAdmin\", \"roleDesc\": null, \"roleName\": \"Ã§Â³Â»Ã§Â»ÂÃ§Â®Â¡Ã§ÂÂÃ¥ÂÂ\", \"operation\": null, \"operationAt\": null, \"operationByUser\": null, \"operationByUserId\": null}, {\"id\": 2, \"roleId\": \"teacher\", \"roleDesc\": null, \"roleName\": \"Ã¨ÂÂÃ¥Â¸Â\", \"operation\": null, \"operationAt\": null, \"operationByUser\": null, \"operationByUserId\": null}, {\"id\": 3, \"roleId\": \"student\", \"roleDesc\": null, \"roleName\": \"Ã¥Â­Â¦Ã§ÂÂ\", \"operation\": null, \"operationAt\": null, \"operationByUser\": null, \"operationByUserId\": null}]}}, \"packageId\": \"1651476088200_7966907\", \"timestamp\": \"2022-05-02T15:21:29+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-02T15:21:29+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='selectRole');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','insertUser','✅权限管理页-添加用户','service',NULL,'{\"service\": \"userManagement\", \"serviceFunction\": \"addUser\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"insertUser\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {\"userId\": \"admin2\", \"username\": \"admin2\", \"clearTextPassword\": \"123456\"}}, \"packageId\": \"1651149323428_7722305\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"insertUser\", \"resultData\": {}}, \"packageId\": \"1651149323428_7722305\", \"timestamp\": \"2022-04-28T20:35:24+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-28T20:35:24+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='insertUser');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','insertGroup','✅权限管理页-添加群组','sql',NULL,'{\"table\": \"_group\", \"operation\": \"jhInsert\"}','{}','{}','update',NULL,NULL,'2022-02-18T19:55:57+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='insertGroup');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','insertRole','✅权限管理页-添加角色','sql',NULL,'{\"table\": \"_role\", \"operation\": \"jhInsert\"}','{}','{}','update',NULL,NULL,'2022-02-18T20:00:37+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='insertRole');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,'{ \"before\": [], \"after\": [{ \"service\": \"{{pageId}}\", \"serviceFunction\": \"deleteUserGroupRole\" }] }','{{pageId}}','deleteUser','✅权限管理页-删除用户','sql',NULL,'{\"table\": \"_user\", \"operation\": \"jhDelete\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"where\": {\"userId\": \"admin2\"}, \"pageId\": \"{{pageId}}\", \"actionId\": \"deleteUser\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {}}, \"packageId\": \"1651149383707_8632195\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": 1, \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"deleteUser\", \"resultData\": {\"rows\": 1}}, \"packageId\": \"1651149383707_8632195\", \"timestamp\": \"2022-04-28T20:36:24+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-28T20:36:24+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='deleteUser');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,'{ \"before\": [], \"after\": [{ \"service\": \"{{pageId}}\", \"serviceFunction\": \"deleteUserGroupRole\" }] }','{{pageId}}','deleteGroup','✅权限管理页-删除群组','sql',NULL,'{\"table\": \"_group\", \"operation\": \"jhDelete\"}','{}','{}','update',NULL,NULL,'2022-02-18T19:56:11+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='deleteGroup');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,'{ \"before\": [], \"after\": [{ \"service\": \"{{pageId}}\", \"serviceFunction\": \"deleteUserGroupRole\" }] }','{{pageId}}','deleteRole','✅权限管理页-删除角色','sql',NULL,'{\"table\": \"_role\", \"operation\": \"jhDelete\"}','{}','{}','update',NULL,NULL,'2022-02-18T20:04:23+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='deleteRole');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','updateUser','✅权限管理页-更新用户','sql',NULL,'{\"table\": \"_user\", \"operation\": \"jhUpdate\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"where\": {\"id\": 68}, \"pageId\": \"{{pageId}}\", \"actionId\": \"updateUser\", \"userAgent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36\", \"actionData\": {\"config\": null, \"userId\": \"001\", \"md5Salt\": \"ZsPkQcHpYZQT\", \"password\": \"b9e96d6ebc84dd51f2bd1fb56a79d8cb\", \"userType\": \"common\", \"username\": \"Ã¥Â°ÂÃ¥ÂÂ\", \"operation\": \"jhUpdate\", \"idSequence\": \"26260000\", \"userStatus\": \"active\", \"operationAt\": \"2022-05-02T15:21:34+08:00\", \"initPassword\": null, \"operationByUser\": \"adminName\", \"clearTextPassword\": \"1234567\", \"operationByUserId\": \"admin\"}}, \"packageId\": \"1651476236716_5991856\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": 1, \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"updateUser\", \"resultData\": {\"rows\": 1}}, \"packageId\": \"1651476236716_5991856\", \"timestamp\": \"2022-05-02T15:23:57+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-02T15:23:57+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='updateUser');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','updateGroup','✅权限管理页-更新群组','sql',NULL,'{\"table\": \"_group\", \"operation\": \"jhUpdate\"}','{}','{}','update',NULL,NULL,'2022-02-18T20:45:26+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='updateGroup');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','updateRole','✅权限管理页-更新角色','sql',NULL,'{\"table\": \"_role\", \"operation\": \"jhUpdate\"}','{}','{}','update',NULL,NULL,'2022-02-18T19:56:37+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='updateRole');