feat: 프로그램 관리 - 변경

등록 / 삭제 - 진행중
main
Jonguk. Lim 2 years ago
parent 41dcbd11eb
commit b9a4001252

@ -59,7 +59,7 @@ public class FimsTotalPopupController {
return FimsConst.FIMS_JSP_BASE_PATH
+"common/popup/fimsTotal"
+"_"+new Object() {}.getClass().getEnclosingMethod().getName()
+".fims-pop"; //메소드명
+".popup"; //메소드명
}

@ -1,13 +1,11 @@
package kr.xit.framework.biz.mng.mapper;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.session.RowBounds;
import egovframework.rte.psl.dataaccess.mapper.Mapper;
import kr.xit.framework.biz.mng.model.ProgramMngSearchVO;
import kr.xit.framework.biz.mng.model.ProgramMngVO;
/**
@ -30,16 +28,7 @@ public interface ProgramMngMapper {
* @author:
* @date: 2020. 3. 26.
*/
public List<ProgramMngVO> findList(Map<String, Object> map, RowBounds rowBounds);
/**
* <pre> : </pre>
* @param searchVO
* @return int
* @author:
* @date: 2020. 3. 26.
*/
public int findListTotCnt(ProgramMngSearchVO searchVO);
List<ProgramMngVO> selectPrograms(final Map<String, Object> map, final RowBounds rowBounds);
/**
* <pre> : </pre>
@ -48,23 +37,15 @@ public interface ProgramMngMapper {
* @author:
* @date: 2020. 3. 26.
*/
public ProgramMngVO findView(ProgramMngVO vo);
ProgramMngVO selectProgram(final ProgramMngVO vo);
/**
* <pre> : </pre>
* @return
* @throws SQLException int
* @author:
* @date: 2020. 3. 27.
*/
public int deleteAllProgrm();
int updateProgram(final ProgramMngVO vo);
int insertProgram(final ProgramMngVO vo);
/**
* <pre> : </pre>
* @return
* @throws SQLException int
* @author:
* <pre> : </pre>
* @date: 2020. 3. 27.
*/
public int deleteAllProgrmDtls();
int deleteProgram(final ProgramMngVO vo);
}

@ -251,7 +251,7 @@ public class XitMenuListMngServiceImpl implements XitMenuListMngService {
* @exception Exception
*/
private boolean deleteAllProgrm() throws Exception {
programMngMapper.deleteAllProgrm();
//programMngMapper.deleteAllProgrm();
return true;
}
@ -261,7 +261,7 @@ public class XitMenuListMngServiceImpl implements XitMenuListMngService {
* @exception Exception
*/
private boolean deleteAllProgrmDtls() throws Exception {
programMngMapper.deleteAllProgrmDtls();
//programMngMapper.deleteAllProgrmDtls();
return true;
}
@ -534,10 +534,10 @@ public class XitMenuListMngServiceImpl implements XitMenuListMngService {
* @exception Exception
*/
private boolean insertProgrm(ProgramMngVO vo) throws Exception {
if(XitCmmnUtil.isEmpty(programMngService.findView(vo)))
programMngService.addProc(vo);
else
programMngService.modifyProc(vo);
//if(XitCmmnUtil.isEmpty(programMngService.findProgram(vo)))
// programMngService.addProc(vo);
//else
// programMngService.modifyProc(vo);
return true;
}

@ -34,6 +34,7 @@ public class ProgramMngVO extends BaseVO {
/** 프로그램파일명 */
private String progrmFileNm;
/** 프로그램저장경로 */
private String progrmStreCours;
private String progrmStrePath;
/** 프로그램한글명 */
private String progrmKoreanNm;

@ -27,16 +27,7 @@ public interface ProgramMngService {
* @author:
* @date: 2020. 3. 26.
*/
public List<ProgramMngVO> findList(Map<String, Object> paramMap, RowBounds rowBounds);
/**
* <pre> : </pre>
* @param searchVO
* @return int
* @author:
* @date: 2020. 3. 26.
*/
public int findListTotCnt(ProgramMngSearchVO searchVO);
List<ProgramMngVO> findPrograms(final Map<String, Object> paramMap, final RowBounds rowBounds);
/**
* <pre> : </pre>
@ -45,7 +36,7 @@ public interface ProgramMngService {
* @author:
* @date: 2020. 3. 26.
*/
public ProgramMngVO findView(ProgramMngVO vo);
ProgramMngVO findProgram(final ProgramMngVO vo);
/**
* <pre> : </pre>
@ -53,7 +44,7 @@ public interface ProgramMngService {
* @author:
* @date: 2020. 3. 26.
*/
public void addProc(ProgramMngVO vo);
int addProgram(final ProgramMngVO vo);
/**
* <pre> : </pre>
@ -61,7 +52,7 @@ public interface ProgramMngService {
* @author:
* @date: 2020. 3. 26.
*/
public void modifyProc(ProgramMngVO vo);
int modifyProgram(final ProgramMngVO vo);
/**
* <pre> : </pre>
@ -69,7 +60,7 @@ public interface ProgramMngService {
* @author:
* @date: 2020. 3. 26.
*/
public void removeProc(ProgramMngVO vo);
int removeProgram(final ProgramMngVO vo);
/**
* <pre> : </pre>
@ -77,6 +68,6 @@ public interface ProgramMngService {
* @author:
* @date: 2020. 3. 27.
*/
public void removesProc(String progrmFileNms);
void removePrograms(final String progrmFileNms);
}

@ -8,121 +8,78 @@ import javax.annotation.Resource;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Service;
import kr.xit.framework.biz.cmm.model.ProgrmListVO;
import kr.xit.framework.biz.cmm.service.XitFrameCrudService;
import kr.xit.framework.biz.mng.mapper.ProgramMngMapper;
import kr.xit.framework.biz.mng.model.ProgramMngSearchVO;
import kr.xit.framework.biz.mng.model.ProgramMngVO;
import kr.xit.framework.biz.mng.service.ProgramMngService;
import kr.xit.framework.core.message.XitMessageSource;
import kr.xit.framework.core.constants.FrameworkConstants;
import kr.xit.framework.core.utils.XitCmmnUtil;
import kr.xit.framework.support.exception.BizRuntimeException;
import kr.xit.framework.support.util.constants.MessageKey;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Service
public class ProgramMngServiceImpl implements ProgramMngService {
@Resource
private ProgramMngMapper programMngMapper;
@Resource
private XitFrameCrudService xitFrameCrudService;
@Resource
private XitMessageSource xitMessageSource;
@Override
public List<ProgramMngVO> findList(Map<String, Object> paramMap, RowBounds rowBounds) {
return programMngMapper.findList(paramMap, rowBounds);
}
@Override
public int findListTotCnt(ProgramMngSearchVO searchVO) {
return programMngMapper.findListTotCnt(searchVO);
public List<ProgramMngVO> findPrograms(final Map<String, Object> paramMap, final RowBounds rowBounds) {
return programMngMapper.selectPrograms(paramMap, rowBounds);
}
@Override
public ProgramMngVO findView(ProgramMngVO vo) {
return programMngMapper.findView(vo);
public ProgramMngVO findProgram(final ProgramMngVO vo) {
return programMngMapper.selectProgram(vo);
}
@Override
public void addProc(ProgramMngVO vo) {
/**
*
*/
ProgrmListVO progrmListVO = convertToCrudVO(vo);
/**
*
*/
xitFrameCrudService.addXitProgrmList(progrmListVO);
public int addProgram(final ProgramMngVO vo) {
return programMngMapper.insertProgram(vo);
}
@Override
public void modifyProc(ProgramMngVO vo) {
/**
*
*/
ProgrmListVO progrmListVO = convertToCrudVO(vo);
public int modifyProgram(final ProgramMngVO vo) {
String table = "프로그램목록";
FrameworkConstants.DB_ACTION action = FrameworkConstants.DB_ACTION.U;
/**
*
*
*/
xitFrameCrudService.modifyXitProgrmList(progrmListVO);
String emsg = null;
if(XitCmmnUtil.isEmpty(vo.getProgrmFileNm()))
emsg = String.format("(%s)프로그램파일명(은)는 필수조건 입니다.", table);
if(emsg!=null){
log.error(emsg);
throw BizRuntimeException.createMessage(emsg);
}
int result = programMngMapper.updateProgram(vo);
if(result<1) throw BizRuntimeException.createMessage(String.format("%s 실패. 일치하는 자료가 없습니다.", action.getKorNm()));
return result;
}
@Override
public void removeProc(ProgramMngVO vo) {
/**
*
*/
ProgrmListVO progrmListVO = convertToCrudVO(vo);
/**
*
*/
xitFrameCrudService.removeXitProgrmList(progrmListVO);
public int removeProgram(final ProgramMngVO vo) {
return programMngMapper.deleteProgram(vo);
}
@Override
public void removesProc(String progrmFileNms) {
/**
*
*/
public void removePrograms(final String progrmFileNms) {
String[] delProgrmFileNm = progrmFileNms.split(",");
if (delProgrmFileNm == null || (delProgrmFileNm.length == 0)) {
throw new RuntimeException(xitMessageSource.getMessage("fail.common.delete"));
throw BizRuntimeException.create(MessageKey.CMM_UPDATE_FAIL);
}
/**
*
*/
String [] arrProgrmFileNm = progrmFileNms.split(",");
for (int i=0; i<arrProgrmFileNm.length ; i++){
ProgramMngVO vo = new ProgramMngVO();
vo.setProgrmFileNm(arrProgrmFileNm[i]);
this.removeProc(vo);
}
//this.removeProc(vo);
}
/**
* <pre> : VO CRUD Service VO .</pre>
* @return XitProgrmListVO
* @author:
* @date: 2020. 3. 27.
*/
private ProgrmListVO convertToCrudVO(ProgramMngVO vo) {
ProgrmListVO progrmListVO = new ProgrmListVO();
progrmListVO.setProgrm_file_nm (vo.getProgrmFileNm());
progrmListVO.setProgrm_stre_cours(vo.getProgrmStrePath());
progrmListVO.setProgrm_korean_nm (vo.getProgrmKoreanNm());
progrmListVO.setProgrm_dc (vo.getProgrmDc());
progrmListVO.setUrl (vo.getURL());
return progrmListVO;
}
}

@ -1,9 +1,7 @@
package kr.xit.framework.biz.mng.web;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
@ -25,8 +23,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.databind.JsonMappingException;
import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import kr.xit.framework.biz.mng.model.ProgramMngSearchVO;
import kr.xit.framework.biz.mng.model.ProgramMngVO;
@ -41,7 +37,6 @@ import kr.xit.framework.support.exception.BizRuntimeException;
import kr.xit.framework.support.mybatis.MybatisUtils;
import kr.xit.framework.support.util.AjaxMessageMapRenderer;
import kr.xit.framework.support.util.AjaxUtils;
import kr.xit.framework.support.util.constants.Globals;
import kr.xit.framework.support.util.constants.MessageKey;
/**
@ -124,11 +119,38 @@ public class ProgramMngController {
/*@PostMapping(value = "ProgramMng_list.ajax")*/
@RequestMapping(value = "/programList", method = {RequestMethod.GET, RequestMethod.POST})
public ModelAndView finds(@RequestParam Map<String,Object> paramMap) {
public ModelAndView findPrograms(@RequestParam final Map<String,Object> paramMap) {
return ResultResponse.of(programMngService.findList(paramMap, MybatisUtils.getPagingInfo(paramMap)));
return ResultResponse.of(programMngService.findPrograms(paramMap, MybatisUtils.getPagingInfo(paramMap)));
}
@PostMapping(value = "/updateProgram")
public ModelAndView modifyProgram(
@ModelAttribute("progrmMngVO") final ProgramMngVO vo
, @RequestParam(value="checkedProgrmFileNmForDel", required=false, defaultValue="") String checkedProgrmFileNmForDel
, final BindingResult bindingResult
) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
//유효성 확인
//2020.11.24. 주석처리
beanValidator.validate(vo, bindingResult);
// beanValidator.validate("progrmMngVO", vo, bindingResult);
if (bindingResult.hasErrors()) {
throw BizRuntimeException.create(MessageKey.CMM_UPDATE_FAIL);
}else {
if (vo.getProgrmDc() == null || vo.getProgrmDc().equals("")) {
vo.setProgrmDc(" ");
}
}
programMngService.modifyProgram(vo);
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS);
return mav;
}
/**
* <pre> : .</pre>
@ -140,7 +162,7 @@ public class ProgramMngController {
* @date: 2020. 3. 26.
*/
@RequestMapping(value = "/program_{cmd}", method={RequestMethod.GET, RequestMethod.POST})
public String ProgramMng_page(@PathVariable String cmd
public String ProgramMng_page(@PathVariable final String cmd
, @RequestParam(value="tilesDef", required=false, defaultValue="") String tilesDef
, @ModelAttribute("progrmMngVO") ProgramMngVO vo
, ModelMap model) {
@ -149,7 +171,7 @@ public class ProgramMngController {
break;
case "edit": //수정 페이지
case "view": //상세 페이지
ProgramMngVO programMngVO = programMngService.findView(vo);
ProgramMngVO programMngVO = programMngService.findProgram(vo);
model.addAttribute("progrmMngVO", programMngVO);
break;
default:
@ -196,14 +218,14 @@ public class ProgramMngController {
/*model.addAttribute("list_progrmmanage", xitProgramMngService.findList(searchVO));*/
model.addAttribute("searchVO", searchVO);
int totCnt = programMngService.findListTotCnt(searchVO);
paginationInfo.setTotalRecordCount(totCnt);
//int totCnt = programMngService.findListTotCnt(searchVO);
//paginationInfo.setTotalRecordCount(totCnt);
model.addAttribute("paginationInfo", paginationInfo);
break;
case "input" :
break;
case "edit" :
ProgramMngVO xitProgramMngVO = programMngService.findView(vo);
ProgramMngVO xitProgramMngVO = programMngService.findProgram(vo);
model.addAttribute("progrmMngVO", xitProgramMngVO);
break;
default:
@ -255,7 +277,7 @@ public class ProgramMngController {
vo.setProgrmDc(" ");
}
//처리
programMngService.addProc(vo);
programMngService.addProgram(vo);
message = xitMessageSource.getMessage("success.common.insert");
break;
@ -277,14 +299,14 @@ public class ProgramMngController {
vo.setProgrmDc(" ");
}
//처리
programMngService.modifyProc(vo);
programMngService.modifyProgram(vo);
message = xitMessageSource.getMessage("success.common.update");
break;
case "delete": //삭제
//처리
try {
programMngService.removeProc(vo);
programMngService.removeProgram(vo);
message = xitMessageSource.getMessage("success.common.delete");
break;
} catch (RuntimeException e) {
@ -296,17 +318,17 @@ public class ProgramMngController {
}
break;
case "deletes": //다건 삭제
//처리
try {
programMngService.removesProc(checkedProgrmFileNmForDel);
message = xitMessageSource.getMessage("success.common.delete");
} catch (RuntimeException e) {
message = e.getMessage();
} catch (Exception e) {
message = xitMessageSource.getMessage("fail.common.delete");
}
break;
// case "deletes": //다건 삭제
// //처리
// try {
// programMngService.removesProgram(checkedProgrmFileNmForDel);
// message = xitMessageSource.getMessage("success.common.delete");
// } catch (RuntimeException e) {
// message = e.getMessage();
// } catch (Exception e) {
// message = xitMessageSource.getMessage("fail.common.delete");
// }
// break;
default:
new RuntimeException("유효하지 않은 요청 입니다.");
@ -366,7 +388,7 @@ public class ProgramMngController {
}
}
//처리
programMngService.modifyProc(vo);
programMngService.modifyProgram(vo);
message = xitMessageSource.getMessage("success.common.update");
/**
@ -397,30 +419,5 @@ public class ProgramMngController {
}
@PostMapping(value = "/updateProgram")
public ModelAndView updateProgram(@ModelAttribute("progrmMngVO") ProgramMngVO vo
,@RequestParam(value="checkedProgrmFileNmForDel", required=false, defaultValue="") String checkedProgrmFileNmForDel
,BindingResult bindingResult
) {
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
//유효성 확인
//2020.11.24. 주석처리
beanValidator.validate(vo, bindingResult);
// beanValidator.validate("progrmMngVO", vo, bindingResult);
if (bindingResult.hasErrors()) {
throw BizRuntimeException.create(MessageKey.CMM_UPDATE_FAIL);
}else {
if (vo.getProgrmDc() == null || vo.getProgrmDc().equals("")) {
vo.setProgrmDc(" ");
}
}
throw BizRuntimeException.create(MessageKey.CMM_UPDATE_FAIL);
//처리
// programMngService.modifyProc(vo);
// AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS);
// return mav;
}
}

@ -11,6 +11,7 @@ public abstract class MessageKey {
public static final String CMM_FAIL = "fail.request.msg";//요청처리를 실패하였습니다..
public static final String CMM_UPDATE_FAIL = "fail.common.update";
public static final String CMM_REMOVE_FAIL = "fail.common.delete";
public static final String WARN_SESSION_END = "warn.session.end";//세션이 종료 되었습니다..
}

@ -3,9 +3,10 @@
<mapper namespace="kr.xit.framework.biz.mng.mapper.ProgramMngMapper">
<select id="findList" resultType="kr.xit.framework.biz.mng.model.ProgramMngVO">
/* program-mysql-mapper|findList-프로그램 목록 조회|julim */
<select id="selectPrograms" resultType="kr.xit.framework.biz.mng.model.ProgramMngVO">
/* program-mysql-mapper|selectPrograms-프로그램 목록 조회|julim */
SELECT progrm_file_nm
, progrm_stre_cours
, progrm_stre_cours AS progrmStrePath
, progrm_korean_nm
/*, CONCAT(SUBSTRING(progrm_dc, 10, 1),'...') AS progrmDc -->*/
@ -19,9 +20,10 @@
</where>
</select>
<select id="findView" resultType="kr.xit.framework.biz.mng.model.ProgramMngVO">
/* program-mysql-mapper|findView-프로그램 정보 조회|julim */
<select id="selectProgram" parameterType="kr.xit.framework.biz.mng.model.ProgramMngVO" resultType="kr.xit.framework.biz.mng.model.ProgramMngVO">
/* program-mysql-mapper|selectProgram-프로그램 정보 조회|julim */
SELECT progrm_file_nm
, progrm_stre_cours
, progrm_stre_cours AS progrmStrePath
, progrm_korean_nm
/*, CONCAT(SUBSTRING(progrm_dc, 10, 1),'...') AS progrmDc -->*/
@ -33,11 +35,39 @@
<delete id="deleteAllProgrm">
/** XitMenuListMngMapper.deleteAllProgrm */
/** 프로그램정보 전체데이터 삭제 */
<!-- DELETE FROM XIT_PROGRM_LIST WHERE PROGRM_FILE_NM &lt;&gt; 'dir' -->
<insert id="insertProgram" parameterType="kr.xit.framework.biz.mng.model.ProgramMngVO">
/* program-mysql-mapper|insertProgram-프로그램 등록|julim */
INSERT
INTO xit_progrm_list(
progrm_file_nm
, progrm_stre_cours
, progrm_korean_nm
, progrm_dc
, url
) VALUES (
#{progrm_file_nm}
, #{progrmStreCours}
, #{progrmKoreanNm}
, #{progrmDc}
, #{URL}
)
</insert>
<update id="updateProgram" parameterType="kr.xit.framework.biz.mng.model.ProgramMngVO">
/* program-mysql-mapper|updateProgram-프로그램 정보 변경|julim */
UPDATE xit_progrm_list
SET progrm_korean_nm = #{progrmKoreanNm}
, progrm_stre_cours = #{progrmStrePath}
, progrm_dc = #{progrmDc}
, url = #{URL}
WHERE progrm_file_nm = #{progrmFileNm}
</update>
<delete id="deleteProgram">
/** removeXitProgrmList */
/** 프로그램목록 삭제 */
DELETE FROM XIT_PROGRM_LIST
WHERE 1=1
AND PROGRM_FILE_NM = #{progrm_file_nm}
</delete>

@ -40,6 +40,7 @@
</tbody>
</table>
</div>
</form>
<!-- //검색 -->
<!-- 페이지 Open 방식에 따라 버튼 표출 분기(일반페이지 or 팝업페이지) -->
@ -48,15 +49,13 @@
</c:when>
<c:otherwise>
<div class="page_btn">
<span class="fll">
<span class="flr">
<a href="#" class="btn darkgray" id="btnRegist" title="등록">등록</a>
<a href="#" class="btn red" id="btnDelete" title="삭제">삭제</a>
</span>
</div>
<!-- //버튼 및 페이지정보 -->
</c:otherwise>
</c:choose>
</form>
<!-- 데이터 출력 -->
<div id="grid_t0"></div>

@ -60,7 +60,8 @@
</table>
<div class="popup_btn">
<span class="flr" colspan="4">
<a href="#LINK" class="btn blue" id="btnUpdate">수정</a>
<a href="#LINK" class="btn blue" id="btnUpdate">변경</a>
<a href="#LINK" class="btn red" id="btnDelete">삭제</a>
<a href="#" class="btn lightgray" id="btnClose">닫기</a>
</span>
</div>

Loading…
Cancel
Save