tui grid 디자인 정리

중복키 발생 에러 관리
dev
박성영 5 months ago
parent 399bcf9630
commit 1665d704e2

@ -1,5 +1,6 @@
package go.kr.project.system.code.service.impl;
import egovframework.exception.MessageException;
import egovframework.util.SessionUtil;
import go.kr.project.system.code.mapper.CodeMapper;
import go.kr.project.system.code.model.*;
@ -7,6 +8,8 @@ import go.kr.project.system.code.service.CodeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import java.util.List;
@ -79,6 +82,7 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
*
* @param modifyData
* @return , ,
* @throws MessageException
*/
@Override
public int saveCodeDetails(CodeDetailModifiedDataVO modifyData) {
@ -102,7 +106,15 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
if (codeDetailVO.getUseYn() == null || codeDetailVO.getUseYn().isEmpty()) {
codeDetailVO.setUseYn("Y");
}
result += codeMapper.insertCodeDetail(codeDetailVO);
try {
// 코드 상세 등록 시도
result += codeMapper.insertCodeDetail(codeDetailVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 동일한 그룹코드ID와 코드ID 조합이 이미 존재하는 경우 중복 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("상세코드ID가 중복되었습니다");
}
}
}
@ -115,7 +127,15 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
if (codeDetailVO.getUseYn() == null || codeDetailVO.getUseYn().isEmpty()) {
codeDetailVO.setUseYn("Y");
}
result += codeMapper.updateCodeDetail(codeDetailVO);
try {
// 코드 상세 수정 시도
result += codeMapper.updateCodeDetail(codeDetailVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 수정 시 다른 코드와 ID가 중복되는 경우 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("상세코드ID가 중복되었습니다");
}
}
}
@ -127,6 +147,7 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
*
* @param modifyData
* @return , ,
* @throws MessageException
*/
@Override
public int saveCodeGroups(CodeGroupModifiedDataVO modifyData) {
@ -136,7 +157,15 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
List<CodeGroupVO> deletedRows = modifyData.getDeletedRows();
if (deletedRows != null && !deletedRows.isEmpty()) {
for (CodeGroupVO codeGroupVO : deletedRows) {
result += codeMapper.deleteCodeGroup(codeGroupVO);
try {
// 코드 그룹 삭제 시도
result += codeMapper.deleteCodeGroup(codeGroupVO);
} catch (DataIntegrityViolationException e) {
// 외래키 제약조건 위반 예외 처리
// 코드 그룹에 연결된 코드 상세가 있을 경우 삭제할 수 없음
log.error("외래키 제약조건 위반 에러 발생: {}", e.getMessage());
throw new MessageException("상세코드 데이터 삭제 후 그룹코드를 삭제하시기 바랍니다");
}
}
}
@ -149,7 +178,15 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
if (codeGroupVO.getUseYn() == null || codeGroupVO.getUseYn().isEmpty()) {
codeGroupVO.setUseYn("Y");
}
result += codeMapper.insertCodeGroup(codeGroupVO);
try {
// 코드 그룹 등록 시도
result += codeMapper.insertCodeGroup(codeGroupVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 동일한 그룹코드ID가 이미 존재하는 경우 중복 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("그룹코드ID가 중복되었습니다");
}
}
}
@ -165,7 +202,15 @@ public class CodeServiceImpl extends EgovAbstractServiceImpl implements CodeServ
if (codeGroupVO.getUseYn() == null || codeGroupVO.getUseYn().isEmpty()) {
codeGroupVO.setUseYn("Y");
}
result += codeMapper.updateCodeGroup(codeGroupVO);
try {
// 코드 그룹 수정 시도
result += codeMapper.updateCodeGroup(codeGroupVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 수정 시 다른 그룹코드와 ID가 중복되는 경우 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("그룹코드ID가 중복되었습니다");
}
}
}

