薪资项目排序比较

This commit is contained in:
Harryxzy 2023-07-11 13:23:07 +08:00
parent e464ca8ba6
commit fa950fb4dd
1 changed files with 4 additions and 18 deletions

View File

@ -140,27 +140,13 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
.sorted(new Comparator<SalaryItemPO>() {
@Override
public int compare(SalaryItemPO o1, SalaryItemPO o2) {
if(o1 == null)
return 1;
if(o2 == null)
return -1;
if(o1 == null && o2 == null)
return 0;
if(o1.getSortedIndex() == null && o2.getSortedIndex() == null){
Integer systemType1=o1.getSystemType();
Integer systemType2=o2.getSystemType();
if(systemType1 == null)
systemType1=0;
if(systemType2 == null)
systemType2=0;
Integer systemType1=o1.getSystemType() == null ? 0 : o1.getSystemType();
Integer systemType2=o2.getSystemType() == null ? 0 : o2.getSystemType();
return systemType1.compareTo(systemType2);
}else{
Integer sortedIndex1=o1.getSortedIndex();
Integer sortedIndex2=o2.getSortedIndex();
if(sortedIndex1 == null)
sortedIndex1=0;
if(sortedIndex2 == null)
sortedIndex2=0;
Integer sortedIndex1=o1.getSortedIndex() == null ? 0 : o1.getSortedIndex();
Integer sortedIndex2=o2.getSortedIndex() == null ? 0 : o2.getSortedIndex();
return sortedIndex2.compareTo(sortedIndex1);
}
}