mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 地锁逻辑修改
This commit is contained in:
85
jsowell-admin/src/test/java/Test.java
Normal file
85
jsowell-admin/src/test/java/Test.java
Normal file
@@ -0,0 +1,85 @@
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @program: com.cjml.service.partitem
|
||||
* @description:
|
||||
* @author: dc
|
||||
* @create: 2023-09-09 13:46
|
||||
**/
|
||||
public class Test {
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<Category> testList = Lists.newArrayList();
|
||||
testList.add(new Category("100-50-10", 100, 50, 10));
|
||||
testList.add(new Category("110-30-8", 110, 30, 8));
|
||||
testList.add(new Category("0-10-12", 0, 10, 12));
|
||||
|
||||
testList = testList.stream().sorted(
|
||||
Comparator.comparing(Category::getCategoryGroupSort, Comparator.reverseOrder())
|
||||
.thenComparing(Category::getCategorySort, Comparator.reverseOrder())
|
||||
.thenComparing(Category::getPartSort)
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
System.out.println(testList.get(0).getCategoryName());
|
||||
System.out.println(testList.get(1).getCategoryName());
|
||||
System.out.println(testList.get(2).getCategoryName());
|
||||
}
|
||||
|
||||
static class Category {
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private int categoryGroupSort;
|
||||
|
||||
private int categorySort;
|
||||
|
||||
private int partSort;
|
||||
|
||||
public Category() {
|
||||
}
|
||||
|
||||
public Category(String categoryName, int categoryGroupSort, int categorySort, int partSort) {
|
||||
this.categoryName = categoryName;
|
||||
this.categoryGroupSort = categoryGroupSort;
|
||||
this.categorySort = categorySort;
|
||||
this.partSort = partSort;
|
||||
}
|
||||
|
||||
public String getCategoryName() {
|
||||
return categoryName;
|
||||
}
|
||||
|
||||
public void setCategoryName(String categoryName) {
|
||||
this.categoryName = categoryName;
|
||||
}
|
||||
|
||||
public int getCategoryGroupSort() {
|
||||
return categoryGroupSort;
|
||||
}
|
||||
|
||||
public void setCategoryGroupSort(int categoryGroupSort) {
|
||||
this.categoryGroupSort = categoryGroupSort;
|
||||
}
|
||||
|
||||
public int getCategorySort() {
|
||||
return categorySort;
|
||||
}
|
||||
|
||||
public void setCategorySort(int categorySort) {
|
||||
this.categorySort = categorySort;
|
||||
}
|
||||
|
||||
public int getPartSort() {
|
||||
return partSort;
|
||||
}
|
||||
|
||||
public void setPartSort(int partSort) {
|
||||
this.partSort = partSort;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user