@ -10,6 +10,8 @@ import go.kr.project.system.group.service.GroupService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import java.util.List;
@ -60,7 +62,7 @@ public class GroupServiceImpl extends EgovAbstractServiceImpl implements GroupSe
*
* @param modifyData
* @return , ,
* @throws RuntimeException ID
* @throws MessageException ID ,
*/
@Override
public int saveGroups(GroupModifiedDataVO modifyData) {
@ -91,11 +93,18 @@ public class GroupServiceImpl extends EgovAbstractServiceImpl implements GroupSe
throw new MessageException(errorMsg.toString());
}
// 그룹-역할 매핑 정보 삭제
groupMapper.deleteGroupRoles(groupVO.getGroupId());
// 그룹 정보 삭제
result += groupMapper.deleteGroup(groupVO.getGroupId());
try {
// 그룹-역할 매핑 정보 삭제
groupMapper.deleteGroupRoles(groupVO.getGroupId());
// 그룹 정보 삭제
result += groupMapper.deleteGroup(groupVO.getGroupId());
} catch (DataIntegrityViolationException e) {
// 외래키 제약조건 위반 예외 처리
// 그룹에 연결된 다른 데이터가 있을 경우 삭제할 수 없음
log.error("외래키 제약조건 위반 에러 발생: {}", e.getMessage());
throw new MessageException("연관된 데이터 삭제 후 그룹을 삭제하시기 바랍니다");
}
}
}
@ -114,7 +123,15 @@ public class GroupServiceImpl extends EgovAbstractServiceImpl implements GroupSe
if (groupVO.getUseYn() == null || groupVO.getUseYn().isEmpty()) {
groupVO.setUseYn("Y");
}
result += groupMapper.insertGroup(groupVO);
try {
// 그룹 등록 시도
result += groupMapper.insertGroup(groupVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 동일한 그룹 ID가 이미 존재하는 경우 중복 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("그룹 ID가 중복되었습니다");
}
}
}
@ -130,7 +147,15 @@ public class GroupServiceImpl extends EgovAbstractServiceImpl implements GroupSe
if (groupVO.getUseYn() == null || groupVO.getUseYn().isEmpty()) {
groupVO.setUseYn("Y");
}
result += groupMapper.updateGroup(groupVO);
try {
// 그룹 수정 시도
result += groupMapper.updateGroup(groupVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 수정 시 다른 그룹과 ID가 중복되는 경우 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("그룹 ID가 중복되었습니다");
}
}
}

@ -10,6 +10,8 @@ import go.kr.project.system.role.service.RoleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@ -72,7 +74,7 @@ public class RoleServiceImpl extends EgovAbstractServiceImpl implements RoleServ
*
* @param modifyData
* @return
* @throws RuntimeException ID
* @throws MessageException ID ,
*/
@Override
public int saveRoles(RoleModifiedDataVO modifyData) {
@ -128,9 +130,18 @@ public class RoleServiceImpl extends EgovAbstractServiceImpl implements RoleServ
throw new MessageException(errorMsg.toString());
}
roleMapper.deleteRoleMenus( roleVO.getRoleId() );
result += roleMapper.deleteRole(roleVO.getRoleId());
try {
// 역할-메뉴 매핑 정보 삭제
roleMapper.deleteRoleMenus(roleVO.getRoleId());
// 역할 정보 삭제
result += roleMapper.deleteRole(roleVO.getRoleId());
} catch (DataIntegrityViolationException e) {
// 외래키 제약조건 위반 예외 처리
// 역할에 연결된 다른 데이터가 있을 경우 삭제할 수 없음
log.error("외래키 제약조건 위반 에러 발생: {}", e.getMessage());
throw new MessageException("연관된 데이터 삭제 후 역할을 삭제하시기 바랍니다");
}
}
}
@ -148,7 +159,15 @@ public class RoleServiceImpl extends EgovAbstractServiceImpl implements RoleServ
if (roleVO.getUseYn() == null || roleVO.getUseYn().isEmpty()) {
roleVO.setUseYn("Y");
}
result += roleMapper.insertRole( roleVO );
try {
// 역할 등록 시도
result += roleMapper.insertRole(roleVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 동일한 역할 ID가 이미 존재하는 경우 중복 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("역할 ID가 중복되었습니다");
}
}
}
@ -164,7 +183,15 @@ public class RoleServiceImpl extends EgovAbstractServiceImpl implements RoleServ
if (roleVO.getUseYn() == null || roleVO.getUseYn().isEmpty()) {
roleVO.setUseYn("Y");
}
result += roleMapper.updateRole( roleVO );
try {
// 역할 수정 시도
result += roleMapper.updateRole(roleVO);
} catch (DuplicateKeyException e) {
// 중복 에러 처리
// 수정 시 다른 역할과 ID가 중복되는 경우 에러 발생
log.error("중복 에러 발생: {}", e.getMessage());
throw new MessageException("역할 ID가 중복되었습니다");
}
}
}

