Преглед изворни кода

공지사항 파일 목록 리스트 추가

dwkim пре 2 година
родитељ
комит
48e37491ee

+ 2 - 0
src/main/java/com/oqpo/api/entity/oper/NticeEntity.java

@@ -6,6 +6,7 @@ import lombok.Setter;
6 6
 import lombok.ToString;
7 7
 
8 8
 import java.io.Serializable;
9
+import java.util.List;
9 10
 
10 11
 @Getter
11 12
 @Setter
@@ -35,5 +36,6 @@ public class NticeEntity implements Serializable {
35 36
     private String supplyChk;
36 37
 
37 38
     private NticeTargetEntity nticeTargetEntity;
39
+    private List<FileEntity> fileEntity ;
38 40
 
39 41
 }

+ 18 - 2
src/main/java/com/oqpo/api/service/oper/NticeService.java

@@ -1,9 +1,11 @@
1 1
 package com.oqpo.api.service.oper;
2 2
 
3 3
 
4
+import com.oqpo.api.entity.oper.FileEntity;
4 5
 import com.oqpo.api.entity.oper.NticeEntity;
5 6
 import com.oqpo.api.entity.oper.NticeTargetEntity;
6 7
 import com.oqpo.api.exception.GlobalException;
8
+import com.oqpo.api.mapper.FileMapper;
7 9
 import com.oqpo.api.mapper.oper.NticeMapper;
8 10
 import com.oqpo.api.service.CommonService;
9 11
 import com.oqpo.api.web.dto.request.GridRequest;
@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
17 19
 import org.springframework.stereotype.Service;
18 20
 import org.springframework.transaction.annotation.Transactional;
19 21
 
22
+import java.util.ArrayList;
20 23
 import java.util.List;
21 24
 import java.util.stream.Collectors;
22 25
 
@@ -26,6 +29,10 @@ public class NticeService extends CommonService {
26 29
     @Autowired
27 30
     private NticeMapper nticeMapper;
28 31
 
32
+    @Autowired
33
+    private FileMapper fileMapper;
34
+
35
+
29 36
     /*
30 37
       공지 검색 리스트 조회
31 38
      */
@@ -113,10 +120,19 @@ public class NticeService extends CommonService {
113 120
     }
114 121
 
115 122
     /*
116
-   공지 정보 가져오기
123
+   공지 정보 가져오기  selectFileList
117 124
     */
118 125
     public NticeResponse selectNticeInfo(String nticeNo) throws Exception {
119
-        return NticeResponse.toDTO(nticeMapper.selectNticeInfo(nticeNo));
126
+        NticeEntity nticeEntity = nticeMapper.selectNticeInfo(nticeNo) ;
127
+        List<FileEntity> nFileList = null;
128
+
129
+        if (!"".equals(nticeEntity.getFileNo())) {
130
+            nFileList = fileMapper.selectFileList(nticeEntity.getFileNo()) ;
131
+        } else {
132
+            nFileList = new ArrayList<FileEntity>();
133
+        }
134
+
135
+        return NticeResponse.toDTO(nticeEntity, nFileList);
120 136
     }
121 137
 
122 138
     /*

+ 39 - 1
src/main/java/com/oqpo/api/web/dto/response/oper/ntice/NticeResponse.java

@@ -1,10 +1,15 @@
1 1
 package com.oqpo.api.web.dto.response.oper.ntice;
2 2
 
3 3
 import com.fasterxml.jackson.annotation.JsonInclude;
4
+import com.oqpo.api.entity.oper.FileEntity;
4 5
 import com.oqpo.api.entity.oper.NticeEntity;
6
+import com.oqpo.api.web.dto.response.session.SessionResponse;
5 7
 import io.swagger.annotations.ApiModelProperty;
6 8
 import lombok.*;
7 9
 
10
+import java.util.List;
11
+import java.util.stream.Collectors;
12
+
8 13
 @Getter
9 14
 @Setter
10 15
 @Builder
@@ -63,7 +68,10 @@ public class NticeResponse {
63 68
     @ApiModelProperty(value = "공급사대상여부")
64 69
     private String supplyChk;
65 70
 
66
-    public static NticeResponse toDTO(NticeEntity entity) {
71
+    @ApiModelProperty(value = "파일번호")
72
+    private List<FileInfo> fileNoList;
73
+
74
+    public static NticeResponse toDTO(NticeEntity entity, List<FileEntity> fileInfoList) {
67 75
         if (entity == null) return null;
68 76
         return NticeResponse.builder()
69 77
                 .nticeNo(entity.getNticeNo())
@@ -79,10 +87,40 @@ public class NticeResponse {
79 87
                 .notiStDay(entity.getNotiStDay())
80 88
                 .notiEdDay(entity.getNotiEdDay())
81 89
                 .fileNo(entity.getFileNo() == null ? "" : entity.getFileNo())
90
+                .fileNoList(fileInfoList.stream()
91
+                        .map(m -> FileInfo.builder()
92
+                                .fileNo(m.getFileNo())
93
+                                .fileSeq(m.getFileSeq())
94
+                                .filePath(m.getFilePath())
95
+                                .fileNm(m.getFileNm())
96
+                                .fileOrgNm(m.getFileOrgNm())
97
+                                .build())
98
+                        .collect(Collectors.toList()))
82 99
                 .viewCnt(entity.getViewCnt())
83 100
                 .brandChk(entity.getBrandChk() == null ? "N" : entity.getBrandChk())
84 101
                 .shopChk(entity.getShopChk() == null ? "N" : entity.getShopChk())
85 102
                 .supplyChk(entity.getSupplyChk() == null ? "N" : entity.getSupplyChk())
86 103
                 .build();
87 104
     }
105
+
106
+    @Getter
107
+    @Builder
108
+    @AllArgsConstructor(access = AccessLevel.PROTECTED)
109
+    static class FileInfo {
110
+        @ApiModelProperty(value = "파일번호")
111
+        private String fileNo;
112
+
113
+        @ApiModelProperty(value = "파일순번")
114
+        private Integer fileSeq;
115
+
116
+        @ApiModelProperty(value = "파일경로")
117
+        private String filePath;
118
+
119
+        @ApiModelProperty(value = "파일명")
120
+        private String fileNm;
121
+
122
+        @ApiModelProperty(value = "원파일명")
123
+        private String fileOrgNm;
124
+    }
88 125
 }
126
+