|
@@ -156,8 +156,8 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
|
|
|
List<Long> newUpdateIds = values.stream().map(TenantAlbumCategoryDetail::getId).filter(Objects::nonNull)
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
- List<TenantAlbumCategoryDetail> removeDetailIdList =
|
|
|
- detailList.stream().filter(next -> !newUpdateIds.contains(next.getId())).collect(Collectors.toList());
|
|
|
+ List<Long> removeDetailIdList = detailList.stream().map(TenantAlbumCategoryDetail::getId)
|
|
|
+ .filter(next -> !newUpdateIds.contains(next)).collect(Collectors.toList());
|
|
|
if (!removeDetailIdList.isEmpty()) {
|
|
|
// 校验删除的分类值是否被使用,如果有使用,则提示
|
|
|
TenantAlbumCategory albumCategory = this.getById(tenantAlbumCategory.getId());
|
|
@@ -171,16 +171,14 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
|
|
|
if (useCount > 0) {
|
|
|
checkTenantAlbumCategoryDetailUsed(albumCategory.getCategoryType(), removeDetailIdList);
|
|
|
}
|
|
|
+ tenantAlbumCategoryDetailService.removeByIds(removeDetailIdList);
|
|
|
}
|
|
|
-
|
|
|
- tenantAlbumCategoryDetailService.lambdaUpdate()
|
|
|
- .eq(TenantAlbumCategoryDetail::getTenantAlbumCategoryId, tenantAlbumCategory.getId())
|
|
|
- .remove();
|
|
|
- this.updateById(JSON.parseObject(tenantAlbumCategory.jsonString(), TenantAlbumCategory.class));
|
|
|
if (!values.isEmpty()) {
|
|
|
values.forEach(next -> next.setTenantAlbumCategoryId(tenantAlbumCategory.getId()));
|
|
|
- tenantAlbumCategoryDetailService.saveBatch(values);
|
|
|
+ tenantAlbumCategoryDetailService.saveOrUpdateBatch(values);
|
|
|
}
|
|
|
+
|
|
|
+ this.updateById(JSON.parseObject(tenantAlbumCategory.jsonString(), TenantAlbumCategory.class));
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -214,11 +212,11 @@ public class TenantAlbumCategoryServiceImpl extends ServiceImpl<TenantAlbumCateg
|
|
|
* 校验专辑分类中的值是否有被应用
|
|
|
*/
|
|
|
private void checkTenantAlbumCategoryDetailUsed(ETenantAlbumCategoryType categoryType,
|
|
|
- List<TenantAlbumCategoryDetail> list) {
|
|
|
+ List<Long> list) {
|
|
|
if (list.isEmpty()) {
|
|
|
return;
|
|
|
}
|
|
|
- List<String> idStrList = list.stream().map(next -> next.getId().toString()).collect(Collectors.toList());
|
|
|
+ List<String> idStrList = list.stream().map(Object::toString).collect(Collectors.toList());
|
|
|
QueryWrapper<TenantAlbumMusic> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.lambda()
|
|
|
.in(ETenantAlbumCategoryType.CATEGORY_TYPE.equals(categoryType),
|