소스 검색

템플릿 이미지 변경

sowon4187 5 년 전
부모
커밋
3521831d5c

+ 7 - 2
src/main/java/com/style24/admin/biz/service/TsaPlanService.java

@@ -946,7 +946,7 @@ public class TsaPlanService {
 			planDao.createPlanContents(filePlan);
 			
 			// 기존  파일 삭제
-			/* planDao.deletePlanContentItem(param.getFilePlanContSq()); */
+			planDao.deletePlanContentItem(param.getFilePlanContSq()); 
 			
 			//파일아이템 등록
 			String[] fileItemVal = param.getMultiPlanFile();
@@ -971,7 +971,12 @@ public class TsaPlanService {
 					path.mkdir();
 				}
 				newFile.renameTo(uniqueFile);
-				filePlan.setItemVal("/planning/" + yearMonth + "/" + newFilename);
+				if (fileItemVal[j].contains("/planning")) {
+					filePlan.setItemVal(fileItemVal[j]);
+				}else {
+					filePlan.setItemVal("/planning/" + yearMonth + "/" + newFilename);
+				}
+				
 				filePlan.setLinkUrl(fileItemVal2[j]);
 				filePlan.setLinkOpenGb((fileItemVal3[j]));
 				planDao.createPlanContentsItem(filePlan);

+ 3 - 2
src/main/java/com/style24/persistence/mybatis/shop/TsaPlan.xml

@@ -1174,8 +1174,8 @@
 			  ,A.PLAN_SQ 
 		      ,A.TMPL_TYPE 
 		      ,A.TITLE 
-		      ,A.LINK_URL 
-		      ,A.LINK_OPEN_GB
+		      ,B.LINK_URL 
+		      ,B.LINK_OPEN_GB
 		      ,A.DISP_YN 
 		      ,A.DISP_ORD 
 		      ,A.REG_NO 
@@ -1183,6 +1183,7 @@
 		      ,B.PLAN_CONT_ITEM_SQ 
 		FROM TB_PLAN_CONTENTS A LEFT JOIN TB_PLAN_CONTENTS_ITEM B ON A.PLAN_CONT_SQ = B.PLAN_CONT_SQ
 		WHERE A.PLAN_SQ = #{planSq} AND A.TMPL_TYPE = #{tmplType}
+		ORDER BY B.PLAN_CONT_ITEM_SQ 
 	</select>
 	
 	<!-- 기획전 템플릿 이미지 파일 삭제 -->

+ 19 - 23
src/main/webapp/WEB-INF/views/marketing/PlanTemplatePopupForm.html

@@ -178,10 +178,10 @@
 												<div>
 													<div class="uFile w500">
 														<input type="file" th:id="${'file' + num}" th:name="${'file' + num}" class="uFileInput w500" accept="image/*"/> 
-														<label th:for="${'file' + num}" class="uFileLabel">파일선택</label>
+														<label th:for="${'file' + num}" class="uFileLabel" th:id="${'file_' + num}">파일선택</label>
 														<input type="hidden" name="fileItemVal"	th:id="${'fileItemVal' + num}" /> 
 														<input type="hidden" name="sysFileNms" th:id="${'sysFileNm' + num}" />
-														<input type="text" th:name="${'linkUrl' + num}" class="w300 aR">
+														<input type="text" th:name="${'linkUrl' + num}" th:id="${'linkUrl' + num}" class="w300 aR">
 													</div>
 													<br />
 													<table>
@@ -1146,25 +1146,7 @@
 			}
 		});
 	});
-	
-	// 첨부파일 삭제
- 	var fnDeleteFile = function(obj, noticeSq, seq, sysFileNm) {
-		mcxDialog.confirm('정말 삭제하시겠습니까?', {
-			cancelBtnText: "취소",
-			sureBtnText: "확인",
-			sureBtnClick: function(){
-				var params = new Object();
-				params.noticeSq = noticeSq;
-				params.seq = seq;
-				params.sysFileNm = sysFileNm;
-
-				var jsonData = JSON.stringify(params);
-				gagajf.ajaxJsonSubmit('/board/notice/file/delete', jsonData, function() {
-					$(obj).parent().remove();
-				});
-			}
-		});
-	}
+ 	
 	 
 	// 상품 구분 추가 버튼 추가 버튼 표시는 1~5까지 순서대로 표시
 	$('#btnAddGrid').on('click', function(){
@@ -2216,7 +2198,9 @@ $(document).ready(function() {
 				
 				if(fileList.length > 0 && fileList[0].fileItemVal != null)
 				{
-					for (var i = 0; i <fileList.length; i++) {
+					$("#planTemplateForm select[name=fileCnt]").val(fileList.length);
+					
+					 /* for (var i = 0; i <fileList.length; i++) {
 						var tag = '';
 						tag += '<span class="memAdd">';
 						tag += '	<a id="dnFile' + (i + 1) + '">' + fileList[i].fileItemVal + '</a>\n';
@@ -2224,7 +2208,19 @@ $(document).ready(function() {
 						tag += '</span>';
 						$('#registeredFile').prepend(tag);
 							
-					}
+					}  */
+					
+					for (var i = 0; i <fileList.length; i++) {
+						$("#planTemplateForm input[name=fileLinkUrl"+ (i+1) +"]").val(fileList[i].linkUrl);
+						$("#planTemplateForm label[id=file_"+ (i+1) +"]").html(fileList[i].fileItemVal);
+						$("#planTemplateForm input[id=fileItemVal"+ (i+1) +"]").val(fileList[i].fileItemVal);
+						if (fileList[i].linkOpenGb == "M") {
+							$('#planTemplateForm input:radio[name=fileLinkOpenGb'+(i+1)+']:radio[value="M"]').prop('checked', true);
+						}else if(fileList[i].linkOpenGb == "N"){
+							$('#planTemplateForm input:radio[name=fileLinkOpenGb'+(i+1)+']:radio[value="N"]').prop('checked', true);
+						}
+							
+					} 
 				}
 			}