Commit 9a468600867a1e28847313c7509c395a7a7cd2f9

Authored by gaibu
1 parent a83b8e8f

fix: 重复 file 路径 Bug

yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java
1 1 package cn.iocoder.yudao.module.infra.dal.mysql.file;
2 2  
  3 +import cn.hutool.core.collection.CollUtil;
3 4 import cn.iocoder.yudao.framework.file.core.client.db.DBFileContentFrameworkDAO;
4 5 import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileContentDO;
5 6 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
6 7 import org.springframework.stereotype.Repository;
7 8  
8 9 import javax.annotation.Resource;
  10 +import java.util.List;
9 11  
10 12 @Repository
11 13 public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
... ... @@ -27,9 +29,9 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
27 29  
28 30 @Override
29 31 public byte[] selectContent(Long configId, String path) {
30   - FileContentDO fileContentDO = fileContentMapper.selectOne(
  32 + List<FileContentDO> fileContentDOs = fileContentMapper.selectList(
31 33 buildQuery(configId, path).select(FileContentDO::getContent));
32   - return fileContentDO != null ? fileContentDO.getContent() : null;
  34 + return CollUtil.isNotEmpty(fileContentDOs) ? CollUtil.getFirst(fileContentDOs).getContent() : null;
33 35 }
34 36  
35 37 private LambdaQueryWrapper<FileContentDO> buildQuery(Long configId, String path) {
... ...