返回部门数据
TIP
调用接口传参返回部门数据
流程图
@flowstart stage1=>operation: 开始 stage2=>operation: 脚本
stage1->stage2 @flowend
触发
- 流程图
- 节点配置

查询oracle数据
- 流程组件
脚本
脚本-脚本
- 节点配置
//请求商品
let sqlText = `
select deptid,
deptcode,
deptname,
deptstyle
from raw_cms_pub_dept
where stopflag='00'
`;
//定义拼接参数
let Param = _requestBody
if (Param.deptcode) {
sqlText += ` and deptcode ='${Param.deptcode}'`
}
let data = []
//创建Oracle测试数据库的连接事物
const postgres = await api.database.getPostgresInstance('RfhbbHQpnQRnXWnG')
try {
//查询数据
const _resSqltext = await postgres.query(sqlText, [])
//返回数据
api.http.setHttpResponse(_resSqltext)
}
catch (e) {
data = '失败'
}
finally {
//执行完成后关闭连接,mogodb数据库不需要关闭连接
await postgres.close();
}