-- 创建 page
INSERT INTO `_page` (`pageId`,`pageName`,`pageFile`,`pageType`,`sort`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT '{{pageId}}','数据历史',NULL,'showInAvatarMenu','1','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,'','{{pageId}}','selectOnUseItemListByTable','✅获取指定表的使用中的数据列表','service',NULL,'{\"service\": \"{{pageId}}\", \"serviceFunction\": \"selectOnUseItemListByTable\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"pageId\": \"{{pageId}}\", \"actionId\": \"selectOnUseItemListByTable\", \"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\": {\"table\": \"_file\"}}, \"packageId\": \"1651553114260_3320095\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"packageId\": \"1651553114260_3320095\", \"timestamp\": \"2022-05-03T12:45:14+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-03T12:45:15+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='selectOnUseItemListByTable');
INSERT INTO `_resource` (`accessControlTable`,`resourceHook`,`pageId`,`actionId`,`desc`,`resourceType`,`appDataSchema`,`resourceData`,`requestDemo`,`responseDemo`,`operation`,`operationByUserId`,`operationByUser`,`operationAt`) SELECT NULL,NULL,'{{pageId}}','selectDeletedItemListByTable','✅获取指定表的已删除的数据列表','service',NULL,'{\"service\": \"{{pageId}}\", \"serviceFunction\": \"selectDeletedItemListByTable\"}','{}','{}','update',NULL,NULL,'2022-02-21T19:58:21+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='selectDeletedItemListByTable');
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\": \"_record_history\", \"operation\": \"select\"}','{\"appData\": {\"appId\": \"demo_advanced\", \"where\": {\"table\": \"_file\", \"recordId\": 35}, \"pageId\": \"{{pageId}}\", \"orderBy\": [{\"order\": \"desc\", \"column\": \"id\"}], \"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\": \"1651553125120_6309180\", \"packageType\": \"httpRequest\"}','{\"status\": \"success\", \"packageId\": \"1651553125120_6309180\", \"timestamp\": \"2022-05-03T12:45:25+08:00\", \"packageType\": \"httpResponse\"}','update',NULL,NULL,'2022-05-03T12:45:25+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}}','restoreRecordByRecordHistory','✅还原数据','service',NULL,'{\"service\": \"{{pageId}}\", \"serviceFunction\": \"restoreRecordByRecordHistory\"}','{}','{}','update',NULL,NULL,'2022-02-21T00:47:08+08:00' FROM DUAL WHERE NOT EXISTS (SELECT `pageId` FROM `_resource` WHERE `pageId`='{{pageId}}' AND `actionId`='restoreRecordByRecordHistory');