You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
908 B
55 lines
908 B
//数据封装
|
|
package com.power.travel.core;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
/**
|
|
* 统一API响应结果封装
|
|
*/
|
|
public class Result {
|
|
|
|
private int code;
|
|
|
|
private String message;
|
|
|
|
private Object data;
|
|
|
|
public Result setCode(ResultCode resultCode) {
|
|
this.code = resultCode.getCode();
|
|
return this;
|
|
}
|
|
|
|
public int getCode() {
|
|
return code;
|
|
}
|
|
|
|
public Result setCode(int code) {
|
|
this.code = code;
|
|
return this;
|
|
}
|
|
|
|
public String getMessage() {
|
|
return message;
|
|
}
|
|
|
|
public Result setMessage(String message) {
|
|
this.message = message;
|
|
return this;
|
|
}
|
|
|
|
public Object getData() {
|
|
return data;
|
|
}
|
|
|
|
public Result setData(Object data) {
|
|
this.data = data;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return JSON.toJSONString(this);
|
|
}
|
|
|
|
}
|