@Slf4j
public class ResponseFormat {
private ResponseFormat() {}
private static Map<String,String> messageMap = new HashMap<>();
static {
messageMap.put("200", "业务成功");
}
public static JSONObject buildResponseJson(String status, JSONObject responseJson) {
responseJson.put("code", status);
responseJson.put("msg", messageMap.get(status));
log.info("请求返回结果: {}", JSONObject.toJSONString(responseJson));
return responseJson;
}
}
springboot----统一接口返回的格式
最新推荐文章于 2024-08-30 07:00:00 发布