From 0dd7bab4874b527275d23684dd1f8b738cfd5575 Mon Sep 17 00:00:00 2001 From: ahah525 Date: Tue, 8 Nov 2022 10:56:55 +0900 Subject: [PATCH] =?UTF-8?q?#2=20-=20Feat:=20RsData(REST=20API=20=EC=9A=A9?= =?UTF-8?q?=20ResponseEntity=20Body=20DTO)=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../example/mutbooks/app/base/dto/RsData.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 4Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/dto/RsData.java diff --git a/4Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/dto/RsData.java b/4Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/dto/RsData.java new file mode 100644 index 0000000..bd8b69f --- /dev/null +++ b/4Week_Mission/mutbooks/src/main/java/com/example/mutbooks/app/base/dto/RsData.java @@ -0,0 +1,26 @@ +package com.example.mutbooks.app.base.dto; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class RsData { + private String resultCode; + private String msg; + private T data; + + public static RsData of(String resultCode, String msg) { + return new RsData<>(resultCode, msg, null); + } + + public boolean isSuccess() { + return resultCode.startsWith("S-1"); + } + + public boolean isFail() { + return isSuccess() == false; + } +}