Commit 94beaf9a authored by wang.wenrong's avatar wang.wenrong

Merge branch 'wwr' into 'develop'

获取监测点修改,复用其他cid数据

See merge request !46
parents 5d38e97e c473ef7a
......@@ -73,14 +73,14 @@ async def post_list_point(req, body: ListPointRequest) -> ListPointResponse:
if not is_power_equipment:
sql = "SELECT p.pid,p.mtid, p.name, p.add_to_company FROM point p " \
"left join monitor_reuse m on p.mtid = m.mtid " \
"WHERE p.cid_belongedto=%s or m.cid = %s"
"WHERE p.cid=%s or m.cid = %s"
else:
# 动力设备
sql = "SELECT p.pid,p.mtid, p.name, p.add_to_company FROM point p " \
"left join monitor m on p.mtid = m.mtid " \
"left join monitor_reuse mr on p.mtid = mr.mtid " \
"WHERE m.demolished = 0 and m.is_power_equipment = 1 and (" \
"p.cid_belongedto=%s or mr.cid = %s)"
"p.cid=%s or mr.cid = %s)"
async with MysqlUtil() as conn:
result = await conn.fetchall(sql, args=(cid, cid))
......@@ -98,14 +98,16 @@ async def post_list_point(req, body: ListPointRequest) -> ListPointResponse:
point['pid'] in point_mid_map]
# 根据pid获取mtd
sql = "SELECT id, `group`, item FROM location WHERE ( cid=%s or mtid in " \
"%s ) and `type` in %s"
sql = "SELECT ln.lid, mr.`name` `group`, ln.item FROM location ln LEFT JOIN" \
" monitor mr on ln.mtid = mr.mtid WHERE ( ln.cid=%s or ln.mtid in " \
"%s ) and ln.`ad_type` in %s"
try:
async with MysqlUtil() as conn:
result = await conn.fetchall(sql, args=(
cid, point_map_mtids, ["temperature", "residual_current"]))
for res in result:
id = res.get("id")
id = res.get("lid")
group = res.get("group")
item = res.get("item")
groups.setdefault(group, []).append((id, item))
......@@ -126,7 +128,7 @@ async def post_list_point(req, body: ListPointRequest) -> ListPointResponse:
list_point.append(comm_point)
async with MysqlUtil() as conn:
sql = "SELECT inlid, `name` FROM inline WHERE cid_belongedto=%s"
sql = "SELECT inlid, `name` FROM inline WHERE cid=%s"
inlines = await conn.fetchall(sql, args=(cid,))
inline_list = [Inline(inline_id=inline["inlid"], name=inline["name"])
for inline in inlines]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment