1 package com.-.it.regioc.bean.config.prefer; 2 3 import org.jetbrains.annotations.NotNull; 4 import lombok.AllArgsConstructor; 5 import lombok.Data; 6 import lombok.NoArgsConstructor; 7 8 /** 9 * 用户偏好探针 10 */ 11 @Data 12 @NoArgsConstructor 13 @AllArgsConstructor 14 public class PreferProbeItem implements Comparable<PreferProbeItem> { 15 16 private String userId; 17 18 private String topic; 19 20 private String stage; 21 22 private String probeId; 23 24 private String probeName; 25 26 // 喜欢的rank赋值1,不关注的0 27 private Integer rank; 28 29 @Override 30 public int compareTo(@NotNull PreferProbeItem o) { 31 if (this.rank == null || this.rank == 0) { 32 return -1; 33 } 34 return this.rank.compareTo(o.getRank()); 35 } 36 }
标签:实体类,String,NoArgsConstructor,对象,rank,private,import,lombok,排序 From: https://www.cnblogs.com/mingruifeng/p/16916319.html