-
Notifications
You must be signed in to change notification settings - Fork 2
[REFACTOR/#234] 예원 리팩토링 #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kimyw1018
wants to merge
2
commits into
main
Choose a base branch
from
refactor/#234-coco-refactoring-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,9 @@ | ||
| package com.assu.server.domain.admin.entity; | ||
|
|
||
|
|
||
| import com.assu.server.domain.member.entity.Member; | ||
| import com.assu.server.domain.user.entity.enums.Department; | ||
| import com.assu.server.domain.user.entity.enums.Major; | ||
| import com.assu.server.domain.member.entity.Member; | ||
| import com.assu.server.domain.user.entity.enums.University; | ||
|
|
||
| import jakarta.persistence.Entity; | ||
| import jakarta.persistence.EnumType; | ||
| import jakarta.persistence.Enumerated; | ||
| import jakarta.persistence.JoinColumn; | ||
| import jakarta.persistence.MapsId; | ||
| import jakarta.persistence.OneToOne; | ||
| import jakarta.persistence.Id; | ||
| import jakarta.persistence.*; | ||
| import jakarta.validation.constraints.NotNull; | ||
| import lombok.*; | ||
|
|
@@ -36,37 +27,58 @@ public class Admin { | |
| @OneToOne | ||
| @MapsId | ||
| @JoinColumn(name = "id") | ||
| @NotNull | ||
| private Member member; | ||
|
|
||
| @NotNull | ||
| @Column(nullable = false) | ||
| private String name; | ||
|
|
||
| @NotNull | ||
| @Column(nullable = false) | ||
| private String officeAddress; | ||
|
|
||
| private String detailAddress; | ||
|
|
||
| private String signUrl; | ||
|
|
||
| private Boolean isSignVerified; | ||
| @NotNull | ||
| @Builder.Default | ||
| @Column(nullable = false) | ||
| private Boolean isSignVerified = false; | ||
|
|
||
| private LocalDateTime signVerifiedAt; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @NotNull | ||
| @Column(nullable = false) | ||
| private Major major; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @NotNull | ||
| @Column(nullable = false) | ||
| private Department department; | ||
|
|
||
| @Enumerated(EnumType.STRING) | ||
| @NotNull | ||
| @Column(nullable = false) | ||
| private University university; | ||
|
|
||
| @JdbcTypeCode(SqlTypes.GEOMETRY) | ||
| private Point point; | ||
|
|
||
| private double latitude; | ||
| private double longitude; | ||
| @NotNull | ||
| @Column(nullable = false) | ||
| private Double latitude; | ||
|
|
||
| @NotNull | ||
| @Column(nullable = false) | ||
| private Double longitude; | ||
|
|
||
| public void setMember(Member member) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Setter가 생성해주는 메소드와 겹치니, 해당 메소드를 사용하는 상황에 맞추어서 메소드 명을 변경해주면 좋을 것 같습니다 |
||
| this.member = member; | ||
| if (member != null && member.getId() != null) { | ||
| this.id = member.getId(); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,15 +13,13 @@ | |
|
|
||
| public interface StudentAdminRepository extends JpaRepository<StudentAdmin, Long> { | ||
|
|
||
| // 총 누적 가입자 수 | ||
| @Query(""" | ||
| select count(sa) | ||
| from StudentAdmin sa | ||
| where sa.admin.id = :adminId | ||
| """) | ||
| Long countAllByAdminId(@Param("adminId") Long adminId); | ||
|
|
||
| // 기간별 가입자 수 | ||
| @Query(""" | ||
| select count(sa) | ||
| from StudentAdmin sa | ||
|
|
@@ -33,14 +31,12 @@ Long countByAdminIdBetween(@Param("adminId") Long adminId, | |
| @Param("from") LocalDateTime from, | ||
| @Param("to") LocalDateTime to); | ||
|
|
||
| // 이번 달 신규 가입자 수 | ||
| default Long countThisMonthByAdminId(Long adminId) { | ||
| LocalDateTime from = YearMonth.now().atDay(1).atStartOfDay(); | ||
| LocalDateTime to = LocalDateTime.now(); | ||
| return countByAdminIdBetween(adminId, from, to); | ||
| } | ||
|
|
||
| // 오늘 제휴 사용 고유 사용자 수 | ||
| @Query(value = """ | ||
| SELECT COUNT(DISTINCT pu.student_id) | ||
| FROM partnership_usage pu | ||
|
|
@@ -69,7 +65,6 @@ SELECT COUNT(DISTINCT pu.student_id) | |
| """, nativeQuery = true) | ||
| List<StoreUsageWithPaper> findUsageByStoreWithPaper(@Param("adminId") Long adminId); | ||
|
|
||
| // 0건 포함 조회 (대시보드에서 모든 제휴 업체를 보여줘야 하는 경우) | ||
| @Query(value = """ | ||
| SELECT | ||
| p.id AS paperId, | ||
|
|
@@ -87,7 +82,7 @@ SELECT COUNT(DISTINCT pu.student_id) | |
| List<StoreUsageWithPaper> findUsageByStoreIncludingZero(@Param("adminId") Long adminId); | ||
|
|
||
| interface StoreUsageWithPaper { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 유지보수를 고려하여서 record 기반의 DTO로 리팩토링합시다 |
||
| Long getPaperId(); // 🆕 추가: Paper ID | ||
| Long getPaperId(); | ||
| Long getStoreId(); | ||
| String getStoreName(); | ||
| Long getUsageCount(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
src/main/java/com/assu/server/domain/partner/repository/PartnerRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 이미지로 입력받는거니까 signImageUrl로 명시해줍시다