Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
simcaq-node
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
simcaq
simcaq-node
Commits
43ecf86f
Commit
43ecf86f
authored
3 years ago
by
Pietro Cavassin
Browse files
Options
Downloads
Patches
Plain Diff
only relation like adds '%' to value
parent
f24218f1
No related branches found
No related tags found
2 merge requests
!309
Merge new updates into master
,
!279
Homologa
Pipeline
#27666
failed
3 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libs/middlewares/reqQueryFields.js
+7
-6
7 additions, 6 deletions
src/libs/middlewares/reqQueryFields.js
with
7 additions
and
6 deletions
src/libs/middlewares/reqQueryFields.js
+
7
−
6
View file @
43ecf86f
...
@@ -11,10 +11,11 @@ const nullFields = [
...
@@ -11,10 +11,11 @@ const nullFields = [
"
Não classificada
"
"
Não classificada
"
]
]
function
parseWhereValue
(
type
,
value
)
{
function
parseWhereValue
(
type
,
value
,
relation
)
{
if
(
type
===
'
integer
'
)
return
parseInt
(
value
,
10
);
if
(
type
===
'
integer
'
)
return
parseInt
(
value
,
10
);
if
(
type
===
'
double
'
)
return
parseFloat
(
value
);
if
(
type
===
'
double
'
)
return
parseFloat
(
value
);
if
(
type
===
'
string
'
)
return
'
%
'
+
value
+
'
%
'
;
if
(
type
===
'
string
'
&&
relation
===
'
LIKE
'
)
return
'
%
'
+
value
+
'
%
'
;
if
(
type
===
'
string
'
)
return
value
;
if
(
type
===
'
boolean
'
)
{
if
(
type
===
'
boolean
'
)
{
if
(
value
===
null
||
typeof
value
===
'
boolean
'
)
{
if
(
value
===
null
||
typeof
value
===
'
boolean
'
)
{
return
value
;
return
value
;
...
@@ -306,14 +307,14 @@ class ReqQueryFields {
...
@@ -306,14 +307,14 @@ class ReqQueryFields {
let
whereString
=
'
(
'
;
let
whereString
=
'
(
'
;
for
(
let
i
=
0
;
i
<
whereValue
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
whereValue
.
length
;
++
i
)
{
whereString
+=
whereField
;
whereString
+=
whereField
;
whereValues
.
push
(
parseWhereValue
(
value
.
where
.
type
,
whereValue
[
i
]));
whereValues
.
push
(
parseWhereValue
(
value
.
where
.
type
,
whereValue
[
i
]
,
value
.
where
.
relation
));
if
(
i
<
whereValue
.
length
-
1
)
{
if
(
i
<
whereValue
.
length
-
1
)
{
whereString
+=
'
OR
'
;
whereString
+=
'
OR
'
;
}
}
}
}
whereString
+=
'
)
'
;
whereString
+=
'
)
'
;
}
else
{
}
else
{
whereValues
.
push
(
parseWhereValue
(
value
.
where
.
type
,
whereValue
));
whereValues
.
push
(
parseWhereValue
(
value
.
where
.
type
,
whereValue
,
value
.
where
.
relation
));
}
}
});
});
...
@@ -326,7 +327,7 @@ class ReqQueryFields {
...
@@ -326,7 +327,7 @@ class ReqQueryFields {
let
arrayWhereValues
=
[];
let
arrayWhereValues
=
[];
for
(
let
i
=
0
;
i
<
whereValue
.
length
;
++
i
)
{
for
(
let
i
=
0
;
i
<
whereValue
.
length
;
++
i
)
{
let
curRelation
=
value
.
where
.
relation
;
let
curRelation
=
value
.
where
.
relation
;
let
curValue
=
parseWhereValue
(
value
.
where
.
type
,
whereValue
[
i
])
let
curValue
=
parseWhereValue
(
value
.
where
.
type
,
whereValue
[
i
]
,
value
.
where
.
relation
)
if
(
isNull
(
k
,
curValue
)
)
{
if
(
isNull
(
k
,
curValue
)
)
{
curValue
=
null
;
curValue
=
null
;
curRelation
=
"
is
"
;
curRelation
=
"
is
"
;
...
@@ -341,7 +342,7 @@ class ReqQueryFields {
...
@@ -341,7 +342,7 @@ class ReqQueryFields {
whereString
+=
'
)
'
;
whereString
+=
'
)
'
;
sql
.
where
(
whereString
,
...
arrayWhereValues
);
sql
.
where
(
whereString
,
...
arrayWhereValues
);
}
else
{
}
else
{
let
curValue
=
parseWhereValue
(
value
.
where
.
type
,
whereValue
)
let
curValue
=
parseWhereValue
(
value
.
where
.
type
,
whereValue
,
value
.
where
.
relation
)
let
curRelation
=
value
.
where
.
relation
;
let
curRelation
=
value
.
where
.
relation
;
if
(
isNull
(
k
,
curValue
)
)
{
if
(
isNull
(
k
,
curValue
)
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment