fix:文件列表展示数据时,需要文件夹在前面,文件在后面
This commit is contained in:
@@ -49,9 +49,25 @@ public enum DirTypeEnum {
|
||||
* 报告模板库
|
||||
*/
|
||||
@Schema(description = "报告模板库文件夹", example = "8")
|
||||
REPORT_TEMPLATE_DIR("reportTemplate", 8);
|
||||
REPORT_TEMPLATE_DIR("reportTemplate", 8),
|
||||
|
||||
/*
|
||||
* 机器人库
|
||||
*/
|
||||
@Schema(description = "机器人库文件夹", example = "9")
|
||||
ROBOT_DIR("robot", 9),
|
||||
|
||||
/**
|
||||
* 工业设计库
|
||||
*/
|
||||
@Schema(description = "工业设计库文件夹", example = "10")
|
||||
INDUSTRIAL_DESIGN_DIR("industrialDesign", 10),
|
||||
|
||||
/**
|
||||
* 公差分析库
|
||||
*/
|
||||
@Schema(description = "公差分析库文件夹", example = "11")
|
||||
TOLERANCE_ANALYSIS_DIR("toleranceAnalysis", 11);
|
||||
|
||||
String dirName;
|
||||
int value;
|
||||
|
||||
@@ -360,8 +360,16 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
}
|
||||
|
||||
if(CollectionUtils.isNotEmpty(result)) {
|
||||
// 根据children中的最大创建时间对result进行倒序排序
|
||||
// 先按dataType排序(文件夹在前dataType=1,文件在后dataType=2),再按children中的最大创建时间倒序排序
|
||||
result.sort((dto1, dto2) -> {
|
||||
// 首先按dataType排序:文件夹(1)在前,文件(2)在后
|
||||
Integer dataType1 = dto1.getDataType();
|
||||
Integer dataType2 = dto2.getDataType();
|
||||
if (dataType1 != null && dataType2 != null && !dataType1.equals(dataType2)) {
|
||||
return dataType1.compareTo(dataType2); // 升序:1(文件夹) < 2(文件)
|
||||
}
|
||||
|
||||
// dataType相同或都为null时,按创建时间倒序排序
|
||||
LocalDateTime maxCreateTime1 = dto1.getMergeSameNameChildren().stream()
|
||||
.map(FileMetadataInfoResp::getCreateTime)
|
||||
.filter(Objects::nonNull)
|
||||
|
||||
@@ -875,6 +875,9 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
.eq(FileMetadataInfo::getIsLatest, FileIsLastEnum.YES.getValue())
|
||||
// 审核完成 ,元数据修改审核中,文件修改审核中,删除文件审核中
|
||||
.in(FileMetadataInfo::getApproveType,fileDatdList)
|
||||
// 文件夹在前(dataType=1),文件在后(dataType=2),同类型内按名称升序
|
||||
.orderByAsc(FileMetadataInfo::getDataType)
|
||||
.orderByDesc(FileMetadataInfo::getCreateTime)
|
||||
.list();
|
||||
// 创建人赋值
|
||||
setCreatorNames(list);
|
||||
|
||||
@@ -62,6 +62,6 @@
|
||||
</if>
|
||||
|
||||
<!-- 排序:无论是否联合,都对最终结果排序 -->
|
||||
ORDER BY updateTime DESC
|
||||
ORDER BY dataType ASC, updateTime DESC
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user