포탈 공지사항 삭제 기능 추가 / ADM -> APP
This commit is contained in:
+6
@@ -13,10 +13,16 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class PortalNoticeService extends AbstractEMSDataSerivce<PortalNotice, String, PortalNoticeRepository> {
|
||||
|
||||
public void deleteByIds(List<String> ids) {
|
||||
repository.deleteAllById(ids);
|
||||
}
|
||||
|
||||
public Page<PortalNotice> findAll(Pageable pageable, PortalNoticeUISearch portalNoticeUISearch) {
|
||||
QPortalNotice qPortalNotice = QPortalNotice.portalNotice;
|
||||
|
||||
|
||||
@@ -80,4 +80,10 @@ public class PortalNoticeManController extends BaseAnnotationController {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalnotice/portalNoticeMan.json", params = "cmd=DELETE_BULK")
|
||||
public ResponseEntity<String> deleteBulk(String ids) {
|
||||
portalNoticeManService.deleteBulk(ids);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@@ -147,4 +149,20 @@ public class PortalNoticeManService extends BaseService {
|
||||
portalNoticeService.deleteById(id);
|
||||
}
|
||||
|
||||
public void deleteBulk(String ids) {
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
|
||||
// 첨부파일 정리 (단건 삭제와 동일한 처리)
|
||||
idList.forEach(id -> {
|
||||
PortalNotice portalNotice = portalNoticeService.getById(id);
|
||||
Optional.ofNullable(portalNotice.getFileId()).ifPresent(fileService::deleteFile);
|
||||
});
|
||||
|
||||
portalNoticeService.deleteByIds(idList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user