Browse Source

기획전 삭제

sowon4187 5 năm trước cách đây
mục cha
commit
08c1945941

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

@@ -55,4 +55,13 @@ public interface TsaPlanDao {
 	 * @since 2021. 2. 5
 	 */
 	int getPlanListCnt(Plan param);
+	
+	/**
+	 * 기획전 삭제
+	 *
+	 * @param 기획전 번호
+	 * @author rladbwnd5
+	 * @since 2021. 2. 8
+	 */
+	void deletePlan(Plan param);
 }

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

@@ -208,6 +208,20 @@ public class TsaPlanService {
 	public int getPlanListCnt(Plan param) {
 		return planDao.getPlanListCnt(param);
 	}
-
-
+	
+	/**
+	 * 기획전 삭제 처리
+	 *
+	 * @param
+	 * @return
+	 * @author rladbwnd5
+	 * @since 2021. 2. 5
+	 */
+	@Transactional("shopTxnManager")
+	public void deletePlan(Collection<Plan> paramList) {
+		for (Plan plan : paramList) {
+			plan.setUpdNo(TsaSession.getInfo().getUserNo());
+			planDao.deletePlan(plan);
+		}
+	}
 }

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

@@ -1346,6 +1346,11 @@ public class TsaMarketingController extends TsaBaseController {
 	@ResponseBody
 	public GagaMap getPlanList(@RequestBody Plan param) {
 		GagaMap result = new GagaMap();
+		
+		// multi row 검색관련 처리
+		if (!StringUtils.isBlank(param.getCondition())) {
+			param.setConditionList(param.getCondition().replaceAll("\r", "").split("\n"));
+		}
 		Collection<Plan> planList = planService.getPlanList(param);
 
 		param.setRegNo(TsaSession.getInfo().getUserNo()); // 엑셀조회시 로그인 사용자의 엑셀 상품조회시 사용
@@ -1358,5 +1363,20 @@ public class TsaMarketingController extends TsaBaseController {
 
 		return result;
 	}
+	
+	/**
+	 * 기획전관리 목록
+	 *
+	 * @param
+	 * @return 기획전 삭제
+	 * @author sowon
+	 * @since 2021. 2. 8
+	 */
+	@PostMapping("/planning/delete")
+	@ResponseBody
+	public GagaResponse deletePlan(@RequestBody Collection<Plan> paramList) {
+		planService.deletePlan(paramList);
+		return super.ok(message.getMessage("SUCC_0003"));
+	}
 
 }

+ 6 - 1
src/main/java/com/style24/persistence/domain/Plan.java

@@ -18,7 +18,7 @@ import lombok.Data;
 @Data
 public class Plan extends TscBaseDomain{
 	// 기획전
-		private long planSq;				//기획전일련번호(SeqPlan sequence)
+		private Integer planSq;				//기획전일련번호(SeqPlan sequence)
 		private String planNm;				//기획전명
 		private String planGb;				//기획전구분(P:기획전private String  E:이벤트)
 		private String custGb;				//고객구분
@@ -141,4 +141,9 @@ public class Plan extends TscBaseDomain{
 		private int pageNo = 1;
 		private int pageSize = 50;
 		private int pageUnit = 10;
+		
+		private String condition; // 키워드 종류
+		private String search; // 검색어
+		@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
+		private String[] conditionList;
 }

+ 46 - 10
src/main/java/com/style24/persistence/mybatis/shop/TsaPlan.xml

@@ -145,11 +145,25 @@
 		<if test ="siteCd != null and siteCd !=''">
 		AND    SITE_CD = #{siteCd}
 		</if>
-		<if test="planSq != null and planSq != ''">
-		AND    PLAN_SQ = #{planSq}
-		</if>
-		<if test="planNm != null and planNm != ''">
-		AND    PLAN_NM LIKE UPPER('%' || #{planNm} || '%')
+		<if test="condition != null and condition !=''">
+	        <if test="conditionList != null and conditionList.length>0">
+			<choose>
+			     <when test="search != null and search == 'searchPlanNm'">
+	 		AND (
+			         <foreach collection="conditionList" item="item" open="(" separator="," close=")">
+			           UPPER(PLAN_NM) LIKE CONCAT('%',UPPER(#{item}),'%') 
+			         </foreach>
+			     )
+			     </when>
+			     <when test="search != null and search == 'searchPlanSq'">
+	 		AND (		 
+			         <foreach collection="conditionList" item="item" open="(" separator="," close=")">
+		    		   UPPER(PLAN_SQ) LIKE CONCAT('%',UPPER(#{item}),'%') 
+			         </foreach>
+			    )
+			      </when>
+			</choose>
+			</if>
 		</if>
 		<if test="openYn != null and openYn != ''">
 		AND    OPEN_YN = #{openYn}
@@ -190,11 +204,23 @@
 		<if test ="siteCd != null and siteCd !=''">
 		AND    SITE_CD = #{siteCd}
 		</if>
-		<if test="planSq != null and planSq != ''">
-		AND    PLAN_SQ = #{planSq}
-		</if>
-		<if test="planNm != null and planNm != ''">
-		AND    PLAN_NM LIKE UPPER('%' || #{planNm} || '%')
+        <if test='condition != null and condition != "" '>
+		<choose>
+		     <when test='search != null and search == "searchPlanNm"'>
+ 		AND (
+		         <foreach collection="condition" item="item" index="index" separator="or">
+		           UPPER(PLAN_NM) LIKE CONCAT('%',UPPER(#{item}),'%') 
+		         </foreach>
+		     )
+		     </when>
+		     <when test='search != null and search == "searchPlanSq"'>
+ 		AND (		 
+		         <foreach collection="condition" item="item" index="index" separator="or">
+	    		   UPPER(PLAN_SQ) LIKE CONCAT('%',UPPER(#{item}),'%') 
+		         </foreach>
+		    )
+		      </when>
+		</choose>
 		</if>
 		<if test="openYn != null and openYn != ''">
 		AND    OPEN_YN = #{openYn}
@@ -225,6 +251,16 @@
 		</if>
 	</select>
 	
+	<!-- 기획전 삭제처리 -->
+	<update id="deletePlan" parameterType="Plan">
+		/* TsaPlan.deletePlan */
+		UPDATE TB_PLAN
+		SET    UPD_NO = #{updNo}
+		     , UPD_DT = now()
+		     , DEL_YN = 'Y'
+		WHERE  PLAN_SQ = #{planSq}
+	</update>
+	
 	
 	<!-- 기획전 전체 조회 -->
 	<select id="getPlanAllList" parameterType="Plan" resultType="Plan">

+ 38 - 10
src/main/webapp/WEB-INF/views/marketing/PlanListForm.html

@@ -43,14 +43,14 @@
 									</th:block>
 								</select>
 							</td>
-							<th>기획전명</th>
+							<!-- <th>기획전명</th>
 							<td>
 								<input type="text" name="planNm" id="planNm"/>
 							</td>
 							<th>기획전번호</th>
 							<td colspan="3">
 								<input type="text" name="planSq" id="planSq"/>
-							</td>
+							</td> -->
 							<th>오픈여부</th>
 							<td>
 								<select name="openYn">
@@ -58,7 +58,18 @@
 									<option th:if="${useYnList}" th:each="oneData, status : ${useYnList}" th:value="${oneData.cd}" th:text="|[${oneData.cd}] ${oneData.cdNm}|"></option>
 								</select>
 							</td>
-							
+							<th>등록자</th>
+							<td>
+								<input type="text" name="regId" id="regId"/>
+							</td>
+							<th rowspan="3">키워드</th>
+							<td rowspan="3">
+								<select name="search" id="search">
+									<option value="searchPlanNm">기획전명</option>
+									<option value="searchPlanSq">기획전번호</option>
+								</select> 
+								<textarea class="textareaR3 w70p" name="condition" id="condition"></textarea>
+							</td>
 						</tr>
 						<tr>
 							<th>PC/모바일구분</th>
@@ -79,22 +90,18 @@
 								</select>
 							</td>
 							<th>기획전템플릿유형</th>
-							<td colspan="3">
+							<td colspan="1">
 								<select name="templateType">
 									<option value="">전체</option>
 									<option value="H">HTML</option>
 									<option value="T">TEXT</option>
 								</select>
 							</td>
-							<th>등록자</th>
-							<td>
-								<input type="text" name="regId" id="regId"/>
-							</td>
 						</tr>
 
 						<tr>
 							<th>진행기간</th>
-							<td colspan="10" id="sellTerms"></td>
+							<td colspan="6" id="sellTerms"></td>
 						</tr>
 					</tbody>
 				</table>
@@ -261,7 +268,6 @@
 	// 조회클릭시
 	$('#btnSearch').on('click', function() {
 		$("#planListSearchForm input[name=pageNo]").val('1');
-		console.log("1");
 		fnPlanListSearch();
 	});
 
@@ -273,6 +279,28 @@
 		gagaPaging.init('planListSearchForm', fnSearchCallBack, 'planListPagination', $('#pageSize').val());
 		gagaPaging.load($("#planListSearchForm input[name=pageNo]").val());
 	}
+	
+	// 삭제클릭시
+	var fnSelectedDelete = function() {
+		var selectedData = gagaAgGrid.selectedRowData(gridOptions);
+
+		if (selectedData.length < 1) {
+			mcxDialog.alert('선택 된 기획전이 업습니다.');
+			return;
+		}
+
+		mcxDialog.confirm('선택된 기획전을 삭제하시겠습니까?',{
+			cancelBtnText: "취소",
+			sureBtnText: "확인",
+			sureBtnClick: function() {
+				var jsonData = JSON.stringify(selectedData);
+
+				gagajf.ajaxJsonSubmit('/marketing/planning/delete', jsonData, function() {
+					fnPlanListSearch();
+				});
+			}
+		});
+	}
 
 	//검색 조건 확인
 	var fnConditionCheck = function(){