Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yuyiDataServer
Overview
Overview
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
node_server
yuyiDataServer
Commits
e75828d3
Commit
e75828d3
authored
May 09, 2025
by
chenjinjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
f824e322
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
findData.ts
src/biz/findData.ts
+9
-1
No files found.
src/biz/findData.ts
View file @
e75828d3
...
...
@@ -17,14 +17,15 @@ import { BizError } from "../util/bizError";
* %notBetween%:查询不在范围内数据 {列名: {"%notBetween%": ["开始参数", "结束参数"]}} ---NOT BETWEEN 开始参数 AND 结束参数
* %orderDesc%: order by DESC {"%orderDesc%": "列名"}
* %limit%: {"%limit%": 数量}
* %literal%: 拼接查询sql条件 {"%literal%": `sql语句`} 例如:start BETWEEN 1 and 3
* @param column
* @returns
*/
function
analysisParamToWhere
(
param
,
column
)
{
let
where
=
{};
let
or
=
{};
let
order
=
[];
let
group
=
""
;
let
literal
=
""
;
let
limit
=
0
;
for
(
let
key
in
param
)
{
if
(
key
==
"%or%"
)
{
...
...
@@ -63,6 +64,9 @@ function analysisParamToWhere(param, column) {
case
"%ne%"
:
//不等于
where
[
key
][
Op
.
ne
]
=
param
[
key
][
"%ne%"
];
break
;
case
"%regexp%"
:
where
[
key
][
Op
.
regexp
]
=
param
[
key
][
"%regexp%"
];
break
;
}
}
}
else
{
...
...
@@ -79,6 +83,9 @@ function analysisParamToWhere(param, column) {
case
"%group%"
:
group
=
param
[
key
];
break
;
case
"%literal%"
:
literal
=
param
[
"%literal%"
];
break
;
default
:
where
[
key
]
=
param
[
key
];
}
}
...
...
@@ -89,6 +96,7 @@ function analysisParamToWhere(param, column) {
if
(
order
&&
order
.
length
)
selectParam
.
order
=
order
;
if
(
limit
)
selectParam
.
limit
=
limit
;
if
(
group
)
selectParam
.
group
=
group
;
if
(
literal
)
selectParam
.
where
=
Sequelize
.
literal
(
literal
);
return
selectParam
;
}
...
...
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