Index: web-module/src/main/java/egovframework/api/arms/module_pdversion/controller/UserPdVersionController.java =================================================================== diff -u -rbb23712e362c72f80a065643e0668cc2cf4af7bd -r524b04a947a9984b6a4c9a6e4294ab55fc6c8784 --- web-module/src/main/java/egovframework/api/arms/module_pdversion/controller/UserPdVersionController.java (.../UserPdVersionController.java) (revision bb23712e362c72f80a065643e0668cc2cf4af7bd) +++ web-module/src/main/java/egovframework/api/arms/module_pdversion/controller/UserPdVersionController.java (.../UserPdVersionController.java) (revision 524b04a947a9984b6a4c9a6e4294ab55fc6c8784) @@ -12,6 +12,7 @@ package egovframework.api.arms.module_pdversion.controller; import egovframework.api.arms.devicelist.service.DeviceListService; +import egovframework.api.arms.module_pdservice.model.PdServiceDTO; import lombok.extern.slf4j.Slf4j; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -62,4 +63,17 @@ return modelAndView; } + @RequestMapping(value="/updateVersionNode.do", method=RequestMethod.POST) + public ModelAndView updateVersionNode(PdVersionDTO pdVersionDTO, + BindingResult bindingResult) throws Exception { + if (bindingResult.hasErrors()) + throw new RuntimeException(); + + + ModelAndView modelAndView = new ModelAndView("jsonView"); + modelAndView.addObject("result", pdVersion.updateVersionNode(pdVersionDTO)); + + return modelAndView; + } + } Index: web-module/src/main/java/egovframework/api/arms/module_pdversion/service/PdVersion.java =================================================================== diff -u -rbb23712e362c72f80a065643e0668cc2cf4af7bd -r524b04a947a9984b6a4c9a6e4294ab55fc6c8784 --- web-module/src/main/java/egovframework/api/arms/module_pdversion/service/PdVersion.java (.../PdVersion.java) (revision bb23712e362c72f80a065643e0668cc2cf4af7bd) +++ web-module/src/main/java/egovframework/api/arms/module_pdversion/service/PdVersion.java (.../PdVersion.java) (revision 524b04a947a9984b6a4c9a6e4294ab55fc6c8784) @@ -11,6 +11,7 @@ */ package egovframework.api.arms.module_pdversion.service; +import egovframework.api.arms.module_pdversion.model.PdVersionDTO; import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateService; import egovframework.com.ext.jstree.springHibernate.core.vo.JsTreeHibernateSearchDTO; @@ -19,5 +20,6 @@ public interface PdVersion extends JsTreeHibernateService { public List getVersion(T jsTreeHibernateDTO) throws Exception; + public int updateVersionNode(T jsTreeHibernateDTO) throws Exception; } \ No newline at end of file Index: web-module/src/main/java/egovframework/api/arms/module_pdversion/service/PdVersionImpl.java =================================================================== diff -u -rbb23712e362c72f80a065643e0668cc2cf4af7bd -r524b04a947a9984b6a4c9a6e4294ab55fc6c8784 --- web-module/src/main/java/egovframework/api/arms/module_pdversion/service/PdVersionImpl.java (.../PdVersionImpl.java) (revision bb23712e362c72f80a065643e0668cc2cf4af7bd) +++ web-module/src/main/java/egovframework/api/arms/module_pdversion/service/PdVersionImpl.java (.../PdVersionImpl.java) (revision 524b04a947a9984b6a4c9a6e4294ab55fc6c8784) @@ -11,15 +11,21 @@ */ package egovframework.api.arms.module_pdversion.service; +import egovframework.api.arms.module_pdservice.model.PdServiceDTO; +import egovframework.api.arms.module_pdversion.model.PdVersionDTO; 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.hibernate.criterion.Order; 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 org.springframework.util.ObjectUtils; import javax.annotation.Resource; +import java.lang.reflect.Field; import java.util.List; @Service("pdVersion") @@ -39,4 +45,31 @@ List list = jsTreeHibernateDao.getList(jsTreeHibernateDTO); return list; } + + + @SuppressWarnings("unchecked") + @Transactional(rollbackFor = { Exception.class }, propagation = Propagation.REQUIRED) + public int updateVersionNode(T jsTreeHibernateDTO) throws Exception { + + jsTreeHibernateDao.setClazz(jsTreeHibernateDTO.getClass()); + T alterTargetNode = (T) jsTreeHibernateDao.getUnique(jsTreeHibernateDTO.getC_id()); + + for (Field field : jsTreeHibernateDTO.getClass().getDeclaredFields()) { + + field.setAccessible(true); + + Object value = field.get(jsTreeHibernateDTO); + + if (!ObjectUtils.isEmpty(value)) { + field.setAccessible(true); + field.set(alterTargetNode, value); + } + + } + jsTreeHibernateDao.update(alterTargetNode); + + + return 1; + + } } \ No newline at end of file