diff --git a/data/magic-api/api/系统管理/组件/保存代码.ms b/data/magic-api/api/系统管理/组件/保存代码.ms index 01869d3..f28475a 100644 --- a/data/magic-api/api/系统管理/组件/保存代码.ms +++ b/data/magic-api/api/系统管理/组件/保存代码.ms @@ -5,7 +5,7 @@ "groupId" : "6f106ebdee21489db34b956f7770ff03", "name" : "保存代码", "createTime" : null, - "updateTime" : 1709621424466, + "updateTime" : 1709773549985, "lock" : null, "createBy" : null, "updateBy" : null, @@ -22,11 +22,21 @@ "responseBodyDefinition" : null } ================================ +import 'cn.dev33.satoken.stp.StpUtil'; + +var currentUserId = StpUtil.getLoginId() if(db.selectInt("select count(1) from sys_dynamic_component where id = #{id} and is_del = 0") == 0){ exit 0, '文件不存在' } +db.table("sys_dynamic_component_history").insert({ + id: uuid(), + componentId: id, + sourceCode, + createBy: currentUserId +}) + return db.table("sys_dynamic_component").where().eq("id",id).update({ sourceCode, compileJs, diff --git a/data/magic-api/api/系统管理/组件/组件历史.ms b/data/magic-api/api/系统管理/组件/组件历史.ms new file mode 100644 index 0000000..f46dbe4 --- /dev/null +++ b/data/magic-api/api/系统管理/组件/组件历史.ms @@ -0,0 +1,32 @@ +{ + "properties" : { }, + "id" : "ddcc356a6e3d4ed6b901be999bdb90c0", + "script" : null, + "groupId" : "6f106ebdee21489db34b956f7770ff03", + "name" : "组件历史", + "createTime" : null, + "updateTime" : 1709803968033, + "lock" : null, + "createBy" : null, + "updateBy" : null, + "path" : "/history", + "method" : "POST", + "parameters" : [ ], + "options" : [ ], + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {\n \"total\": 164,\n \"list\": [\n {\n \"id\": \"0474e1a3d44247f0ac09bcae02bdcff2\",\n \"createDate\": \"2024-03-07 11:34:35\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"04b98d9889bf451d8d398cef3d32f899\",\n \"createDate\": \"2024-03-07 14:09:20\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"04e7c8c5fb81490ca9e4cffc12e9a622\",\n \"createDate\": \"2024-03-07 12:15:09\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"05db93da5de1442bafd1b3638693f1da\",\n \"createDate\": \"2024-03-07 14:12:43\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"0749a7bbd1c4473cacf3a74175288f74\",\n \"createDate\": \"2024-03-07 11:10:23\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"07b8216e94c4439688843f177f43404f\",\n \"createDate\": \"2024-03-07 11:11:29\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"081394d27c8b43f98ebdf3b092265384\",\n \"createDate\": \"2024-03-07 15:02:30\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"0affca0c150942e5bab5d796c4db14aa\",\n \"createDate\": \"2024-03-07 14:04:52\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"0dc4027ff5e64dae91e6cbec41605e3d\",\n \"createDate\": \"2024-03-07 11:16:29\",\n \"createby\": \"admin\"\n },\n {\n \"id\": \"0f929ebc16d74c2488425ff46fc3d289\",\n \"createDate\": \"2024-03-07 14:12:30\",\n \"createby\": \"admin\"\n }\n ]\n },\n \"timestamp\": 1709803746297,\n \"executeTime\": 94\n}", + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : null +} +================================ +return db.page(""" + select + id, + create_date, + (select username from sys_user where id = sdch.create_by) createBy + from sys_dynamic_component_history sdch + where component_id = #{componentId} +""") \ No newline at end of file diff --git a/data/magic-api/api/系统管理/组件/获取历史代码详情.ms b/data/magic-api/api/系统管理/组件/获取历史代码详情.ms new file mode 100644 index 0000000..b869b9b --- /dev/null +++ b/data/magic-api/api/系统管理/组件/获取历史代码详情.ms @@ -0,0 +1,27 @@ +{ + "properties" : { }, + "id" : "f21ff197058a47e0ba1e1c6c714081ce", + "script" : null, + "groupId" : "6f106ebdee21489db34b956f7770ff03", + "name" : "获取历史代码详情", + "createTime" : null, + "updateTime" : 1709805913373, + "lock" : null, + "createBy" : null, + "updateBy" : null, + "path" : "/history/detail", + "method" : "GET", + "parameters" : [ ], + "options" : [ ], + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : null, + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : null +} +================================ +return db.selectValue(""" + select source_code from sys_dynamic_component_history where id = #{id} and is_del = 0 +""") \ No newline at end of file