fix(资料中心): 79823

This commit is contained in:
yjz
2024-01-05 14:31:24 +08:00
parent 85e985bfa3
commit a3905dd6fb
5 changed files with 25 additions and 11 deletions
@@ -2,8 +2,10 @@ package com.jero.modules.laws.dataCenter.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.laws.common.constant.FieldCommon;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.common.util.TreeNodeComparator;
import com.jero.modules.laws.dataCenter.entity.LawsDataCenterFile;
@@ -16,13 +18,13 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.jero.common.exception.JeroBootException;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
* @Description: 资料中心-文件夹
@@ -164,6 +166,13 @@ public class LawsDataCenterFolderServiceImpl extends ServiceImpl<LawsDataCenterF
throw new JeroBootException(ResultCommon.EXIST_SUB_FOLDERS);
}
// 文件夹下有文件不能删除
int count = lawsDataCenterFileService.count(new LambdaUpdateWrapper<LawsDataCenterFile>()
.eq(LawsDataCenterFile::getFolderId, id));
if (count > 0){
throw new JeroBootException(ResultCommon.EXIST_SUB_FILES);
}
// 只剩一个文件夹也不能删除
LambdaQueryWrapper<LawsDataCenterFolder> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(LawsDataCenterFolder::getParentId, "0");
@@ -174,10 +183,12 @@ public class LawsDataCenterFolderServiceImpl extends ServiceImpl<LawsDataCenterF
}
removeById(id);
// 将该文件夹下面的文件夹关联删除
LambdaUpdateWrapper<LawsDataCenterFile> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(LawsDataCenterFile::getFolderId, null);
updateWrapper.eq(LawsDataCenterFile::getFolderId, id);
lawsDataCenterFileService.update(updateWrapper);
/**
* // 将该文件夹下面的文件夹关联删除
* LambdaUpdateWrapper<LawsDataCenterFile> updateWrapper = new LambdaUpdateWrapper<>();
* updateWrapper.set(LawsDataCenterFile::getFolderId, null);
* updateWrapper.eq(LawsDataCenterFile::getFolderId, id);
* lawsDataCenterFileService.update(updateWrapper);
*/
}
}