Add ResultGenerator.java

wuxinrui
pho6e2qjw 5 months ago
parent 798482c9ec
commit 3be168b3b2

@ -0,0 +1,42 @@
package com.power.travel.core;
/**
*
*/
public class ResultGenerator {
private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
public static Result genSuccessResult() {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE);
}
public static Result genSuccessResult(Object data) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE)
.setData(data);
}
public static Result genSuccessMsgResult(String msg) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(msg);
}
public static Result genFailResult(String message) {
return new Result()
.setCode(ResultCode.FAIL)
.setMessage(message);
}
public static Result genResult(String message) {
return new Result()
.setCode(ResultCode.DATA_ERROR)
.setMessage(message);
}
}
Loading…
Cancel
Save