import "@post:/dev/maintenance/content/addupdate" as contentAdd; import "@post:/dev/maintenance/content/resultadd" as contentResultAdd; import "@post:/dev/maintenance/content/contentStrategy" as strategyBingContentAdd; import com.techiniot.techinapi.common.Common //新增修改策略 var strategyAdd = () => { var nowTime = Common.fromDateH(); var unId = Common.getUUID(); var insertstrategysql = """ insert into pa_maintenance_point_item(unid,name,description,domain_unid,system_dtime,asset_type) values(#{unId},#{body.name},#{body.description},#{body.domainUnid},#{nowTime},#{body.assetType}) """ var updatestrategysql = """ update pa_maintenance_point_item set name = #{body.name}, description = #{body.description}, domain_unid = #{body.domainUnid}, update_dtime = #{nowTime}, asset_type=#{body.assetType} where unid = #{body.unId} """ if (Common.isNotEmpty(body.unId)) { unId = body.unId db.update(updatestrategysql); } else { db.insert(insertstrategysql) } return unId; } var unid = strategyAdd() var itemContentList = []; body.contents.each(item => { //添加内容 var body = { name: item.name, description: item.description } var result = contentAdd(); //内容的结果项 body = item.resultContent; body.contentUnId = result.unid; //内容结果项添加 contentResultAdd(); itemContentList.add({ "contentUnId": result.unid }) }) //内容id策略id关联添加 var body = { pointItemId: unid, itemContentList: itemContentList } strategyBingContentAdd(); //策略id return unid;
时间: 2023-05-19 11:07:10 浏览: 112
这是一段 JavaScript 代码,用于导入一些模块。其中 "@post:/dev/maintenance/content/addupdate"、"@post:/dev/maintenance/content/resultadd"、"@post:/dev/maintenance/content/contentStrategy" 是模块的路径,而 "contentAdd"、"contentResultAdd"、"strategyBingContentAdd" 则是导入的模块的别名。另外,代码中还定义了一个名为 "strategyAdd" 的函数,用于新增修改策略。函数中使用了一个名为 "Common" 的模块,该模块的作用是提供一些常用的工具函数。
阅读全文