mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
fix: 重复 file 路径 Bug
This commit is contained in:
parent
639c7820f9
commit
906a3a2c50
@ -8,6 +8,7 @@ import org.springframework.stereotype.Repository;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
|
public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
|
||||||
@ -29,9 +30,11 @@ public class FileContentDAOImpl implements DBFileContentFrameworkDAO {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] selectContent(Long configId, String path) {
|
public byte[] selectContent(Long configId, String path) {
|
||||||
List<FileContentDO> fileContentDOs = fileContentMapper.selectList(
|
List<FileContentDO> list = fileContentMapper.selectList(
|
||||||
buildQuery(configId, path).select(FileContentDO::getContent).orderByDesc(FileContentDO::getId));
|
buildQuery(configId, path).select(FileContentDO::getContent).orderByDesc(FileContentDO::getId));
|
||||||
return CollUtil.isNotEmpty(fileContentDOs) ? CollUtil.getFirst(fileContentDOs).getContent() : null;
|
return Optional.ofNullable(CollUtil.getFirst(list))
|
||||||
|
.map(FileContentDO::getContent)
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private LambdaQueryWrapper<FileContentDO> buildQuery(Long configId, String path) {
|
private LambdaQueryWrapper<FileContentDO> buildQuery(Long configId, String path) {
|
||||||
|
Loading…
Reference in New Issue
Block a user