미리보기 추가

master
mjkhan21 1 year ago
parent a6ace9a047
commit 5b66e5539a

@ -150,9 +150,12 @@ public class CrudgenService extends AbstractServiceBean {
.set("success", true) .set("success", true)
.set("sourceCodes", sourceCodes); .set("sourceCodes", sourceCodes);
} catch (Exception e) { } catch (Exception e) {
String cause = rootCause(e).getMessage();
if (isEmpty(cause))
cause = rootCause(e).getClass().getName();
return result return result
.set("success", false) .set("success", false)
.set("cause", rootCause(e).getMessage()); .set("cause", cause);
} finally { } finally {
setEntityInfo(null); setEntityInfo(null);
} }

@ -20,6 +20,8 @@ public class FieldInfo {
"RGTR", "createdBy", "RGTR", "createdBy",
"MDFCN_DT", "lastModified", "MDFCN_DT", "lastModified",
"MDFR", "modifiedBy", "MDFR", "modifiedBy",
"DEL_DT", "removedAt",
"DLTR", "removedBy",
"USE_YN", "useYN" "USE_YN", "useYN"
); );

@ -1,11 +1,14 @@
package cokr.xit.tool.crudgen.web; package cokr.xit.tool.crudgen.web;
import java.util.Map;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import cokr.xit.foundation.web.AbstractController; import cokr.xit.foundation.web.AbstractController;
@ -22,11 +25,6 @@ public class CrudgenController extends AbstractController {
return new ModelAndView("index"); return new ModelAndView("index");
} }
@GetMapping("/preview.do")
public ModelAndView preview() {
return new ModelAndView("preview");
}
@GetMapping("/entityInfo.do") @GetMapping("/entityInfo.do")
public ModelAndView entityInfo(String tableName) { public ModelAndView entityInfo(String tableName) {
return new ModelAndView("jsonView") return new ModelAndView("jsonView")
@ -35,8 +33,15 @@ public class CrudgenController extends AbstractController {
@PostMapping("/generate.do") @PostMapping("/generate.do")
public ModelAndView generate(@RequestBody EntityInfo entityInfo) { public ModelAndView generate(@RequestBody EntityInfo entityInfo) {
Map<String, Object> result = service.generateCodes(entityInfo);
return new ModelAndView("jsonView") return new ModelAndView("jsonView")
.addAllObjects(service.generateCodes(entityInfo)); .addAllObjects(result);
}
@PostMapping("/preview.do")
public ModelAndView preview(@RequestParam Map<String, String> sourceCodes) {
return new ModelAndView("preview")
.addAllObjects(sourceCodes);
} }
@PostMapping("/create.do") @PostMapping("/create.do")

Loading…
Cancel
Save