瀏覽代碼

Merge branch 'sowon' into develop

sowon4187 5 年之前
父節點
當前提交
2466920844

+ 9 - 0
src/main/java/com/style24/admin/biz/dao/TsaPollDao.java

@@ -44,6 +44,15 @@ public interface TsaPollDao {
 	 * @since 2021. 2. 19
 	 */
 	void createPollQuestion(Poll poll);
+	
+	/**
+	 * POLL 문항 삭제
+	 *
+	 * @param Poll 문항 정보
+	 * @author sowon
+	 * @since 2021. 5. 2
+	 */
+	void removeQuestion(Poll poll);
 
 	/**
 	 * POLL 목록

+ 13 - 3
src/main/java/com/style24/admin/biz/service/TsaPollService.java

@@ -58,9 +58,9 @@ public class TsaPollService {
 		int pollSq = params.iterator().next().getPollSq() == null ? pollInfo.getPollSqTemp() : params.iterator().next().getPollSq();
 
 		// POLL 문항
-		Poll deletePollQuestion = new Poll();
-		deletePollQuestion.setPollSq(pollSq);
-		pollDao.deletePollQuestion(deletePollQuestion);
+		//Poll deletePollQuestion = new Poll();
+		//deletePollQuestion.setPollSq(pollSq);  
+		//pollDao.deletePollQuestion(deletePollQuestion);
 
 		int dispOrd = 1;
 		
@@ -74,6 +74,16 @@ public class TsaPollService {
 		}
 	}
 	
+	/**
+	 * POLL 문항 삭제
+	 *
+	 * @param Poll 문항 정보
+	 * @author sowon
+	 * @since 2021. 5. 2
+	 */
+	public void removeQuestion(Poll poll) {
+		pollDao.removeQuestion(poll);
+	}
 
 	/**
 	 * POLL 목록

+ 17 - 0
src/main/java/com/style24/admin/biz/web/TsaMarketingController.java

@@ -2299,6 +2299,23 @@ public class TsaMarketingController extends TsaBaseController {
 		pollService.createPoll(params);
 		return super.ok(message.getMessage("SUCC_0001"));
 	}
+	
+	/**
+	 * POLL 단일문항 삭제
+	 *
+	 * @param POLL 목록
+	 * @return
+	 * @author sowon
+	 * @since 2021. 05. 02
+	 */
+	@PostMapping("/poll/question/remove")
+	@ResponseBody
+	public GagaMap removeQuestion(@RequestBody Poll poll) {
+		GagaMap result = new GagaMap();
+		pollService.removeQuestion(poll);
+		result.set("status", "200");
+		return result;
+	}
 
 	/**
 	 * POLL 목록

+ 30 - 2
src/main/java/com/style24/persistence/mybatis/shop/TsaPoll.xml

@@ -67,7 +67,8 @@
 	<insert id="createPollQuestion" parameterType="Poll">
 	/* TsaPoll.createPollQuestion */
 		INSERT INTO TB_POLL_QUESTION (
-		       		  	POLL_SQ
+		                POLL_QSQ
+		       		  ,	POLL_SQ
 		       		  , POLL_QTITLE
 		       		  , POLL_QTYPE
 		       		  , POLL_QVAL1
@@ -87,7 +88,8 @@
 		       		  , UPD_NO
 		       		  , UPD_DT
 		       ) VALUES (
-		            #{pollSq}
+		            #{pollQsq}
+		          , #{pollSq}
 		          , #{pollQtitle}
 		          , #{pollQtype}
 		          , #{pollQval1}
@@ -107,8 +109,33 @@
 		          , #{updNo}
 		          , now()
 		       )
+	   ON
+	      DUPLICATE KEY
+	   UPDATE
+		   POLL_QTITLE = #{pollQtitle} 
+		 , POLL_QTYPE  = #{pollQtype}  
+		 , POLL_QVAL1  = #{pollQval1}  
+		 , POLL_QVAL2  = #{pollQval2}  
+		 , POLL_QVAL3  = #{pollQval3}  
+		 , POLL_QVAL4  = #{pollQval4}  
+		 , POLL_QVAL5  = #{pollQval5}  
+		 , POLL_QVAL6  = #{pollQval6}  
+		 , POLL_QVAL7  = #{pollQval7}  
+		 , POLL_QVAL8  = #{pollQval8}  
+		 , POLL_QVAL9  = #{pollQval9}  
+		 , POLL_QVAL10 = #{pollQval10} 
+		 , DISP_ORD    = #{dispOrd}    
+		 , UPD_NO  = #{updNo}             
+		 , UPD_DT = now()                              
 	</insert>
 	
+	<!-- poll 단일 문항 삭제 -->
+	<update id="removeQuestion" parameterType="Poll">
+		UPDATE tb_poll_question 
+		SET DEL_YN = 'Y'
+		WHERE POLL_QSQ = #{pollQsq}
+	</update>
+	
 	<!-- POLL 목록 -->
 	<select id="getPollList" parameterType="Poll" resultType="Poll">
 		/* TsaPoll.getPollList */
@@ -166,6 +193,7 @@
 		                   LEFT JOIN TB_PLAN P ON A.POLL_SQ = P.POLL_SQ
 		  WHERE 1=1
 		     AND A.DEL_YN = 'N'
+		     AND B.DEL_YN = 'N'
 		   <if test="pollSq != null and pollSq != ''">
 		        AND    A.POLL_SQ = #{pollSq}
 			</if>

+ 7 - 1
src/main/webapp/WEB-INF/views/marketing/PollListForm.html

@@ -525,14 +525,20 @@
 	}
 
 	// 문항삭제
+	// 알림문구 추가 해야하지 않을가..(문항삭제를 할 경우 즉시 삭제됩니다..?)
 	var fnDeleteQuestion = function() {
 		var tags = $('input[name=chkIdx]');
 
 		for (var idx = 0; idx < tags.length; idx++) {
 			var checkYn = tags[idx].checked;
-
+			var pollQsq = $(tags[idx]).closest('tr').find("input[name='pollQsq']").val(); 
 			if (checkYn) {
 				$(tags[idx]).closest('tr').remove();
+				data = {pollQsq : pollQsq};
+				var jsonData = JSON.stringify(data);
+				gagajf.ajaxJsonSubmit('/marketing/poll/question/remove', jsonData, function(result) {
+				});
+				
 			}
 		}
 	}