Quellcode durchsuchen

공통코드 중복체크 로직 추가

gagamel vor 4 Jahren
Ursprung
Commit
547c613176

+ 1 - 1
src/main/java/com/style24/admin/biz/service/TsaSystemService.java

@@ -412,7 +412,7 @@ public class TsaSystemService {
 	 */
 	@Transactional("shopTxnManager")
 	public void saveCommonCode(CommonCode commoncode) {
-		if (systemDao.getCommonCodePrimaryKeyCount(commoncode) > 0) {
+		if (commoncode.getMode().equals("N") && systemDao.getCommonCodePrimaryKeyCount(commoncode) > 0) {
 			throw new IllegalStateException("이미 등록된 코드가 있습니다.(코드구분: " + commoncode.getCdGb() + ", 코드: " + commoncode.getCd() + ")");
 		}
 

+ 4 - 0
src/main/webapp/WEB-INF/views/system/CommoncodeForm.html

@@ -59,6 +59,8 @@
 						<h4>코드정보</h4>
 					</div>
 					<form id="detailForm" name="detailForm" action="#" th:action="@{'/system/commoncode/save'}">
+						<input type="hidden" name="mode" value="N"/>
+						
 						<table class="frmStyle" aria-describedby="등록/상세">
 							<colgroup>
 								<col style="width:30%;"/>
@@ -180,6 +182,7 @@
 	let fnBindDetail = function(rowData, flag) {
 		lvl = flag;
 		
+		$('#detailForm input[name=mode]').val('U');
 		$('#detailForm input[name=cdGb]').val(rowData.cdGb);
 		$('#detailForm input[name=cd]').val(rowData.cd);
 		$('#detailForm input[name=cdNm]').val(rowData.cdNm);
@@ -219,6 +222,7 @@
 	// 신규
 	$('#btnNew').on('click', function() {
 		$('#detailForm')[0].reset();
+		$('#detailForm input[name=mode]').val('N');
 		$('#detailForm input:checkbox[name=chkUseYn]').attr('checked', true);
 		$('#detailForm input:checkbox[name=chkUseYn]').attr('disabled', true);
 		$('#detailForm input[name=cdGb]').focus();