Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
enterprise-platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
enterprise-platform
Commits
8d8da1b5
Commit
8d8da1b5
authored
Oct 09, 2023
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改产品分类与公司查询
parent
9f68db8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+17
-0
No files found.
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
8d8da1b5
...
@@ -59,18 +59,31 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -59,18 +59,31 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
if
(
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
if
(
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
return
super
.
find
(
entity
,
pageInfo
,
context
);
return
super
.
find
(
entity
,
pageInfo
,
context
);
}
else
{
}
else
{
Integer
hot
=
entity
.
getHot
();
//针对不同查询返回不同结果集
//针对不同查询返回不同结果集
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
Result
<
ProductCategoryEntity
>
productCategoryResult
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
categoryId
(
Long
.
parseLong
(
entity
.
getCategoryId
())),
pageInfo
,
context
);
Result
<
ProductCategoryEntity
>
productCategoryResult
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
categoryId
(
Long
.
parseLong
(
entity
.
getCategoryId
())),
pageInfo
,
context
);
List
<
ProductEntity
>
productList
=
getProductEntitiesByCategory
(
entity
,
productCategoryResult
);
List
<
ProductEntity
>
productList
=
getProductEntitiesByCategory
(
entity
,
productCategoryResult
);
if
(!
ObjectUtils
.
isEmpty
(
hot
))
{
//过滤热门与非热门
productList
=
productList
.
stream
().
filter
(
f
->
f
.
getHot
()
==
hot
).
collect
(
Collectors
.
toList
());
}
productEntityResult
.
setList
(
productList
);
productEntityResult
.
setList
(
productList
);
productEntityResult
.
setPageInfo
(
productCategoryResult
.
getPageInfo
());
productEntityResult
.
setPageInfo
(
productCategoryResult
.
getPageInfo
());
productEntityResult
.
setDict
(
productCategoryResult
.
getDict
());
productEntityResult
.
setDict
(
productCategoryResult
.
getDict
());
}
else
if
(
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
}
else
if
(
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
Result
<
CompanyProductEntity
>
companyProductEntityResult
=
companyProductService
.
find
(
new
CompanyProductQuery
().
companyId
(
Long
.
parseLong
(
entity
.
getCompanyId
())),
pageInfo
,
context
);
Result
<
CompanyProductEntity
>
companyProductEntityResult
=
companyProductService
.
find
(
new
CompanyProductQuery
().
companyId
(
Long
.
parseLong
(
entity
.
getCompanyId
())),
pageInfo
,
context
);
List
<
CompanyProductEntity
>
companyProducList
=
companyProductEntityResult
.
getList
();
List
<
CompanyProductEntity
>
companyProducList
=
companyProductEntityResult
.
getList
();
List
<
ProductEntity
>
productList
=
getProductEntitiesByCompanyId
(
entity
,
companyProducList
);
List
<
ProductEntity
>
productList
=
getProductEntitiesByCompanyId
(
entity
,
companyProducList
);
if
(!
ObjectUtils
.
isEmpty
(
hot
))
{
//过滤热门与非热门
productList
=
productList
.
stream
().
filter
(
f
->
f
.
getHot
()
==
hot
).
collect
(
Collectors
.
toList
());
}
productEntityResult
.
setList
(
productList
);
productEntityResult
.
setList
(
productList
);
productEntityResult
.
setPageInfo
(
companyProductEntityResult
.
getPageInfo
());
productEntityResult
.
setPageInfo
(
companyProductEntityResult
.
getPageInfo
());
productEntityResult
.
setDict
(
companyProductEntityResult
.
getDict
());
productEntityResult
.
setDict
(
companyProductEntityResult
.
getDict
());
...
@@ -85,6 +98,10 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
...
@@ -85,6 +98,10 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
//求2个list的交集
//求2个list的交集
List
<
ProductEntity
>
collect
=
CollUtil
.
intersection
(
productCategoryList
,
productCompanyList
).
stream
().
collect
(
Collectors
.
toList
());
List
<
ProductEntity
>
collect
=
CollUtil
.
intersection
(
productCategoryList
,
productCompanyList
).
stream
().
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
hot
))
{
//过滤热门与非热门
collect
=
collect
.
stream
().
filter
(
f
->
f
.
getHot
()
==
hot
).
collect
(
Collectors
.
toList
());
}
productEntityResult
.
setList
(
collect
);
productEntityResult
.
setList
(
collect
);
pageInfo
.
setTotalResult
(
collect
.
size
());
pageInfo
.
setTotalResult
(
collect
.
size
());
productEntityResult
.
setPageInfo
(
pageInfo
);
productEntityResult
.
setPageInfo
(
pageInfo
);
...
...
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