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
744236c3
Commit
744236c3
authored
Jul 31, 2023
by
ZZH
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix anshiu 2023-7-31
parent
eda99d09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
data_es_dao.py
unify_api/modules/zhiwei_u/dao/data_es_dao.py
+14
-18
No files found.
unify_api/modules/zhiwei_u/dao/data_es_dao.py
View file @
744236c3
...
...
@@ -66,36 +66,33 @@ async def get_search_scope(cid, pid, start, end, limit, offset):
return
data
,
total
async
def
query_search_scope
(
cid
,
pid
,
page_num
,
page_size
,
async
def
query_search_scope
(
cid
,
pid
s
,
page_num
,
page_size
,
start_time
,
end_time
,
scope_g
):
"""
查询录波列表
"""
if
len
(
pid
)
>
1
:
mtid
=
await
get_mtids_by_pids_dao
(
pid
)
else
:
mtid
=
await
get_mtid_by_pid_dao
(
pid
)
where
=
""
if
cid
:
if
len
(
pids
)
==
0
:
where
+=
f
" and pe.cid={cid} "
else
:
mtids
=
await
get_mtids_by_pids_dao
(
pids
)
if
len
(
mtids
)
==
1
:
where
+=
f
" and pe.mtid={mtids[0]} "
else
:
where
+=
f
" and pe.mtid in {tuple(mtids)} "
if
start_time
:
where
+=
f
" and pt.event_datetime >= '{start_time}' "
if
end_time
:
where
+=
f
" and pe.create_time <= '{end_time}' "
if
mtid
:
if
len
(
mtid
)
==
1
:
where
+=
f
" and pe.mtid = {mtid['mtid']} "
else
:
where
+=
f
" and pe.mtid in {tuple(mtid)} "
if
scope_g
:
if
len
(
scope_g
)
==
1
:
where
+=
f
" AND pe.scope_g = {scope_g[0]} "
else
:
where
+=
f
" AND pe.scope_g in {tuple(scope_g)} "
sql
=
f
"""
SELECT
pt.event_id doc_id,
...
...
@@ -113,7 +110,7 @@ async def query_search_scope(cid, pid, page_num, page_size,
ORDER BY
pe.create_time DESC
LIMIT {page_num} , {page_size} """
total_sql
=
f
"""
SELECT
count(*) total
...
...
@@ -126,10 +123,9 @@ async def query_search_scope(cid, pid, page_num, page_size,
{where}
"""
async
with
MysqlUtil
()
as
conn
:
data
=
await
conn
.
fetchall
(
sql
,
)
total
=
await
conn
.
fetchone
(
total_sql
)
return
data
,
total
...
...
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