@ -121,19 +121,18 @@
{
header: '제목',
name: 'title',
width: 400,
align: 'left'
},
{
header: '작성자',
name: 'writerNm',
width: 100,
width: 120,
align: 'center'
},
{
header: '답변상태',
name: 'answerStatusCd',
width: 100,
width: 120,
align: 'center',
formatter: function(props) {
var status = props.value;
@ -149,13 +148,13 @@
{
header: '조회수',
name: 'viewCnt',
width: 80,
width: 120,
align: 'center'
},
{
header: '첨부파일',
name: 'fileCount',
width: 80,
width: 120,
align: 'center'
},
{

@ -184,7 +184,7 @@
{
header: '코드그룹ID',
name: 'cdGroupId',
width: 150,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -192,7 +192,7 @@
{
header: '코드그룹명',
name: 'cdGroupNm',
width: 200,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -200,7 +200,6 @@
{
header: '코드그룹설명',
name: 'cdGroupDc',
width: 300,
sortable: false,
align: 'left',
editor: 'text'
@ -208,7 +207,7 @@
{
header: '사용여부',
name: 'useYn',
width: 80,
width: 120,
align: 'center',
editor: {
type: 'select',
@ -537,7 +536,7 @@
{
header: '코드ID',
name: 'cdId',
width: 150,
width: 200,
sortable: true,
align: 'left',
editor: 'text'
@ -545,7 +544,7 @@
{
header: '코드명',
name: 'cdNm',
width: 200,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -553,7 +552,7 @@
{
header: '코드설명',
name: 'cdDc',
width: 300,
width: 350,
sortable: false,
align: 'left',
editor: 'text'
@ -561,7 +560,7 @@
{
header: '정렬순서',
name: 'sortOrdr',
width: 80,
width: 120,
sortable: true,
align: 'center',
editor: 'text'
@ -569,7 +568,7 @@
{
header: '사용여부',
name: 'useYn',
width: 80,
width: 120,
align: 'center',
editor: {
type: 'select',

@ -131,7 +131,7 @@
{
header: '그룹 ID',
name: 'groupId',
width: 200,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -139,7 +139,7 @@
{
header: '그룹명',
name: 'groupNm',
width: 220,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -147,7 +147,6 @@
{
header: '그룹 설명',
name: 'groupDc',
width: 300,
sortable: false,
align: 'left',
editor: 'text'
@ -155,7 +154,7 @@
{
header: '정렬 순서',
name: 'sortOrdr',
width: 100,
width: 120,
sortable: true,
align: 'center',
editor: {
@ -168,7 +167,7 @@
{
header: '사용여부',
name: 'useYn',
width: 80,
width: 120,
align: 'center',
editor: {
type: 'select',

@ -273,7 +273,7 @@
{
header: '로그 ID',
name: 'logId',
width: 80,
width: 150,
align: 'center'
},
{
@ -311,13 +311,12 @@
{
header: '실패 사유',
name: 'failReason',
width: 150,
align: 'left'
},
{
header: '로그인 유형',
name: 'loginType',
width: 100,
width: 120,
align: 'center'
},
{

@ -127,7 +127,7 @@
{
header: '역할 ID',
name: 'roleId',
width: 200,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -135,7 +135,7 @@
{
header: '역할명',
name: 'roleNm',
width: 220,
width: 250,
sortable: true,
align: 'left',
editor: 'text'
@ -143,7 +143,6 @@
{
header: '역할 설명',
name: 'roleDc',
width: 300,
sortable: false,
align: 'left',
editor: 'text'
@ -151,7 +150,7 @@
{
header: '정렬 순서',
name: 'sortOrdr',
width: 100,
width: 120,
sortable: true,
align: 'center',
editor: {
@ -164,7 +163,7 @@
{
header: '사용여부',
name: 'useYn',
width: 80,
width: 120,
align: 'center',
editor: {
type: 'select',

@ -119,34 +119,33 @@
{
header: '사용자 ID',
name: 'userId',
width: 100,
width: 150,
sortable: true,
align: 'center'
},
{
header: '사용자 계정',
name: 'userAcnt',
width: 100,
width: 150,
sortable: true,
align: 'left'
},
{
header: '사용자명',
name: 'userNm',
width: 100,
sortable: true,
align: 'left'
},
{
header: '조직명',
name: 'orgCdNm',
width: 100,
width: 150,
align: 'left'
},
{
header: '소속기관명',
name: 'sttCdName',
width: 100,
width: 150,
align: 'left'
},
{
@ -158,19 +157,19 @@
{
header: '잠금여부',
name: 'lockYn',
width: 80,
width: 120,
align: 'center'
},
{
header: '잠금횟수',
name: 'lockCnt',
width: 80,
width: 120,
align: 'center'
},
{
header: '잠금해제',
name: 'unlockBtn',
width: 80,
width: 120,
align: 'center',
formatter: function(value) {
// 잠금 상태인 경우에만 버튼 표시
@ -184,19 +183,13 @@
{
header: '상태명',
name: 'userStatusNm',
width: 80,
align: 'center'
},
{
header: '부서명',
name: 'deptCdNm',
width: 100,
width: 120,
align: 'center'
},
{
header: '사용여부',
name: 'useYn',
width: 80,
width: 120,
align: 'center'
}
]);

@ -174,13 +174,13 @@
{
header: '엑셀 샘플 ID',
name: 'excelSampleId',
width: 100,
width: 150,
align: 'center'
},
{
header: '컬럼1',
name: 'excelClmn1',
width: 100,
width: 150,
align: 'center'
},
{

@ -139,37 +139,36 @@
{
header: '게시물 ID',
name: 'noticeId',
width: 100,
width: 150,
align: 'center'
},
{
header: '제목',
name: 'title',
width: 300,
align: 'left'
},
{
header: '작성자',
name: 'writerNm',
width: 100,
width: 120,
align: 'center'
},
{
header: '조회수',
name: 'viewCnt',
width: 80,
width: 120,
align: 'center'
},
{
header: '상단고정',
name: 'noticeYn',
width: 80,
width: 120,
align: 'center'
},
{
header: '사용여부',
name: 'useYn',
width: 80,
width: 120,
align: 'center'
},
{

Loading…
Cancel
Save