build: 중간저장

thkim
thkim 2024-01-23 18:01:31 +09:00
parent e55d5081a3
commit 62163de6b1
3 changed files with 20 additions and 5 deletions

View File

@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.data.domain.Pageable;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
@ -41,12 +42,13 @@ public class PopUpApiController {
@GetMapping(value = "/contents/api/popup-manage/list")
public ResultVO contentsApiPopUpManageList(
@AuthenticationPrincipal LoginVO user,
HttpServletRequest request) throws Exception {
HttpServletRequest request,
Pageable pageable) throws Exception {
ResultVO resultVO = new ResultVO();
try {
resultVO = popUpApiService.contentsApiPopUpManageList(resultVO, request, user);
resultVO = popUpApiService.contentsApiPopUpManageList(resultVO, request, user, pageable);
} catch (Exception e) {
resultVO.setResultCode(ResponseCode.FAILED.getCode());
resultVO.setResultMessage(e.getMessage());

View File

@ -2,9 +2,10 @@ package com.dbnt.kcscbackend.admin.contents.popUp.service;
import com.dbnt.kcscbackend.auth.entity.LoginVO;
import com.dbnt.kcscbackend.config.common.ResultVO;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletRequest;
public interface PopUpApiService {
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user) throws Exception;
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception;
}

View File

@ -9,6 +9,9 @@ import com.dbnt.kcscbackend.config.common.ResponseCode;
import com.dbnt.kcscbackend.config.common.ResultVO;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
@ -28,7 +31,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
@Override
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user) throws Exception {
public ResultVO contentsApiPopUpManageList(ResultVO resultVO, HttpServletRequest request, LoginVO user, Pageable pageable) throws Exception {
System.out.println(
"\n--------------------------------------------------------------\n" +
@ -39,7 +42,15 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
"\n--------------------------------------------------------------\n"
);
List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(Sort.by(Sort.Direction.DESC, "popupSeq"))
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(pageable.getPageNumber());
paginationInfo.setRecordCountPerPage(pageable.getPageSize());
paginationInfo.setPageSize(5);//hard coded
paginationInfo.setTotalRecordCount(123);//hard coded
//List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(Sort.by(Sort.Direction.DESC, "popupSeq"))
List<Map<String, Object>> listPopup = tnPopupMngRepositoryWithoutPopupContents.findAll(pageable)
.stream()
.map(item -> {
Map<String, Object> codeMap = new HashMap<>();
@ -61,6 +72,7 @@ public class PopUpApiServiceImpl extends EgovAbstractServiceImpl implements PopU
Map<String, Object> dto = new HashMap<String, Object>();
dto.put("listPopup", listPopup);
dto.put("paginationInfo", paginationInfo);
resultVO.setResult(dto);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());