Commit e819eef8 by 284718418@qq.com

1.修改BUG1350

parent 0d1d5089
......@@ -355,6 +355,8 @@ public class DiskCatalogueController {
boolean flag = diskCatalogue.updateById();
if(flag){
//资源上传文件 资源目录,上传文件中间关系
diskCatalogueService.updateDiskCatalogue(diskCatalogue);
return ResultUtil.success();
}else {
return ResultUtil.error("操作失败!");
......
......@@ -27,4 +27,13 @@ public interface DiskCatalogueService {
* @return
*/
List<DiskCatalogue> getDiskCatalogue(DiskCatalogueParam diskCatalogueParam);
/**
* 逻辑删除 文件夹,空间 ,中间关系以及文件
* @param diskCatalogue
* @return Boolean
*/
boolean updateDiskCatalogue(DiskCatalogue diskCatalogue);
}
......@@ -70,6 +70,37 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
return null;
}
@Override
public boolean updateDiskCatalogue(DiskCatalogue diskCatalogue) {
List<Integer> ids = diskCatalogueMapper.selectIdListById(diskCatalogue.getId());
if(CollectionUtils.isEmpty(ids)){
return true;
}
List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>()
.lambda().in(DiskCatalogueFiles::getCatalogueId, ids)
.eq(DiskCatalogueFiles::getDeleteFlag, 0)
);
if(CollectionUtils.isEmpty(diskCatalogueFilesList)){
return true;
}
// 逻辑删除
DiskCatalogueFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskCatalogueFiles>()
.lambda().in(DiskCatalogueFiles::getCatalogueId, ids)
.eq(DiskCatalogueFiles::getDeleteFlag, 0)
);
List<Integer> filesIds = diskCatalogueFilesList.stream().map(item -> item.getFilesId()).collect(Collectors.toList());
if(CollectionUtils.isEmpty(filesIds)){
return true;
}
// 逻辑删除
DiskFiles.builder().deleteFlag(1).updateUserId(diskCatalogue.getUpdateUserId()).build().update(new QueryWrapper<DiskFiles>()
.lambda().in(DiskFiles::getId, filesIds)
.eq(DiskFiles::getDeleteFlag, 0)
);
return true;
}
/**
* 递归获取树形结构
*
......
......@@ -2,9 +2,13 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 云盘-资源目录表
*
......@@ -14,5 +18,7 @@ import org.springframework.stereotype.Repository;
*/
@Repository
public interface DiskCatalogueMapper extends BaseMapper<DiskCatalogue> {
List<Integer> selectIdListById(@Param("id") Integer id);
}
......@@ -23,4 +23,8 @@
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectIdListById" resultType="java.lang.Integer">
SELECT id FROM disk_catalogue WHERE delete_flag = 0 AND find_in_set(#{id},parent_ids)
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment