
--- src/main/java/kr/co/takensoft/ai/system/project/dto/ProjectDTO.java
+++ src/main/java/kr/co/takensoft/ai/system/project/dto/ProjectDTO.java
... | ... | @@ -25,6 +25,7 @@ |
25 | 25 |
private String projectGroupId; // 프로젝트 그룹 아이디 |
26 | 26 |
private String projectName; // 프로젝트 이름 |
27 | 27 |
private String isMain; // 대표 프로젝트 여부 ( N: 대표 아님, Y: 대표) |
28 |
+ private String isFavorite; // 즐겨찾기 설정 여부 (N: 즐겨찾기 아님, Y: 즐겨찾기) |
|
28 | 29 |
// private List<ProjectMemberDTO> projectMembers; // 프로젝트 참여자 정보 목록 |
29 | 30 |
// private ProjectCommentDTO projectComment; // 프로젝트 주석 정보 |
30 | 31 |
// private ProjectImageDTO projectImage; // 이미지 정보 |
... | ... | @@ -38,6 +39,7 @@ |
38 | 39 |
projectVO.getProjectGroupId(), |
39 | 40 |
projectVO.getProjectName(), |
40 | 41 |
projectVO.getIsMain(), |
42 |
+ projectVO.getIsFavorite(), |
|
41 | 43 |
projectVO.getCreatedAt(), |
42 | 44 |
projectVO.getUpdatedAt() |
43 | 45 |
); |
--- src/main/java/kr/co/takensoft/ai/system/project/dto/ProjectSearchReqDTO.java
+++ src/main/java/kr/co/takensoft/ai/system/project/dto/ProjectSearchReqDTO.java
... | ... | @@ -22,5 +22,6 @@ |
22 | 22 |
private String projectGroupId; // 프로젝트 그룹 아이디 |
23 | 23 |
private String projectName; // 프로젝트 이름 |
24 | 24 |
private String isMain; // 대표 프로젝트 여부('N' : 대표 아님, 'Y' : 대표) |
25 |
+ private String sortOption; // 정렬 옵션 ('LATEST' : 최근 수정 순, 'OLDEST' : 오래된 순(수정), 'NAME_ASC' : 이름순) |
|
25 | 26 |
|
26 | 27 |
} |
+++ src/main/java/kr/co/takensoft/ai/system/project/dto/UpdateProjectFavoriteDTO.java
... | ... | @@ -0,0 +1,23 @@ |
1 | +package kr.co.takensoft.ai.system.project.dto; | |
2 | + | |
3 | +import kr.co.takensoft.ai.system.common.dto.BaseParam; | |
4 | +import lombok.Getter; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.Setter; | |
7 | + | |
8 | +/** | |
9 | + * @author 박현정 | |
10 | + * @since 2025.08.06 | |
11 | + * @modification | |
12 | + * since | author | description | |
13 | + * 2025.08.06 | 박현정 | 최초 등록 | |
14 | + * | |
15 | + * 프로젝트 즐겨찾기 수정 관련 DTO | |
16 | + */ | |
17 | +@Setter | |
18 | +@Getter | |
19 | +@NoArgsConstructor | |
20 | +public class UpdateProjectFavoriteDTO extends BaseParam { | |
21 | + | |
22 | + private String isFavorite; // 즐겨찾기 설정(N: 해제, Y: 설정) | |
23 | +} |
--- src/main/java/kr/co/takensoft/ai/system/project/service/ProjectService.java
+++ src/main/java/kr/co/takensoft/ai/system/project/service/ProjectService.java
... | ... | @@ -1,11 +1,7 @@ |
1 | 1 |
package kr.co.takensoft.ai.system.project.service; |
2 | 2 |
|
3 | 3 |
import kr.co.takensoft.ai.system.common.dto.BaseParam; |
4 |
-import kr.co.takensoft.ai.system.project.dto.InsertProjectDTO; |
|
5 |
-import kr.co.takensoft.ai.system.project.dto.ProjectSearchReqDTO; |
|
6 |
-import kr.co.takensoft.ai.system.project.dto.UpdateProjectDTO; |
|
7 |
-import kr.co.takensoft.ai.system.project.dto.UpdateProjectNameDTO; |
|
8 |
-import kr.co.takensoft.ai.system.projectLog.dto.ProjectLogDTO; |
|
4 |
+import kr.co.takensoft.ai.system.project.dto.*; |
|
9 | 5 |
import org.springframework.transaction.annotation.Transactional; |
10 | 6 |
|
11 | 7 |
import java.util.HashMap; |
... | ... | @@ -120,4 +116,13 @@ |
120 | 116 |
* 프로젝트 로그 목록 조회 |
121 | 117 |
*/ |
122 | 118 |
HashMap<String, Object> findAllLogs(BaseParam request); |
119 |
+ |
|
120 |
+ /** |
|
121 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
122 |
+ * @param request - 즐겨찾기 설정 정보를 담은 DTO 객체 |
|
123 |
+ * @return 즐겨찾기 설정 성공 여부 |
|
124 |
+ * |
|
125 |
+ * 프로젝트 즐겨찾기 설정/해제 |
|
126 |
+ */ |
|
127 |
+ int updateProjectFavorite(String projectGroupId, UpdateProjectFavoriteDTO request); |
|
123 | 128 |
} |
--- src/main/java/kr/co/takensoft/ai/system/project/service/impl/ProjectServiceImpl.java
+++ src/main/java/kr/co/takensoft/ai/system/project/service/impl/ProjectServiceImpl.java
... | ... | @@ -55,6 +55,7 @@ |
55 | 55 |
* 프로젝트 등록 |
56 | 56 |
*/ |
57 | 57 |
@Override |
58 |
+ @Transactional |
|
58 | 59 |
public int saveProject(InsertProjectDTO request) { |
59 | 60 |
|
60 | 61 |
try { |
... | ... | @@ -340,4 +341,29 @@ |
340 | 341 |
result.put("editLogs", logDTOS); |
341 | 342 |
return result; // 프로젝트 로그 목록 조회 결과 응답 |
342 | 343 |
} |
344 |
+ |
|
345 |
+ /** |
|
346 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
347 |
+ * @param request - 즐겨찾기 설정 정보를 담은 DTO 객체 |
|
348 |
+ * @return 즐겨찾기 설정 성공 여부 |
|
349 |
+ * |
|
350 |
+ * 프로젝트 즐겨찾기 설정/해제 |
|
351 |
+ */ |
|
352 |
+ @Override |
|
353 |
+ @Transactional |
|
354 |
+ public int updateProjectFavorite(String projectGroupId, UpdateProjectFavoriteDTO request) { |
|
355 |
+ |
|
356 |
+ String memberId = request.getMemberId(); // 사용자 아이디 가져오기 |
|
357 |
+ projectGroupService.validateExistence(projectGroupId); // 프로젝트 그룹 존재 여부 검증 |
|
358 |
+ projectMemberService.validateProjectMember(projectGroupId, memberId); // 프로젝트 참여자 존재 여부 검증 |
|
359 |
+ |
|
360 |
+ String isFavorite = request.getIsFavorite(); // 즐겨찾기 설정 정보 가져오기 |
|
361 |
+ if (isFavorite.equals("Y")) { // 즐겨찾기 설정한 경우 |
|
362 |
+ return projectMemberService.setProjectFavorite(projectGroupId, memberId); |
|
363 |
+ } else if (isFavorite.equals("N")) { // 즐겨찾기 해제한 경우 |
|
364 |
+ return projectMemberService.unsetProjectFavorite(projectGroupId, memberId); |
|
365 |
+ } else { // 잘못된 값 예외 처리 |
|
366 |
+ throw new IllegalArgumentException("isFavorite 값은 'Y' 또는 'N' 이어야 합니다. 현재 값: " + isFavorite); |
|
367 |
+ } |
|
368 |
+ } |
|
343 | 369 |
} |
--- src/main/java/kr/co/takensoft/ai/system/project/vo/ProjectVO.java
+++ src/main/java/kr/co/takensoft/ai/system/project/vo/ProjectVO.java
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 |
private String projectGroupId; // 프로젝트 그룹 아이디 |
27 | 27 |
private String projectName; // 프로젝트 이름 |
28 | 28 |
private String isMain; // 대표 프로젝트 여부 ( N: 대표 아님, Y: 대표) |
29 |
+ private String isFavorite; // 즐겨찾기 설정 여부 (N: 즐겨찾기 아님, Y: 즐겨찾기) |
|
29 | 30 |
private String useAt; // 프로젝트 사용 여부 (N : 사용 안함, Y : 사용) |
30 | 31 |
private String imageId; // 프로젝트 이미지 아이디 |
31 | 32 |
private String commentId; // 프로젝트 주석 아이디 |
--- src/main/java/kr/co/takensoft/ai/system/project/web/ProjectController.java
+++ src/main/java/kr/co/takensoft/ai/system/project/web/ProjectController.java
... | ... | @@ -1,13 +1,8 @@ |
1 | 1 |
package kr.co.takensoft.ai.system.project.web; |
2 | 2 |
|
3 |
-import kr.co.takensoft.ai.system.auth.vo.MemberVO; |
|
4 | 3 |
import kr.co.takensoft.ai.system.common.dto.BaseParam; |
5 |
-import kr.co.takensoft.ai.system.project.dto.InsertProjectDTO; |
|
6 |
-import kr.co.takensoft.ai.system.project.dto.ProjectSearchReqDTO; |
|
7 |
-import kr.co.takensoft.ai.system.project.dto.UpdateProjectDTO; |
|
8 |
-import kr.co.takensoft.ai.system.project.dto.UpdateProjectNameDTO; |
|
4 |
+import kr.co.takensoft.ai.system.project.dto.*; |
|
9 | 5 |
import kr.co.takensoft.ai.system.project.service.ProjectService; |
10 |
-import kr.co.takensoft.ai.system.projectLog.service.ProjectLogService; |
|
11 | 6 |
import lombok.RequiredArgsConstructor; |
12 | 7 |
import org.springframework.http.HttpStatus; |
13 | 8 |
import org.springframework.http.ResponseEntity; |
... | ... | @@ -154,4 +149,19 @@ |
154 | 149 |
result.put("result", projectService.findAllLogs(request)); |
155 | 150 |
return new ResponseEntity<>(result, HttpStatus.OK); |
156 | 151 |
} |
152 |
+ |
|
153 |
+ /** |
|
154 |
+ * @param request - 사용자 아이디를 담은 DTO 객체 |
|
155 |
+ * @return ResponseEntity - 프로젝트 즐겨찾기 설정 결과를 포함하는 응답 |
|
156 |
+ * |
|
157 |
+ * 프로젝트 즐겨찾기 설정/해제 |
|
158 |
+ */ |
|
159 |
+ @PostMapping("/{projectGroupId}/updateProjectFavorite.json") |
|
160 |
+ public ResponseEntity<?> updateProjectFavorite( |
|
161 |
+ @PathVariable String projectGroupId, |
|
162 |
+ @RequestBody UpdateProjectFavoriteDTO request) { |
|
163 |
+ HashMap<String, Object> result = new HashMap<>(); |
|
164 |
+ result.put("result", projectService.updateProjectFavorite(projectGroupId, request)); |
|
165 |
+ return new ResponseEntity<>(result, HttpStatus.OK); |
|
166 |
+ } |
|
157 | 167 |
} |
--- src/main/java/kr/co/takensoft/ai/system/projectMember/dao/ProjectMemberDAO.java
+++ src/main/java/kr/co/takensoft/ai/system/projectMember/dao/ProjectMemberDAO.java
... | ... | @@ -51,4 +51,22 @@ |
51 | 51 |
* 프로젝트 대표자 여부 검증 |
52 | 52 |
*/ |
53 | 53 |
boolean existsByProjectGroupIdAndMemberIdAndIsOwner(String projectGroupId, String memberId); |
54 |
+ |
|
55 |
+ /** |
|
56 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
57 |
+ * @param memberId - 사용자 아이디 |
|
58 |
+ * @return int - 프로젝트 즐겨찾기 설정 성공 여부 |
|
59 |
+ * |
|
60 |
+ * 프로젝트 즐겨찾기 설정 |
|
61 |
+ */ |
|
62 |
+ int setProjectFavorite(String projectGroupId, String memberId); |
|
63 |
+ |
|
64 |
+ /** |
|
65 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
66 |
+ * @param memberId - 사용자 아이디 |
|
67 |
+ * @return int - 프로젝트 즐겨찾기 해제 성공 여부 |
|
68 |
+ * |
|
69 |
+ * 프로젝트 즐겨찾기 해제 |
|
70 |
+ */ |
|
71 |
+ int unsetProjectFavorite(String projectGroupId, String memberId); |
|
54 | 72 |
} |
--- src/main/java/kr/co/takensoft/ai/system/projectMember/service/ProjectMemberService.java
+++ src/main/java/kr/co/takensoft/ai/system/projectMember/service/ProjectMemberService.java
... | ... | @@ -48,4 +48,20 @@ |
48 | 48 |
* 프로젝트 대표자 여부 검증 |
49 | 49 |
*/ |
50 | 50 |
void validateProjectOwner(String projectGroupId, String memberId); |
51 |
+ |
|
52 |
+ /** |
|
53 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
54 |
+ * @param memberId - 사용자 아이디 |
|
55 |
+ * |
|
56 |
+ * 프로젝트 즐겨찾기 설정 |
|
57 |
+ */ |
|
58 |
+ int setProjectFavorite(String projectGroupId, String memberId); |
|
59 |
+ |
|
60 |
+ /** |
|
61 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
62 |
+ * @param memberId - 사용자 아이디 |
|
63 |
+ * |
|
64 |
+ * 프로젝트 즐겨찾기 해제 |
|
65 |
+ */ |
|
66 |
+ int unsetProjectFavorite(String projectGroupId, String memberId); |
|
51 | 67 |
} |
--- src/main/java/kr/co/takensoft/ai/system/projectMember/service/impl/ProjectMemberServiceImpl.java
+++ src/main/java/kr/co/takensoft/ai/system/projectMember/service/impl/ProjectMemberServiceImpl.java
... | ... | @@ -7,6 +7,7 @@ |
7 | 7 |
import lombok.RequiredArgsConstructor; |
8 | 8 |
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; |
9 | 9 |
import org.springframework.stereotype.Service; |
10 |
+import org.springframework.transaction.annotation.Transactional; |
|
10 | 11 |
|
11 | 12 |
import java.util.List; |
12 | 13 |
|
... | ... | @@ -84,4 +85,26 @@ |
84 | 85 |
throw new IllegalArgumentException("이 프로젝트의 대표자가 아닙니다."); |
85 | 86 |
} |
86 | 87 |
} |
88 |
+ |
|
89 |
+ /** |
|
90 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
91 |
+ * @param memberId - 사용자 아이디 |
|
92 |
+ * |
|
93 |
+ * 프로젝트 즐겨찾기 설정 |
|
94 |
+ */ |
|
95 |
+ @Override |
|
96 |
+ public int setProjectFavorite(String projectGroupId, String memberId) { |
|
97 |
+ return projectMemberDAO.setProjectFavorite(projectGroupId, memberId); |
|
98 |
+ } |
|
99 |
+ |
|
100 |
+ /** |
|
101 |
+ * @param projectGroupId - 프로젝트 그룹 아이디 |
|
102 |
+ * @param memberId - 사용자 아이디 |
|
103 |
+ * |
|
104 |
+ * 프로젝트 즐겨찾기 해제 |
|
105 |
+ */ |
|
106 |
+ @Override |
|
107 |
+ public int unsetProjectFavorite(String projectGroupId, String memberId) { |
|
108 |
+ return projectMemberDAO.unsetProjectFavorite(projectGroupId, memberId); |
|
109 |
+ } |
|
87 | 110 |
} |
--- src/main/java/kr/co/takensoft/ai/system/projectMember/vo/ProjectMemberVO.java
+++ src/main/java/kr/co/takensoft/ai/system/projectMember/vo/ProjectMemberVO.java
... | ... | @@ -22,6 +22,7 @@ |
22 | 22 |
private String memberId; // 참여자 아이디 |
23 | 23 |
private String memberName; // 참여자 이름 |
24 | 24 |
private String isOwner; // 프로젝트 대표자 여부 ( N: 대표자 아님, Y: 대표자) |
25 |
+ private String isFavorite; // 즐겨찾기 여부 (N: 즐겨찾기 아님, Y: 즐겨찾기) |
|
25 | 26 |
private String useAt; // 사용 여부 (N : 사용 안함, Y : 사용) |
26 | 27 |
private String createdAt; // 생성일자 |
27 | 28 |
private String updatedAt; // 수정일자 |
... | ... | @@ -31,6 +32,7 @@ |
31 | 32 |
this.projectMemberId = projectMemberId; |
32 | 33 |
this.projectGroupId = projectGroupId; |
33 | 34 |
this.memberId = memberId; |
35 |
+ this.isFavorite = "N"; |
|
34 | 36 |
this.isOwner = isOwner; |
35 | 37 |
this.useAt = "Y"; |
36 | 38 |
} |
--- src/main/resources/mybatis/mapper/project/project-SQL.xml
+++ src/main/resources/mybatis/mapper/project/project-SQL.xml
... | ... | @@ -12,6 +12,7 @@ |
12 | 12 |
<result property="projectGroupId" column="project_group_id" /> |
13 | 13 |
<result property="projectName" column="project_name" /> |
14 | 14 |
<result property="isMain" column="is_main" /> |
15 |
+ <result property="isFavorite" column="is_favorite"/> |
|
15 | 16 |
<result property="useAt" column="use_at" /> |
16 | 17 |
<result property="imageId" column="project_image_id"/> |
17 | 18 |
<result property="commentId" column="project_comment_id"/> |
... | ... | @@ -209,6 +210,7 @@ |
209 | 210 |
p.project_group_id, |
210 | 211 |
p.project_name, |
211 | 212 |
p.is_main, |
213 |
+ pm.is_favorite, |
|
212 | 214 |
p.created_at, |
213 | 215 |
p.updated_at |
214 | 216 |
FROM project p |
... | ... | @@ -226,6 +228,22 @@ |
226 | 228 |
</if> |
227 | 229 |
AND p.use_at = 'Y' |
228 | 230 |
</where> |
231 |
+ ORDER BY |
|
232 |
+ pm.is_favorite DESC, |
|
233 |
+ <choose> |
|
234 |
+ <when test='"LATEST".equals(sortOption)'> |
|
235 |
+ p.updated_at DESC |
|
236 |
+ </when> |
|
237 |
+ <when test='"OLDEST".equals(sortOption)'> |
|
238 |
+ p.updated_at ASC |
|
239 |
+ </when> |
|
240 |
+ <when test='"NAME_ASC".equals(sortOption)'> |
|
241 |
+ p.project_name ASC |
|
242 |
+ </when> |
|
243 |
+ <otherwise> |
|
244 |
+ p.updated_at DESC |
|
245 |
+ </otherwise> |
|
246 |
+ </choose> |
|
229 | 247 |
</select> |
230 | 248 |
|
231 | 249 |
|
--- src/main/resources/mybatis/mapper/projectMember/projectMember-SQL.xml
+++ src/main/resources/mybatis/mapper/projectMember/projectMember-SQL.xml
... | ... | @@ -13,6 +13,7 @@ |
13 | 13 |
<result property="memberId" column="member_id"/> |
14 | 14 |
<result property="memberName" column="member_name"/> |
15 | 15 |
<result property="isOwner" column="is_owner"/> |
16 |
+ <result property="isFavorite" column="is_favorite"/> |
|
16 | 17 |
<result property="useAt" column="use_at"/> |
17 | 18 |
<result property="createdAt" column="created_at"/> |
18 | 19 |
<result property="updatedAt" column="updated_at"/> |
... | ... | @@ -38,6 +39,7 @@ |
38 | 39 |
project_group_id, |
39 | 40 |
member_id, |
40 | 41 |
is_owner, |
42 |
+ is_favorite, |
|
41 | 43 |
use_at, |
42 | 44 |
created_at, |
43 | 45 |
updated_at |
... | ... | @@ -47,6 +49,7 @@ |
47 | 49 |
#{projectGroupId}, |
48 | 50 |
#{memberId}, |
49 | 51 |
#{isOwner}, |
52 |
+ #{isFavorite}, |
|
50 | 53 |
#{useAt}, |
51 | 54 |
CURRENT_TIMESTAMP, |
52 | 55 |
CURRENT_TIMESTAMP |
... | ... | @@ -108,4 +111,38 @@ |
108 | 111 |
AND m.use_at = 'Y' |
109 | 112 |
</select> |
110 | 113 |
|
114 |
+ <!-- |
|
115 |
+ 작 성 자 : 박현정 |
|
116 |
+ 작 성 일 : 2025.08.06 |
|
117 |
+ 내 용 : 프로젝트 즐겨찾기 설정 |
|
118 |
+ --> |
|
119 |
+ <update id="setProjectFavorite" parameterType="String"> |
|
120 |
+ UPDATE |
|
121 |
+ project_member |
|
122 |
+ <set> |
|
123 |
+ is_favorite = 'Y', |
|
124 |
+ updated_at = CURRENT_TIMESTAMP |
|
125 |
+ </set> |
|
126 |
+ WHERE project_group_id = #{projectGroupId} |
|
127 |
+ AND member_id = #{memberId} |
|
128 |
+ AND use_at = 'Y' |
|
129 |
+ </update> |
|
130 |
+ |
|
131 |
+ <!-- |
|
132 |
+ 작 성 자 : 박현정 |
|
133 |
+ 작 성 일 : 2025.08.06 |
|
134 |
+ 내 용 : 프로젝트 즐겨찾기 해제 |
|
135 |
+ --> |
|
136 |
+ <update id="unsetProjectFavorite" parameterType="String"> |
|
137 |
+ UPDATE |
|
138 |
+ project_member |
|
139 |
+ <set> |
|
140 |
+ is_favorite = 'N', |
|
141 |
+ updated_at = CURRENT_TIMESTAMP |
|
142 |
+ </set> |
|
143 |
+ WHERE project_group_id = #{projectGroupId} |
|
144 |
+ AND member_id = #{memberId} |
|
145 |
+ AND use_at = 'Y' |
|
146 |
+ </update> |
|
147 |
+ |
|
111 | 148 |
</mapper>(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?