短信提交 2021-04-03,重构返回的结果
This commit is contained in:
20
src/main/java/cn/iocoder/dashboard/common/core/KeyValue.java
Normal file
20
src/main/java/cn/iocoder/dashboard/common/core/KeyValue.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.dashboard.common.core;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Key Value 的键值对
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class KeyValue<K, V> {
|
||||
|
||||
private K key;
|
||||
private V value;
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 通用返回
|
||||
@@ -67,9 +68,13 @@ public class CommonResult<T> implements Serializable {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean isSuccess(Integer code) {
|
||||
return Objects.equals(code, GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||
}
|
||||
|
||||
@JsonIgnore // 避免 jackson 序列化
|
||||
public boolean isSuccess() {
|
||||
return GlobalErrorCodeConstants.SUCCESS.getCode().equals(code);
|
||||
return isSuccess(GlobalErrorCodeConstants.SUCCESS.getCode());
|
||||
}
|
||||
|
||||
@JsonIgnore // 避免 jackson 序列化
|
||||
|
||||
Reference in New Issue
Block a user