Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
unify_api2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chaonan
unify_api2
Commits
c473ef7a
Commit
c473ef7a
authored
May 15, 2023
by
wang.wenrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
获取监测点修改,复用其他cid数据
parent
fd317f5f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
list_point.py
unify_api/modules/common/views/list_point.py
+8
-6
No files found.
unify_api/modules/common/views/list_point.py
View file @
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
(
"
l
id"
)
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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment