|
@@ -283,14 +283,17 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
assoProductCategoryPeople.add(assoProductCategoryAdmin);
|
|
|
//设置的管理员
|
|
|
List<String> adminIds = updateProductCategoryDTO.getAdminIds();
|
|
|
- for (String adminId : adminIds) {
|
|
|
- AssoProductCategoryPerson admin = new AssoProductCategoryPerson();
|
|
|
- admin.setProductCategoryId(productCategory.getId());
|
|
|
- admin.setPersonId(adminId);
|
|
|
- admin.setRole(0);
|
|
|
- admin.setCreateId(personnelVO.getId());
|
|
|
- assoProductCategoryPeople.add(admin);
|
|
|
+ if (!CollectionUtils.isEmpty(adminIds)) {
|
|
|
+ for (String adminId : adminIds) {
|
|
|
+ AssoProductCategoryPerson admin = new AssoProductCategoryPerson();
|
|
|
+ admin.setProductCategoryId(productCategory.getId());
|
|
|
+ admin.setPersonId(adminId);
|
|
|
+ admin.setRole(0);
|
|
|
+ admin.setCreateId(personnelVO.getId());
|
|
|
+ assoProductCategoryPeople.add(admin);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//判断可见类型:
|
|
|
Integer showType = updateProductCategoryDTO.getShowType();
|
|
|
if (showType != 0 && showType != 1) {
|
|
@@ -326,13 +329,13 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
List<AssoProductCategoryFile> assoFiles = assoProductCategoryFileService.list(wrapper);
|
|
|
List<String> fileGuIds = assoFiles.stream().map(AssoProductCategoryFile::getFileGuid).collect(Collectors.toList());
|
|
|
//获取更新后的附件ids
|
|
|
- List<String> updateFileGuIds = new ArrayList<>();
|
|
|
- if (updateProductCategoryDTO.getGuids() != null && updateProductCategoryDTO.getGuids().size() != 0) {
|
|
|
- updateFileGuIds = updateProductCategoryDTO.getGuids();
|
|
|
- fileGuIds.retainAll(updateFileGuIds);
|
|
|
- }
|
|
|
- //做差获得被删除的文件id
|
|
|
- if (fileGuIds.size() != 0) {
|
|
|
+// List<String> updateFileGuIds = new ArrayList<>();
|
|
|
+// if (updateProductCategoryDTO.getGuids() != null && updateProductCategoryDTO.getGuids().size() != 0) {
|
|
|
+// updateFileGuIds = updateProductCategoryDTO.getGuids();
|
|
|
+// fileGuIds.retainAll(updateFileGuIds);
|
|
|
+// }
|
|
|
+ //根据guid进行删除产品分类和文件关联表以及文件
|
|
|
+ if (!CollectionUtils.isEmpty(fileGuIds)) {
|
|
|
//根据文件id删除产品类别与文件关联表记录
|
|
|
LambdaQueryWrapper<AssoProductCategoryFile> deleteWrapper = new LambdaQueryWrapper<>();
|
|
|
deleteWrapper.in(AssoProductCategoryFile::getFileGuid, fileGuIds);
|
|
@@ -345,7 +348,7 @@ public class ProductCategoryService extends ServiceImpl<ProductCategoryMapper, P
|
|
|
}
|
|
|
}
|
|
|
//添加文件
|
|
|
- if (files != null && files.size() != 0) {
|
|
|
+ if (!CollectionUtils.isEmpty(files)) {
|
|
|
try {
|
|
|
List<String> guids = fileManagerService.uploadFileGetGuid(files);
|
|
|
List<AssoProductCategoryFile> assoProductCategoryFiles = new ArrayList<>();
|