123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package com.yihu.wlyy.controller.endpoint;
- import com.fasterxml.jackson.annotation.JsonInclude;
- import com.yihu.wlyy.controller.endpoint.status.EnvelopStatus;
- import java.io.Serializable;
- /**
- * Rest Model - 基类
- */
- @JsonInclude(JsonInclude.Include.ALWAYS)
- public class Envelop implements Serializable {
- protected String message;
- protected Integer status = EnvelopStatus.success.code;
- public Integer getStatus() {
- return status;
- }
- public void setStatus(Integer status) {
- this.status = status;
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
- public static Envelop getSuccess(String message) {
- Envelop envelop = new Envelop();
- envelop.setMessage(message);
- envelop.setStatus(200);
- return envelop;
- }
- public static Envelop getError(String message, int errorCode) {
- Envelop envelop = new Envelop();
- envelop.setMessage(message);
- envelop.setStatus(errorCode);
- return envelop;
- }
- public static Envelop getError(String message) {
- Envelop envelop = new Envelop();
- envelop.setMessage(message);
- envelop.setStatus(-1);
- return envelop;
- }
- }
|