From eb06b45d3a1613fbf0ec39e66ef111d71622611e Mon Sep 17 00:00:00 2001 From: ForeverSmiYng Date: Thu, 27 Jun 2024 10:04:28 +0800 Subject: [PATCH] =?UTF-8?q?'=E6=9B=B4=E6=96=B0JS=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=B1=9E=E6=80=A7=E4=B8=AD=E7=9A=84SQL?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JS通过字段属性中的SQL查询数据库.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/JS通过字段属性中的SQL查询数据库.js b/JS通过字段属性中的SQL查询数据库.js index 45bf5ea..c001f70 100644 --- a/JS通过字段属性中的SQL查询数据库.js +++ b/JS通过字段属性中的SQL查询数据库.js @@ -1,3 +1,6 @@ +/* +SFP_myJSON参数需从已有流程字段属性设置中抓取,可通过查看网络请求的方式进行抓取 +示例: let myJSON = `{ "workflowid":"71025", "nodeid": 109529, @@ -16,5 +19,16 @@ let myJSON = `{ "linkageid": 117552, "wfTestStr": "" }`; -let postObj = JSON.parse(myJSON); -$.post("/api/workflow/linkage/reqFieldSqlResult", postObj); \ No newline at end of file +*/ +/* +这是个异步函数,返回结果为promise,调用时需要加await前缀,以实现同步,即await selectByFieldProp(myJSON) +*/ +async function selectByFieldPropSyn(SFP_myJSON) { + try { + let postObj = JSON.parse(SFP_myJSON); + const response = await $.post("/api/workflow/linkage/reqFieldSqlResult", postObj); + return response; + } catch (error) { + console.error('Error:', error); + } +} \ No newline at end of file