diff --git a/src/main/java/cokr/xit/fims/base/CodeController.java b/src/main/java/cokr/xit/fims/base/CodeController.java index d55da1ae..06dbbd01 100644 --- a/src/main/java/cokr/xit/fims/base/CodeController.java +++ b/src/main/java/cokr/xit/fims/base/CodeController.java @@ -1,6 +1,36 @@ package cokr.xit.fims.base; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import javax.annotation.Resource; + import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import cokr.xit.base.code.service.CodeQuery; +import cokr.xit.base.code.service.bean.CodeBean; +import cokr.xit.foundation.data.DataObject; @Controller -public class CodeController extends cokr.xit.base.code.web.CodeController {} \ No newline at end of file +public class CodeController extends cokr.xit.base.code.web.CodeController { + @Resource(name = "codeBean") + private CodeBean codeBean; + + @RequestMapping(name="모든 업무구분코드 조회",value="/getAllTaskSeCd.do") + public ModelAndView getAllTaskSeCd() { + ModelAndView mav = new ModelAndView("jsonView"); + + CodeQuery codeQuery = new CodeQuery(); + codeQuery.setGroupIDs("FIM054"); + List taskList = codeBean.getCodeList(codeQuery); + Map allTask = taskList.stream() + .collect(Collectors.toMap((item) -> item.string("CODE"), (item) -> item.string("CODE_VAL"))); + mav.addObject("allTask", allTask); + + return mav; + } + +} \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/base/UserController.java b/src/main/java/cokr/xit/fims/base/UserController.java index 50e16d4b..0921a7b6 100644 --- a/src/main/java/cokr/xit/fims/base/UserController.java +++ b/src/main/java/cokr/xit/fims/base/UserController.java @@ -140,6 +140,17 @@ public class UserController extends cokr.xit.base.user.web.UserController params); + /**사용자의 기본 업무를 등록한다. + * @param params 사용자 설정 정보 + * @return 저장여부 + */ + int insertDefaultTask(Map params); + + /**사용자의 기본 업무를 변경한다. + * @param params 사용자 설정 정보 + * @return 저장여부 + */ + int updateDefaultTask(Map params); + } diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java index 873a29b3..890300dd 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/StngBean.java @@ -123,13 +123,41 @@ public class StngBean extends AbstractComponent { return; } - String defaultTask = stngMapper.selectDefaultTask(userInfo.getId()); + DataObject defaultTask = stngMapper.selectDefaultTask(userInfo.getId()); if(defaultTask == null) { userInfo.getInfo().put("defaultTask", ""); } else { - userInfo.getInfo().put("defaultTask", defaultTask); + userInfo.getInfo().put("defaultTask", defaultTask.string("TASK_SE_CD")); } } + /** 사용자의 기본업무 설정을 저장한다. + * @param taskSeCd 업무구분코드 + * @return 저장 여부 + *
  • 저장됐으면 true
  • + *
  • 그렇지 않으면 false
  • + *
+ */ + public boolean saveDefaultTask(String taskSeCd) { + + DataObject info = stngMapper.selectDefaultTask(currentUser().getId()); + int effected = 0; + + Map params = new HashMap(); + params.put("userId", currentUser().getId()); + params.put("taskSeCd", taskSeCd); + + if(info == null) { + params.put("rgtr", currentUser().getId()); + effected = stngMapper.insertDefaultTask(params); + } else { + params.put("mdfr", currentUser().getId()); + params.put("taskMtchgId",info.string("TASK_MTCHG_ID")); + effected = stngMapper.updateDefaultTask(params); + } + + return effected == 1 ? true : false; + } + } diff --git a/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml b/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml index 16b6c91d..26aae079 100644 --- a/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml +++ b/src/main/resources/sql/mapper/fims/cmmn/stng-mapper.xml @@ -2,9 +2,10 @@ - /* 사용자 기본업무 조회 (stngMapper.selectDefaultTask) */ -SELECT TM.TASK_SE_CD +SELECT TM.TASK_MTCHG_ID + , TM.TASK_SE_CD FROM TB_TASK_MTCHG TM WHERE TM.USER_ID = #{userId} AND TM.USE_YN = 'Y' @@ -60,4 +61,39 @@ UPDATE TB_DEPT WHERE DEPT_CD = #{deptCd} + +/* 사용자 기본 업무 등록 (stngMapper.insertDefaultTask) */ + +SELECT + LPAD(CAST(IFNULL(MAX(TASK_MTCHG_ID) + 1, 1) AS INT), 10, '0') + AS NEW_ID +FROM TB_TASK_MTCHG + +INSERT + INTO TB_TASK_MTCHG ( + TASK_MTCHG_ID + , USER_ID + , TASK_SE_CD + , USE_YN + , REG_DT + , RGTR + ) VALUES ( + #{taskMtchgId} + , #{userId} + , #{taskSeCd} + , 'Y' + , + , #{rgtr} + ) + + + +/* 사용자 기본 업무 변경 (stngMapper.updateDefaultTask) */ +UPDATE TB_TASK_MTCHG + SET MDFR = #{mdfr} + , MDFCN_DT = + , TASK_SE_CD = #{taskSeCd} + WHERE TASK_MTCHG_ID = #{taskMtchgId} + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp index c508f6e4..d6591575 100644 --- a/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/src/main/webapp/WEB-INF/jsp/index.jsp @@ -39,14 +39,8 @@