Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -102,10 +102,15 @@ public class AuthController {
|
|||||||
return java.util.Map.of("points", pointService.getPoints(current.getId()));
|
return java.util.Map.of("points", pointService.getPoints(current.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 포인트 적립/차감 내역 (최신순) */
|
/** 포인트 적립/차감 내역 — year+month 지정 시 해당 월 전건, 미지정 시 최근 100건 */
|
||||||
@GetMapping("/point-history")
|
@GetMapping("/point-history")
|
||||||
public java.util.List<com.sb.web.point.PointHistoryResponse> pointHistory(
|
public java.util.List<com.sb.web.point.PointHistoryResponse> pointHistory(
|
||||||
|
@RequestParam(required = false) Integer year,
|
||||||
|
@RequestParam(required = false) Integer month,
|
||||||
@RequestAttribute(AuthInterceptor.CURRENT_MEMBER) SessionUser current) {
|
@RequestAttribute(AuthInterceptor.CURRENT_MEMBER) SessionUser current) {
|
||||||
|
if (year != null && month != null) {
|
||||||
|
return pointService.getHistory(current.getId(), year, month);
|
||||||
|
}
|
||||||
return pointService.getHistory(current.getId());
|
return pointService.getHistory(current.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,8 +167,13 @@ public class PointService {
|
|||||||
return p == null ? 0L : p;
|
return p == null ? 0L : p;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 최근 포인트 적립/차감 내역 (최신순) */
|
/** 최근 포인트 적립/차감 내역 (최신순, 최대 100건) */
|
||||||
public java.util.List<PointHistoryResponse> getHistory(Long memberId) {
|
public java.util.List<PointHistoryResponse> getHistory(Long memberId) {
|
||||||
return pointMapper.findHistory(memberId, 100);
|
return pointMapper.findHistory(memberId, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 특정 연월 포인트 적립/차감 내역 (최신순, 전건) */
|
||||||
|
public java.util.List<PointHistoryResponse> getHistory(Long memberId, int year, int month) {
|
||||||
|
return pointMapper.findHistoryByMonth(memberId, year, month);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,7 @@ public interface PointMapper {
|
|||||||
|
|
||||||
/** 최근 적립/차감 내역 (최신순, 최대 limit건) */
|
/** 최근 적립/차감 내역 (최신순, 최대 limit건) */
|
||||||
List<PointHistoryResponse> findHistory(@Param("memberId") Long memberId, @Param("limit") int limit);
|
List<PointHistoryResponse> findHistory(@Param("memberId") Long memberId, @Param("limit") int limit);
|
||||||
|
|
||||||
|
/** 특정 연월 적립/차감 내역 (최신순, 전건) */
|
||||||
|
List<PointHistoryResponse> findHistoryByMonth(@Param("memberId") Long memberId, @Param("year") int year, @Param("month") int month);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,4 +34,13 @@
|
|||||||
LIMIT #{limit}
|
LIMIT #{limit}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findHistoryByMonth" resultType="com.sb.web.point.PointHistoryResponse">
|
||||||
|
SELECT amount, reason, created_at
|
||||||
|
FROM point_history
|
||||||
|
WHERE member_id = #{memberId}
|
||||||
|
AND YEAR(created_at) = #{year}
|
||||||
|
AND MONTH(created_at) = #{month}
|
||||||
|
ORDER BY id DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user