게시판관리 - 게시유형, 고정여부 추가

This commit is contained in:
eastargh
2026-05-07 09:50:49 +09:00
parent 9a5d5e4815
commit 9d55db3281
7 changed files with 164 additions and 35 deletions
@@ -10,6 +10,9 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@Service
@Transactional(transactionManager = "transactionManagerForEMS")
public class PortalNoticeService extends AbstractEMSDataSerivce<PortalNotice, String, PortalNoticeRepository> {
@@ -19,6 +22,10 @@ public class PortalNoticeService extends AbstractEMSDataSerivce<PortalNotice, St
BooleanBuilder predicate = new BooleanBuilder();
if (StringUtils.isNotBlank(portalNoticeUISearch.getSearchNoticeType())) {
predicate.and(qPortalNotice.noticeType.eq(portalNoticeUISearch.getSearchNoticeType()));
}
if (StringUtils.isNotBlank(portalNoticeUISearch.getSearchUseYn())) {
predicate.and(qPortalNotice.useYn.eq(portalNoticeUISearch.getSearchUseYn()));
}
@@ -28,7 +35,12 @@ public class PortalNoticeService extends AbstractEMSDataSerivce<PortalNotice, St
.or(qPortalNotice.noticeDetail.containsIgnoreCase(portalNoticeUISearch.getSearchSubjectDetail())));
}
return repository.findAll(predicate, pageable);
//return repository.findAll(predicate, pageable);
Sort fixYnFirst = Sort.by(Sort.Direction.DESC, "fixYn");
Sort combinedSort = fixYnFirst.and(pageable.getSort());
Pageable fixedPageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), combinedSort);
return repository.findAll(predicate, fixedPageable);
}
}
@@ -5,6 +5,7 @@ import lombok.Data;
@Data
public class PortalNoticeUISearch {
private String searchNoticeType;
private String searchUseYn;
private String searchSubjectDetail;
@@ -1,6 +1,8 @@
package com.eactive.eai.rms.onl.apim.portalnotice;
import com.eactive.eai.rms.common.base.BaseAnnotationController;
import com.eactive.eai.rms.common.combo.ComboService;
import com.eactive.eai.rms.common.combo.ComboVo;
import com.eactive.eai.rms.common.login.SessionManager;
import com.eactive.eai.rms.common.vo.GridResponse;
import com.eactive.eai.rms.data.entity.onl.apim.portalnotice.PortalNoticeUISearch;
@@ -16,12 +18,16 @@ import org.springframework.web.bind.annotation.PostMapping;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequiredArgsConstructor
public class PortalNoticeManController extends BaseAnnotationController {
private final PortalNoticeManService portalNoticeManService;
private final ComboService comboService;
@GetMapping(value = "/onl/apim/portalnotice/portalNoticeMan.view")
public void view() {
@@ -40,6 +46,14 @@ public class PortalNoticeManController extends BaseAnnotationController {
Page<PortalNoticeUI> page = portalNoticeManService.selectList(pageable, portalNoticeUISearch);
return ResponseEntity.ok(new GridResponse<>(page));
}
@PostMapping(value = "/onl/apim/portalnotice/portalNoticeMan.json", params = "cmd=LIST_INIT_COMBO")
public ResponseEntity<Map<String, Object>> initCombo() {
List<ComboVo> noticeTypeList = comboService.getMonitoringCodeSortedBySeq("NOTICE_TYPE");
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("noticeTypeList", noticeTypeList);
return ResponseEntity.ok(resultMap);
}
@PostMapping(value = "/onl/apim/portalnotice/portalNoticeMan.json", params = "cmd=DETAIL")
public ResponseEntity<PortalNoticeUI> selectDetail(String id) {
@@ -93,8 +93,9 @@ public class PortalNoticeManService extends BaseService {
}
public void insert(PortalNoticeUI portalNoticeUI) throws IOException {
portalNoticeUI.setNoticeSubject(decodeString(portalNoticeUI.getNoticeSubject()));
portalNoticeUI.setNoticeDetail(decodeString(StringEscapeUtils.unescapeHtml(portalNoticeUI.getNoticeDetail())));
//portalNoticeUI.setNoticeSubject(decodeString(portalNoticeUI.getNoticeSubject()));
//portalNoticeUI.setNoticeDetail(decodeString(StringEscapeUtils.unescapeHtml(portalNoticeUI.getNoticeDetail())));
portalNoticeUI.setNoticeDetail(StringEscapeUtils.unescapeHtml(portalNoticeUI.getNoticeDetail()));
PortalNotice portalNotice = portalNoticeUIMapper.toEntity(portalNoticeUI);
portalNotice.setId(null);
@@ -123,8 +124,9 @@ public class PortalNoticeManService extends BaseService {
}
public void update(PortalNoticeUI portalNoticeUI) throws IOException {
portalNoticeUI.setNoticeSubject(decodeString(portalNoticeUI.getNoticeSubject()));
portalNoticeUI.setNoticeDetail(decodeString(StringEscapeUtils.unescapeHtml(portalNoticeUI.getNoticeDetail())));
//portalNoticeUI.setNoticeSubject(decodeString(portalNoticeUI.getNoticeSubject()));
//portalNoticeUI.setNoticeDetail(decodeString(StringEscapeUtils.unescapeHtml(portalNoticeUI.getNoticeDetail())));
portalNoticeUI.setNoticeDetail(StringEscapeUtils.unescapeHtml(portalNoticeUI.getNoticeDetail()));
PortalNotice portalNotice = portalNoticeService.getById(portalNoticeUI.getId());
@@ -32,6 +32,11 @@ public class PortalNoticeUI {
private String useYn;
private String inquirerName;
private String fixYn;
private String noticeType;
private String createdBy;