Commit 9a468600867a1e28847313c7509c395a7a7cd2f9
1 parent
a83b8e8f
fix: 重复 file 路径 Bug
Showing
1 changed file
with
4 additions
and
2 deletions
yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileContentDAOImpl.java
| 1 | package cn.iocoder.yudao.module.infra.dal.mysql.file; | 1 | package cn.iocoder.yudao.module.infra.dal.mysql.file; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 3 | import cn.iocoder.yudao.framework.file.core.client.db.DBFileContentFrameworkDAO; | 4 | import cn.iocoder.yudao.framework.file.core.client.db.DBFileContentFrameworkDAO; |
| 4 | import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileContentDO; | 5 | import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileContentDO; |
| 5 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| 6 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
| 7 | 8 | ||
| 8 | import javax.annotation.Resource; | 9 | import javax.annotation.Resource; |
| 10 | +import java.util.List; | ||
| 9 | 11 | ||
| 10 | @Repository | 12 | @Repository |
| 11 | public class FileContentDAOImpl implements DBFileContentFrameworkDAO { | 13 | public class FileContentDAOImpl implements DBFileContentFrameworkDAO { |
| @@ -27,9 +29,9 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO { | @@ -27,9 +29,9 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO { | ||
| 27 | 29 | ||
| 28 | @Override | 30 | @Override |
| 29 | public byte[] selectContent(Long configId, String path) { | 31 | public byte[] selectContent(Long configId, String path) { |
| 30 | - FileContentDO fileContentDO = fileContentMapper.selectOne( | 32 | + List<FileContentDO> fileContentDOs = fileContentMapper.selectList( |
| 31 | buildQuery(configId, path).select(FileContentDO::getContent)); | 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 | private LambdaQueryWrapper<FileContentDO> buildQuery(Long configId, String path) { | 37 | private LambdaQueryWrapper<FileContentDO> buildQuery(Long configId, String path) { |