48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package com.tenwa.app.invoice.utils;
|
|
|
|
|
|
import com.tenwa.app.invoice.data.ResponseEnum;
|
|
import com.tenwa.app.invoice.pojo.ResultPojo;
|
|
|
|
public class ResultUtil {
|
|
public static ResultPojo success(Object data){
|
|
ResultPojo resultPojo = new ResultPojo();
|
|
resultPojo.setCode(ResponseEnum.SUCCESS.getCode());
|
|
resultPojo.setMsg(ResponseEnum.SUCCESS.getMsg());
|
|
resultPojo.setData(data);
|
|
return resultPojo;
|
|
}
|
|
public static ResultPojo success(){
|
|
ResultPojo resultPojo = new ResultPojo();
|
|
resultPojo.setCode(ResponseEnum.SUCCESS.getCode());
|
|
resultPojo.setMsg(ResponseEnum.SUCCESS.getMsg());
|
|
resultPojo.setData(null);
|
|
return resultPojo;
|
|
}
|
|
public static ResultPojo error(String msg){
|
|
ResultPojo resultPojo = new ResultPojo();
|
|
resultPojo.setCode(ResponseEnum.ERROR.getCode());
|
|
resultPojo.setMsg(msg);
|
|
resultPojo.setData(null);
|
|
return resultPojo;
|
|
}
|
|
public static ResultPojo error(ResponseEnum responseEnum){
|
|
ResultPojo resultPojo = new ResultPojo();
|
|
resultPojo.setCode(responseEnum.getCode());
|
|
resultPojo.setMsg(responseEnum.getMsg());
|
|
resultPojo.setData(null);
|
|
return resultPojo;
|
|
}
|
|
public static ResultPojo error(){
|
|
ResultPojo resultPojo = new ResultPojo();
|
|
resultPojo.setCode(ResponseEnum.ERROR.getCode());
|
|
resultPojo.setMsg(ResponseEnum.ERROR.getMsg());
|
|
resultPojo.setData(null);
|
|
return resultPojo;
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|