Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
quantum-blocks
Commits
a8a504f4
Commit
a8a504f4
authored
May 06, 2022
by
Xuguangxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 查询条件增加模糊搜索,列表排序按照id倒序
parent
c7f26271
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
navigator.ts
app/service/navigator.ts
+25
-9
No files found.
app/service/navigator.ts
View file @
a8a504f4
...
...
@@ -54,22 +54,32 @@ export default class ArticeService extends Service {
}
// 获取导航列表
async
getList
(
pageNo
,
pageSize
,
name
=
''
,
author
=
''
)
{
const
offset
=
(
+
pageNo
-
1
)
*
pageSize
;
;
const
offset
=
(
+
pageNo
-
1
)
*
pageSize
;
const
condition
=
{
author
:
null
,
name
:
null
};
// 模糊匹配作者
if
(
author
)
condition
.
author
=
author
;
// 模糊匹配名称
if
(
name
)
condition
.
name
=
name
;
if
(
author
)
{
condition
.
author
=
{
$like
:
'
%
'
+
author
+
'
%
'
};
}
if
(
name
)
{
condition
.
name
=
{
$like
:
'
%
'
+
name
+
'
%
'
};
}
if
(
!
condition
.
author
)
delete
condition
.
author
;
if
(
!
condition
.
name
)
delete
condition
.
name
;
const
res
=
await
this
.
context
.
model
.
NavigatorConfig
.
findAndCountAll
({
where
:
condition
,
limit
:
+
pageSize
,
offset
offset
,
order
:
[
[
'
id
'
,
'
DESC
'
]
],
})
const
result
=
{
total
:
res
.
count
||
0
,
...
...
@@ -85,10 +95,16 @@ export default class ArticeService extends Service {
name
:
null
,
id
:
null
};
// 模糊匹配作者
if
(
author
)
condition
.
author
=
author
;
// 模糊匹配名称
if
(
name
)
condition
.
name
=
name
;
if
(
author
)
{
condition
.
author
=
{
$like
:
'
%
'
+
author
+
'
%
'
};
}
if
(
name
)
{
condition
.
name
=
{
$like
:
'
%
'
+
name
+
'
%
'
};
}
if
(
id
)
{
condition
.
id
=
{
$notIn
:
[
id
]
...
...
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