Index: web-module/pom.xml =================================================================== diff -u -re5ffab326fe30833c11f003b3122154212dc7ebd -r564aed4de8790496d949ca204ac04e09ebce1785 --- web-module/pom.xml (.../pom.xml) (revision e5ffab326fe30833c11f003b3122154212dc7ebd) +++ web-module/pom.xml (.../pom.xml) (revision 564aed4de8790496d949ca204ac04e09ebce1785) @@ -17,7 +17,7 @@ Web Project by 313 DEV GRP - 22.07.20 + 22.07.24 Index: web-module/src/main/java/egovframework/api/arms/module_pdservice/controller/UserPdServiceController.java =================================================================== diff -u -r3bdd902ff67d96fd205d1926c558b2eac47cd0ad -r564aed4de8790496d949ca204ac04e09ebce1785 --- web-module/src/main/java/egovframework/api/arms/module_pdservice/controller/UserPdServiceController.java (.../UserPdServiceController.java) (revision 3bdd902ff67d96fd205d1926c558b2eac47cd0ad) +++ web-module/src/main/java/egovframework/api/arms/module_pdservice/controller/UserPdServiceController.java (.../UserPdServiceController.java) (revision 564aed4de8790496d949ca204ac04e09ebce1785) @@ -20,13 +20,16 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; +import org.springframework.util.ObjectUtils; import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.servlet.ModelAndView; import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; +import java.lang.reflect.Field; import java.util.Comparator; import java.util.List; import java.util.NoSuchElementException; @@ -38,6 +41,7 @@ @Slf4j @Controller +@CrossOrigin(origins = "http://localhost:9999") @RequestMapping(value = {"/auth-user/api/arms/pdservice"}) public class UserPdServiceController extends SHVAbstractController { @@ -121,4 +125,26 @@ return "egovframework/com/utl/wed/EgovInsertImage"; } + @RequestMapping(value="/updateContentsToNode.do", method=RequestMethod.POST) + public ModelAndView updateContentsToNode(PdServiceDTO pdServiceDTO, + BindingResult bindingResult) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + +// 나중에 jstree core lib 에 넣어서 자동으로 필드 돌아다니며 업데이트 하게하는 업데이트 메소드 구성 +// for (Field field : pdServiceDTO.getClass().getDeclaredFields()) { +// field.setAccessible(true); +// Object value = field.get(pdServiceDTO); +// +// if (!ObjectUtils.isEmpty(value)) { +// logger.info(field.getName() + "->" + value); +// } +// } + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", pdService.updateContentsNode(pdServiceDTO)); + + return modelAndView; + } + } \ No newline at end of file Index: web-module/src/main/java/egovframework/api/arms/module_pdservice/model/PdServiceDTO.java =================================================================== diff -u -r3bdd902ff67d96fd205d1926c558b2eac47cd0ad -r564aed4de8790496d949ca204ac04e09ebce1785 --- web-module/src/main/java/egovframework/api/arms/module_pdservice/model/PdServiceDTO.java (.../PdServiceDTO.java) (revision 3bdd902ff67d96fd205d1926c558b2eac47cd0ad) +++ web-module/src/main/java/egovframework/api/arms/module_pdservice/model/PdServiceDTO.java (.../PdServiceDTO.java) (revision 564aed4de8790496d949ca204ac04e09ebce1785) @@ -41,7 +41,18 @@ } //@Getter @Setter + private String c_contents; + @Lob + @Column(name="C_CONTENTS") + public String getC_contents() { + return c_contents; + } + + public void setC_contents(String c_contents) { + this.c_contents = c_contents; + } + /* * Extend Bean Field */ Index: web-module/src/main/java/egovframework/api/arms/module_pdservice/service/PdService.java =================================================================== diff -u -r3bdd902ff67d96fd205d1926c558b2eac47cd0ad -r564aed4de8790496d949ca204ac04e09ebce1785 --- web-module/src/main/java/egovframework/api/arms/module_pdservice/service/PdService.java (.../PdService.java) (revision 3bdd902ff67d96fd205d1926c558b2eac47cd0ad) +++ web-module/src/main/java/egovframework/api/arms/module_pdservice/service/PdService.java (.../PdService.java) (revision 564aed4de8790496d949ca204ac04e09ebce1785) @@ -11,10 +11,12 @@ */ package egovframework.api.arms.module_pdservice.service; +import egovframework.api.arms.module_pdservice.model.PdServiceDTO; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; public interface PdService extends JsTreeHibernateService { + public int updateContentsNode(T jsTreeHibernateDTO) throws Exception; - } \ No newline at end of file Index: web-module/src/main/java/egovframework/api/arms/module_pdservice/service/PdServiceImpl.java =================================================================== diff -u -r3bdd902ff67d96fd205d1926c558b2eac47cd0ad -r564aed4de8790496d949ca204ac04e09ebce1785 --- web-module/src/main/java/egovframework/api/arms/module_pdservice/service/PdServiceImpl.java (.../PdServiceImpl.java) (revision 3bdd902ff67d96fd205d1926c558b2eac47cd0ad) +++ web-module/src/main/java/egovframework/api/arms/module_pdservice/service/PdServiceImpl.java (.../PdServiceImpl.java) (revision 564aed4de8790496d949ca204ac04e09ebce1785) @@ -11,12 +11,36 @@ */ package egovframework.api.arms.module_pdservice.service; +import egovframework.api.arms.module_pdservice.model.PdServiceDTO; +import egovframework.com.ext.jstree.springHibernate.core.dao.JsTreeHibernateDao; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateServiceImpl; +import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; + @Service("pdService") public class PdServiceImpl extends JsTreeHibernateServiceImpl implements PdService{ + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + @Resource( + name = "jsTreeHibernateDao" + ) + private JsTreeHibernateDao jsTreeHibernateDao; + @SuppressWarnings("unchecked") + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public int updateContentsNode(T jsTreeHibernateDTO) throws Exception { + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + T alterTargetNode = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getC_id()); + alterTargetNode.setC_contents(jsTreeHibernateDTO.getC_contents()); + jsTreeHibernateDao.update(alterTargetNode); + return 1; + } + } \ No newline at end of file