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
c7c45e8d
Commit
c7c45e8d
authored
Oct 09, 2023
by
王晓旭
Browse files
Options
Browse Files
Download
Plain Diff
统一修改表格搜索
parents
e073c0c8
bb761626
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
13 deletions
+101
-13
enterprise-manager-ui/admin/src/components/AreaSelect.vue
enterprise-manager-ui/admin/src/components/AreaSelect.vue
+1
-1
enterprise-manager-ui/admin/src/views/company/labels/list.vue
...rprise-manager-ui/admin/src/views/company/labels/list.vue
+1
-2
enterprise-manager-ui/admin/src/views/company/product/list.vue
...prise-manager-ui/admin/src/views/company/product/list.vue
+3
-1
enterprise-manager-ui/admin/src/views/product/list.vue
enterprise-manager-ui/admin/src/views/product/list.vue
+0
-1
enterprise-manager/src/main/java/com/mortals/xhx/module/product/model/vo/ProductVo.java
...va/com/mortals/xhx/module/product/model/vo/ProductVo.java
+2
-2
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
...om/mortals/xhx/module/product/service/ProductService.java
+2
-1
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
...s/xhx/module/product/service/impl/ProductServiceImpl.java
+92
-5
No files found.
enterprise-manager-ui/admin/src/components/AreaSelect.vue
View file @
c7c45e8d
...
...
@@ -164,7 +164,7 @@ export default {
if
(
this
.
hideCommunity
)
{
return
6
}
return
4
return
3
}
},
created
()
{
...
...
enterprise-manager-ui/admin/src/views/company/labels/list.vue
View file @
c7c45e8d
...
...
@@ -41,7 +41,6 @@
search
:
[
],
columns
:
[
{
type
:
"
selection
"
,
width
:
60
},
{
type
:
"
index
"
,
label
:
"
序号
"
,
width
:
50
},
{
label
:
"
标签Id
"
,
prop
:
"
labelId
"
,
formatter
:
this
.
formatter
},
...
...
@@ -67,4 +66,4 @@
};
}
};
</
script
>
\ No newline at end of file
</
script
>
enterprise-manager-ui/admin/src/views/company/product/list.vue
View file @
c7c45e8d
...
...
@@ -39,6 +39,8 @@
return
{
config
:
{
search
:
[
],
columns
:
[
{
type
:
"
selection
"
,
width
:
60
},
...
...
@@ -67,4 +69,4 @@
};
}
};
</
script
>
\ No newline at end of file
</
script
>
enterprise-manager-ui/admin/src/views/product/list.vue
View file @
c7c45e8d
...
...
@@ -118,7 +118,6 @@
},
],
columns
:
[
// {type: "selection", width: 60},
{
type
:
"
index
"
,
label
:
"
序号
"
,
width
:
50
},
{
label
:
"
产品名称
"
,
prop
:
"
productName
"
},
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/product/model/vo/ProductVo.java
View file @
c7c45e8d
...
...
@@ -19,9 +19,9 @@ public class ProductVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private
List
<
Long
>
idList
;
//所属公司
//所属公司
private
String
companyId
;
//所属企业
//所属企业
private
String
categoryId
;
...
...
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/ProductService.java
View file @
c7c45e8d
package
com.mortals.xhx.module.product.service
;
import
com.mortals.framework.service.ICRUDCacheService
;
import
com.mortals.framework.service.ICRUDService
;
import
com.mortals.xhx.module.product.model.ProductEntity
;
import
com.mortals.xhx.module.product.dao.ProductDao
;
...
...
@@ -10,7 +11,7 @@ import com.mortals.xhx.module.product.dao.ProductDao;
* @author zxfei
* @date 2023-09-18
*/
public
interface
ProductService
extends
ICRUD
Service
<
ProductEntity
,
Long
>
{
public
interface
ProductService
extends
ICRUD
CacheService
<
ProductEntity
,
Long
>
{
ProductDao
getDao
();
}
\ No newline at end of file
enterprise-manager/src/main/java/com/mortals/xhx/module/product/service/impl/ProductServiceImpl.java
View file @
c7c45e8d
package
com.mortals.xhx.module.product.service.impl
;
import
cn.hutool.core.collection.CollUtil
;
import
com.mortals.framework.model.PageInfo
;
import
com.mortals.framework.model.Result
;
import
com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl
;
import
com.mortals.xhx.module.category.model.CategoryEntity
;
import
com.mortals.xhx.module.category.model.CategoryQuery
;
import
com.mortals.xhx.module.category.service.CategoryService
;
import
com.mortals.xhx.module.company.model.CompanyEntity
;
import
com.mortals.xhx.module.company.model.CompanyProductEntity
;
...
...
@@ -20,9 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
com.mortals.xhx.module.product.service.ProductQuestionService
;
import
org.springframework.util.ObjectUtils
;
import
java.util.Date
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -36,7 +38,7 @@ import lombok.extern.slf4j.Slf4j;
*/
@Service
(
"productService"
)
@Slf4j
public
class
ProductServiceImpl
extends
AbstractCRUDServiceImpl
<
ProductDao
,
ProductEntity
,
Long
>
implements
ProductService
{
public
class
ProductServiceImpl
extends
AbstractCRUD
Cache
ServiceImpl
<
ProductDao
,
ProductEntity
,
Long
>
implements
ProductService
{
@Autowired
private
ProductQuestionService
productQuestionService
;
...
...
@@ -51,6 +53,74 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
private
CompanyService
companyService
;
@Override
public
Result
<
ProductEntity
>
find
(
ProductEntity
entity
,
PageInfo
pageInfo
,
Context
context
)
throws
AppException
{
Result
<
ProductEntity
>
productEntityResult
=
new
Result
<>();
if
(
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
return
super
.
find
(
entity
,
pageInfo
,
context
);
}
else
{
//针对不同查询返回不同结果集
if
(!
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
Result
<
ProductCategoryEntity
>
productCategoryResult
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
categoryId
(
Long
.
parseLong
(
entity
.
getCategoryId
())),
pageInfo
,
context
);
List
<
ProductEntity
>
productList
=
getProductEntitiesByCategory
(
entity
,
productCategoryResult
);
productEntityResult
.
setList
(
productList
);
productEntityResult
.
setPageInfo
(
productCategoryResult
.
getPageInfo
());
productEntityResult
.
setDict
(
productCategoryResult
.
getDict
());
}
else
if
(
ObjectUtils
.
isEmpty
(
entity
.
getCategoryId
())
&&
!
ObjectUtils
.
isEmpty
(
entity
.
getCompanyId
()))
{
Result
<
CompanyProductEntity
>
companyProductEntityResult
=
companyProductService
.
find
(
new
CompanyProductQuery
().
companyId
(
Long
.
parseLong
(
entity
.
getCompanyId
())),
pageInfo
,
context
);
List
<
CompanyProductEntity
>
companyProducList
=
companyProductEntityResult
.
getList
();
List
<
ProductEntity
>
productList
=
getProductEntitiesByCompanyId
(
entity
,
companyProducList
);
productEntityResult
.
setList
(
productList
);
productEntityResult
.
setPageInfo
(
companyProductEntityResult
.
getPageInfo
());
productEntityResult
.
setDict
(
companyProductEntityResult
.
getDict
());
}
else
{
//同时查询公司与种类
Result
<
ProductCategoryEntity
>
productCategoryResult
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
categoryId
(
Long
.
parseLong
(
entity
.
getCategoryId
())),
pageInfo
,
context
);
List
<
ProductEntity
>
productCategoryList
=
getProductEntitiesByCategory
(
entity
,
productCategoryResult
);
Result
<
CompanyProductEntity
>
companyProductEntityResult
=
companyProductService
.
find
(
new
CompanyProductQuery
().
companyId
(
Long
.
parseLong
(
entity
.
getCompanyId
())),
pageInfo
,
context
);
List
<
CompanyProductEntity
>
companyProducList
=
companyProductEntityResult
.
getList
();
List
<
ProductEntity
>
productCompanyList
=
getProductEntitiesByCompanyId
(
entity
,
companyProducList
);
//求2个list的交集
List
<
ProductEntity
>
collect
=
CollUtil
.
intersection
(
productCategoryList
,
productCompanyList
).
stream
().
collect
(
Collectors
.
toList
());
productEntityResult
.
setList
(
collect
);
pageInfo
.
setTotalResult
(
collect
.
size
());
productEntityResult
.
setPageInfo
(
pageInfo
);
productEntityResult
.
setDict
(
companyProductEntityResult
.
getDict
());
}
}
return
productEntityResult
;
}
private
List
<
ProductEntity
>
getProductEntitiesByCompanyId
(
ProductEntity
entity
,
List
<
CompanyProductEntity
>
companyProducList
)
{
List
<
ProductEntity
>
productList
=
companyProducList
.
stream
().
map
(
item
->
{
ProductEntity
productEntity
=
this
.
getCache
(
item
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
productEntity
.
setCompanyId
(
entity
.
getCompanyId
());
String
categoryIds
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
productId
(
item
.
getId
())).
stream
().
map
(
i
->
i
.
getCategoryId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
productEntity
.
setCategoryId
(
categoryIds
);
}
return
productEntity
;
}).
collect
(
Collectors
.
toList
());
return
productList
;
}
private
List
<
ProductEntity
>
getProductEntitiesByCategory
(
ProductEntity
entity
,
Result
<
ProductCategoryEntity
>
productCategoryResult
)
{
List
<
ProductEntity
>
productList
=
productCategoryResult
.
getList
().
stream
().
map
(
item
->
{
ProductEntity
productEntity
=
this
.
getCache
(
item
.
getProductId
().
toString
());
if
(!
ObjectUtils
.
isEmpty
(
productEntity
))
{
String
companyIds
=
companyProductService
.
find
(
new
CompanyProductQuery
().
productId
(
productEntity
.
getId
())).
stream
().
map
(
i
->
i
.
getProductId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
productEntity
.
setCompanyId
(
companyIds
);
productEntity
.
setCategoryId
(
entity
.
getCategoryId
());
}
return
productEntity
;
}).
collect
(
Collectors
.
toList
());
return
productList
;
}
@Override
protected
void
findAfter
(
ProductEntity
params
,
PageInfo
pageInfo
,
Context
context
,
List
<
ProductEntity
>
list
)
throws
AppException
{
list
.
forEach
(
item
->
{
...
...
@@ -59,6 +129,24 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
item
.
setCompanyId
(
companyIds
);
item
.
setCategoryId
(
categoryIds
);
});
if
(!
ObjectUtils
.
isEmpty
(
params
.
getCategoryId
()))
{
//种类不为空 删除掉空的
Iterator
<
ProductEntity
>
iterator
=
list
.
iterator
();
while
(
iterator
.
hasNext
())
{
ProductEntity
product
=
iterator
.
next
();
String
categoryIds
=
productCategoryService
.
find
(
new
ProductCategoryQuery
().
productId
(
product
.
getId
())).
stream
().
map
(
i
->
i
.
getCategoryId
().
toString
()).
collect
(
Collectors
.
joining
(
","
));
}
}
if
(!
ObjectUtils
.
isEmpty
(
params
.
getCompanyId
()))
{
//公司查询不为空
}
}
@Override
...
...
@@ -186,7 +274,6 @@ public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, Prod
productQuestionService
.
removeList
(
productQuestionlist
,
context
);
super
.
removeAfter
(
ids
,
context
,
result
);
}
}
\ No newline at end of file
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