Преглед на файлове

제휴채널코드 자동생성 기능 추가

gagamel преди 4 години
родител
ревизия
3cc31bba77
променени са 2 файла, в които са добавени 19 реда и са изтрити 6 реда
  1. 7 1
      src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml
  2. 12 5
      src/main/webapp/WEB-INF/views/business/AflinkForm.html

+ 7 - 1
src/main/java/com/style24/persistence/mybatis/shop/TsaBusiness.xml

@@ -975,7 +975,13 @@
 		     , UPD_DT
 		)
 		VALUES (
-		       #{afLinkCd}
+		        (CASE WHEN #{mode} = 'N' THEN
+		                  (SELECT CONCAT('AL',IFNULL(LPAD(SUBSTRING(MAX(AF_LINK_CD),3) + 1,3,'0'),'000'))
+		                   FROM   TB_AF_LINK Z)
+		              ELSE
+		                  #{afLinkCd}
+		         END
+		        )
 		     , #{afLinkNm}
 		     , #{afChannel}
 		     , #{feeRate}

+ 12 - 5
src/main/webapp/WEB-INF/views/business/AflinkForm.html

@@ -83,6 +83,8 @@
 					<!-- //버튼 배치 영역 -->
 					
 					<form id="detailForm" name="detailForm" action="#" th:action="@{'/business/aflink/save'}">
+						<input type="hidden" name="mode" value="N"/>
+						
 						<table class="frmStyle">
 							<colgroup>
 								<col style="width:30%"/>
@@ -91,7 +93,10 @@
 							<tr>
 								<th>제휴코드<i class="star"></i></th>
 								<td>
-									<input type="text" class="w100" name="afLinkCd" placeholder="" maxlength="5" required="required" data-valid-type="alphaNumeric" data-valid-name="제휴코드" onkeyup="$(this).val($(this).val().toUpperCase());"/>
+									<input type="text" class="w100" name="afLinkCd" placeholder="자동생성" maxlength="5" onkeyup="$(this).val($(this).val().toUpperCase());" readonly="readonly"/>
+									<span class="infoTxt cBlue">
+										<i class="fa fa-info-circle" aria-hidden="true"></i>AL+일련번호3자리로 자동생성
+									</span>
 								</td>
 							</tr>
 							<tr>
@@ -176,8 +181,9 @@
 		if (event.colDef.field != 'afLinkNm')
 			return;
 		
+		$('#detailForm input[name=mode]').val('U');
 		$('#detailForm input[name=afLinkCd]').val(event.data.afLinkCd);
-		$('#detailForm input[name=afLinkCd]').attr('readonly', true);
+// 		$('#detailForm input[name=afLinkCd]').attr('readonly', true);
 		$('#detailForm input[name=afLinkNm]').val(event.data.afLinkNm);
 		$('#detailForm select[name=afChannel]').val(event.data.afChannel);
 		$('#detailForm input[name=feeRate]').val(event.data.feeRate);
@@ -206,11 +212,12 @@
 	// 신규
 	$('#btnNew').on('click', function() {
 		$('#detailForm')[0].reset();
-		$('#detailForm input[name=afLinkCd]').attr('readonly', false);
-		$('#detailForm input[name=afLinkCd]').removeClass('formControl');
+		$('#detailForm input[name=mode]').val('N');
+// 		$('#detailForm input[name=afLinkCd]').attr('readonly', false);
+// 		$('#detailForm input[name=afLinkCd]').removeClass('formControl');
 		$('#detailForm input:checkbox[name=chkUseYn]').attr('disabled', true);
 		$('#detailForm input:checkbox[name=chkUseYn]').addClass('formControl');
-		$('#detailForm input[name=afLinkCd]').focus();
+		$('#detailForm input[name=afLinkNm]').focus();
 	});
 	
 	// 사용안함 버튼 클릭 시