From 4e38d0e6db21688388bf1b1a0a1ae529c05b77e7 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期四, 18 四月 2024 14:38:20 +0800
Subject: [PATCH] 提交更新测试
---
hangzhoumesParent/common/servicebase/src/main/java/com/mes/utils/ResponseUtil.java | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/hangzhoumesParent/common/servicebase/src/main/java/com/mes/utils/ResponseUtil.java b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/utils/ResponseUtil.java
new file mode 100644
index 0000000..ad4f177
--- /dev/null
+++ b/hangzhoumesParent/common/servicebase/src/main/java/com/mes/utils/ResponseUtil.java
@@ -0,0 +1,28 @@
+package com.mes.utils;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.springframework.http.HttpStatus;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
+/**
+ * @Author : zhoush
+ * @Date: 2024/4/8 15:46
+ * @Description:
+ */
+public class ResponseUtil {
+
+ public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";
+
+ public static void out(HttpServletResponse response, Result r) {
+ ObjectMapper mapper = new ObjectMapper();
+ response.setStatus(HttpStatus.OK.value());
+ response.setContentType(APPLICATION_JSON_UTF8_VALUE);
+ try {
+ mapper.writeValue(response.getWriter(), r);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
--
Gitblit v1.8.0