Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
bom_server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
33b6c8dd
authored
Mar 20, 2021
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
fix
parent
deb44092
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
internal/logic/search.go
internal/logic/search.go
View file @
33b6c8dd
...
@@ -91,7 +91,7 @@ func getSearchParams(index string, bomItem model.BomItem, sort int, flag bool) (
...
@@ -91,7 +91,7 @@ func getSearchParams(index string, bomItem model.BomItem, sort int, flag bool) (
source
.
Sort
(
"_score"
,
false
)
source
.
Sort
(
"_score"
,
false
)
source
.
Sort
(
"moq"
,
true
)
source
.
Sort
(
"moq"
,
true
)
}
}
//要去判断sort,sort=2是按照价格排序
//要去判断sort,sort=2是按照价格
(价格有问题,目前按起订量)
排序
if
sort
==
2
{
if
sort
==
2
{
source
.
Sort
(
"_score"
,
false
)
source
.
Sort
(
"_score"
,
false
)
source
.
Sort
(
"moq"
,
true
)
source
.
Sort
(
"moq"
,
true
)
...
@@ -159,7 +159,6 @@ func getTermQuery(bomItem model.BomItem, sort int, flag bool) (query *es.BoolQue
...
@@ -159,7 +159,6 @@ func getTermQuery(bomItem model.BomItem, sort int, flag bool) (query *es.BoolQue
query
=
query
.
Must
(
es
.
NewTermQuery
(
"attr_bom"
,
"FZ€"
+
bomItem
.
Encap
))
query
=
query
.
Must
(
es
.
NewTermQuery
(
"attr_bom"
,
"FZ€"
+
bomItem
.
Encap
))
}
}
//搜索库存
//搜索库存
//fmt.Println("总数量:", bomItem.Number, bomItem.Amount)
query
=
query
.
Should
(
es
.
NewRangeQuery
(
"stock"
)
.
Gte
(
bomItem
.
Number
*
bomItem
.
Amount
))
query
=
query
.
Should
(
es
.
NewRangeQuery
(
"stock"
)
.
Gte
(
bomItem
.
Number
*
bomItem
.
Amount
))
}
else
{
}
else
{
query
=
query
.
Must
(
es
.
NewTermQuery
(
"auto_goods_name"
,
bomItem
.
GoodsName
))
query
=
query
.
Must
(
es
.
NewTermQuery
(
"auto_goods_name"
,
bomItem
.
GoodsName
))
...
@@ -167,13 +166,11 @@ func getTermQuery(bomItem model.BomItem, sort int, flag bool) (query *es.BoolQue
...
@@ -167,13 +166,11 @@ func getTermQuery(bomItem model.BomItem, sort int, flag bool) (query *es.BoolQue
//只显示库存大于0的数据
//只显示库存大于0的数据
query
.
Must
(
es
.
NewRangeQuery
(
"stock"
)
.
Gt
(
0
))
query
.
Must
(
es
.
NewRangeQuery
(
"stock"
)
.
Gt
(
0
))
//按价格排序
//按价格排序
if
sort
==
2
||
sort
==
1
{
//if sort == 2 || sort == 1 {
query
=
query
.
Filter
(
es
.
NewRangeQuery
(
"single_price"
)
.
Gt
(
0
))
// query = query.Filter(es.NewRangeQuery("single_price").Gt(0))
}
//}
//库存排序
//只显示起订量大于0
if
sort
==
3
{
query
.
Must
(
es
.
NewRangeQuery
(
"moq"
)
.
Gt
(
0
))
query
=
query
.
Filter
(
es
.
NewRangeQuery
(
"stock"
)
.
Gt
(
0
))
}
if
configs
.
ApiSetting
.
Mode
!=
"debug"
{
if
configs
.
ApiSetting
.
Mode
!=
"debug"
{
query
=
query
.
Filter
(
es
.
NewTermQuery
(
"status"
,
1
))
query
=
query
.
Filter
(
es
.
NewTermQuery
(
"status"
,
1
))
}
}
...
...
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