diff --git a/data/magic-api/api/系统管理/组件/保存tree.ms b/data/magic-api/api/系统管理/组件/保存tree.ms index 75079e3..8b6360e 100644 --- a/data/magic-api/api/系统管理/组件/保存tree.ms +++ b/data/magic-api/api/系统管理/组件/保存tree.ms @@ -5,7 +5,7 @@ "groupId" : "6f106ebdee21489db34b956f7770ff03", "name" : "保存tree", "createTime" : null, - "updateTime" : 1709468623502, + "updateTime" : 1709539934808, "lock" : null, "createBy" : null, "updateBy" : null, @@ -22,7 +22,16 @@ "responseBodyDefinition" : null } ================================ -return db.table("sys_dynamic_component").primary("id").saveOrUpdate({ - pid, - name -}) \ No newline at end of file +let data +if(id){ + data = {id, name} + if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and name = #{name} and id != #{id}") > 0){ + exit 0, '名称不能重复' + } +}else{ + data = {pid, name} + if(db.selectInt("select count(1) from sys_dynamic_component where is_del = 0 and name = #{name}") > 0){ + exit 0, '名称不能重复' + } +} +return db.table("sys_dynamic_component").primary("id").saveOrUpdate(data) \ 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..01869d3 --- /dev/null +++ b/data/magic-api/api/系统管理/组件/保存代码.ms @@ -0,0 +1,34 @@ +{ + "properties" : { }, + "id" : "ac35656c8123461e8c01e5bfa604a0ee", + "script" : null, + "groupId" : "6f106ebdee21489db34b956f7770ff03", + "name" : "保存代码", + "createTime" : null, + "updateTime" : 1709621424466, + "lock" : null, + "createBy" : null, + "updateBy" : null, + "path" : "/saveCode", + "method" : "POST", + "parameters" : [ ], + "options" : [ ], + "requestBody" : "", + "headers" : [ ], + "paths" : [ ], + "responseBody" : null, + "description" : null, + "requestBodyDefinition" : null, + "responseBodyDefinition" : null +} +================================ + +if(db.selectInt("select count(1) from sys_dynamic_component where id = #{id} and is_del = 0") == 0){ + exit 0, '文件不存在' +} + +return db.table("sys_dynamic_component").where().eq("id",id).update({ + sourceCode, + compileJs, + compileCss +}) \ No newline at end of file diff --git a/data/magic-api/api/系统管理/组件/列表.ms b/data/magic-api/api/系统管理/组件/列表.ms index beccd17..20b2aaf 100644 --- a/data/magic-api/api/系统管理/组件/列表.ms +++ b/data/magic-api/api/系统管理/组件/列表.ms @@ -5,7 +5,7 @@ "groupId" : "6f106ebdee21489db34b956f7770ff03", "name" : "列表", "createTime" : null, - "updateTime" : 1648611595092, + "updateTime" : 1709626054292, "lock" : "0", "createBy" : null, "updateBy" : null, @@ -16,7 +16,7 @@ "requestBody" : "", "headers" : [ ], "paths" : [ ], - "responseBody" : "{\n \"code\": 200,\n \"message\": \"success\",\n \"data\": [{\n \"name\": \"data-test-list\",\n \"code\": \"\\n \\n