From 5b66e5539a25eeef3a2a20fae697b13f90fefdf2 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 29 Jun 2023 17:00:26 +0900 Subject: [PATCH] =?UTF-8?q?=EB=AF=B8=EB=A6=AC=EB=B3=B4=EA=B8=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/crudgen/service/CrudgenService.java | 5 ++++- .../tool/crudgen/service/bean/FieldInfo.java | 2 ++ .../xit/tool/crudgen/web/CrudgenController.java | 17 +++++++++++------ 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/cokr/xit/tool/crudgen/service/CrudgenService.java b/src/main/java/cokr/xit/tool/crudgen/service/CrudgenService.java index 21252b4..ffa1680 100644 --- a/src/main/java/cokr/xit/tool/crudgen/service/CrudgenService.java +++ b/src/main/java/cokr/xit/tool/crudgen/service/CrudgenService.java @@ -150,9 +150,12 @@ public class CrudgenService extends AbstractServiceBean { .set("success", true) .set("sourceCodes", sourceCodes); } catch (Exception e) { + String cause = rootCause(e).getMessage(); + if (isEmpty(cause)) + cause = rootCause(e).getClass().getName(); return result .set("success", false) - .set("cause", rootCause(e).getMessage()); + .set("cause", cause); } finally { setEntityInfo(null); } diff --git a/src/main/java/cokr/xit/tool/crudgen/service/bean/FieldInfo.java b/src/main/java/cokr/xit/tool/crudgen/service/bean/FieldInfo.java index dfb6384..da11cf0 100644 --- a/src/main/java/cokr/xit/tool/crudgen/service/bean/FieldInfo.java +++ b/src/main/java/cokr/xit/tool/crudgen/service/bean/FieldInfo.java @@ -20,6 +20,8 @@ public class FieldInfo { "RGTR", "createdBy", "MDFCN_DT", "lastModified", "MDFR", "modifiedBy", + "DEL_DT", "removedAt", + "DLTR", "removedBy", "USE_YN", "useYN" ); diff --git a/src/main/java/cokr/xit/tool/crudgen/web/CrudgenController.java b/src/main/java/cokr/xit/tool/crudgen/web/CrudgenController.java index ce266cb..b9358dd 100644 --- a/src/main/java/cokr/xit/tool/crudgen/web/CrudgenController.java +++ b/src/main/java/cokr/xit/tool/crudgen/web/CrudgenController.java @@ -1,11 +1,14 @@ package cokr.xit.tool.crudgen.web; +import java.util.Map; + import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import cokr.xit.foundation.web.AbstractController; @@ -22,11 +25,6 @@ public class CrudgenController extends AbstractController { return new ModelAndView("index"); } - @GetMapping("/preview.do") - public ModelAndView preview() { - return new ModelAndView("preview"); - } - @GetMapping("/entityInfo.do") public ModelAndView entityInfo(String tableName) { return new ModelAndView("jsonView") @@ -35,8 +33,15 @@ public class CrudgenController extends AbstractController { @PostMapping("/generate.do") public ModelAndView generate(@RequestBody EntityInfo entityInfo) { + Map result = service.generateCodes(entityInfo); return new ModelAndView("jsonView") - .addAllObjects(service.generateCodes(entityInfo)); + .addAllObjects(result); + } + + @PostMapping("/preview.do") + public ModelAndView preview(@RequestParam Map sourceCodes) { + return new ModelAndView("preview") + .addAllObjects(sourceCodes); } @PostMapping("/create.do")