-- 创建 page
INSERT INTO `_page` (`pageId`,`pageName`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT '{{pageId}}','用户管理','showInAvatarMenu','6','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\", \"operation\": \"select\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"where\": {}, \"pageId\": \"{{pageId}}\", \"orderBy\": [{\"order\": \"desc\", \"column\": \"operationAt\"}], \"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\": \"1651221207913_1347965\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"packageId\": \"1651221207913_1347965\", \"timestamp\": \"2022-04-29T16:33:28+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-29T16:33:28+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}}','insertItem','✅用户管理-查询信息','service',NULL,'{\"service\": \"{{pageId}}\", \"serviceFunction\": \"addUser\"}','{\"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\": {\"userId\": \"002\", \"username\": \"test\", \"clearTextPassword\": \"123456\"}}, \"packageId\": \"1651134960232_5022887\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"insertItem\", \"resultData\": {}}, \"packageId\": \"1651134960232_5022887\", \"timestamp\": \"2022-04-28T16:36:00+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-28T16:36:00+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}}','resetUserPassword','✅用户管理-修改密码','service',NULL,'{\"service\": \"{{pageId}}\", \"serviceFunction\": \"resetUserPassword\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"resetUserPassword\", \"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\": \"002\", \"clearTextPassword\": \"12345678\"}}, \"packageId\": \"1651135041149_9148309\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"resetUserPassword\", \"resultData\": {}}, \"packageId\": \"1651135041149_9148309\", \"timestamp\": \"2022-04-28T16:37:21+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-28T16:37:21+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='resetUserPassword');
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\", \"operation\": \"jhUpdate\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"where\": {\"userId\": \"002\"}, \"pageId\": \"{{pageId}}\", \"actionId\": \"updateItem\", \"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\": {\"userStatus\": \"active\"}}, \"packageId\": \"1651221207122_4349367\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"appData\": {\"rows\": 1, \"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"updateItem\", \"resultData\": {\"rows\": 1}}, \"packageId\": \"1651221207122_4349367\", \"timestamp\": \"2022-04-29T16:33:27+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-04-29T16:33:27+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='updateItem');