8fec057752
CI / build (push) Failing after 14m48s
- account_entry pending/notif_key 컬럼 추가(멱등 마이그레이션)
- CardNotificationParser: 카드사·금액·가맹점·승인/취소 파싱
- POST /entries/notification(미확인 지출 생성, 중복방지, 카드 자동매칭)
- POST /entries/{id}/confirm(확정), GET /entries/pending/count
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
89 lines
4.2 KiB
Java
89 lines
4.2 KiB
Java
package com.sb.web.account.mapper;
|
|
|
|
import com.sb.web.account.domain.AccountEntry;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* 가계부 매퍼. 모든 조회/수정은 member_id(소유자)로 격리한다.
|
|
*/
|
|
@Mapper
|
|
public interface AccountEntryMapper {
|
|
|
|
List<AccountEntry> findByMember(@Param("memberId") Long memberId,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month,
|
|
@Param("type") String type,
|
|
@Param("category") String category,
|
|
@Param("walletId") Long walletId,
|
|
@Param("keyword") String keyword,
|
|
@Param("tagId") Long tagId);
|
|
|
|
/** 특정 계좌(wallet)와 연관된 내역 (wallet_id 또는 to_wallet_id 가 해당 계좌) */
|
|
List<AccountEntry> findByWalletAndMember(@Param("memberId") Long memberId,
|
|
@Param("walletId") Long walletId);
|
|
|
|
AccountEntry findByIdAndMember(@Param("id") Long id, @Param("memberId") Long memberId);
|
|
|
|
/** 구분(type)별 합계 — {type, total} 행 반환 */
|
|
List<Map<String, Object>> sumByType(@Param("memberId") Long memberId,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month);
|
|
|
|
/** 카테고리별 지출 합계 — {category, total} 행 반환 (예산 대비용) */
|
|
List<Map<String, Object>> sumExpenseByCategory(@Param("memberId") Long memberId,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month);
|
|
|
|
/** 구분(type)별 분류 합계 — {category, total} 행 반환 (파이차트용) */
|
|
List<Map<String, Object>> sumByCategory(@Param("memberId") Long memberId,
|
|
@Param("type") String type,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month);
|
|
|
|
/** 월별 순현금흐름(수입−지출, 계좌 지정분) — {ym, net} 행 반환 (순자산 추이용) */
|
|
List<Map<String, Object>> monthlyWalletFlow(@Param("memberId") Long memberId);
|
|
|
|
/** 기간 버킷(일/주/월/년)별 수입·지출 — {bucket, income, expense} (이체 제외) */
|
|
List<Map<String, Object>> statsByPeriod(@Param("memberId") Long memberId,
|
|
@Param("unit") String unit,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month);
|
|
|
|
int insert(AccountEntry entry);
|
|
|
|
int update(AccountEntry entry);
|
|
|
|
int delete(@Param("id") Long id, @Param("memberId") Long memberId);
|
|
|
|
/* ----- 알림 자동인식(미확인) ----- */
|
|
/** 중복방지 키로 기존 알림 내역 조회 */
|
|
AccountEntry findByMemberAndNotifKey(@Param("memberId") Long memberId, @Param("notifKey") String notifKey);
|
|
|
|
/** 미확인(확인 필요) 내역 개수 */
|
|
int countPending(@Param("memberId") Long memberId);
|
|
|
|
/** 미확인 내역 확정 (pending=0, 분류/계좌 보정) */
|
|
int confirm(@Param("id") Long id, @Param("memberId") Long memberId,
|
|
@Param("category") String category, @Param("walletId") Long walletId);
|
|
|
|
/** 기존 내역의 (type별) 사용된 분류명 distinct (분류 불러오기용) */
|
|
List<String> findDistinctCategories(@Param("memberId") Long memberId, @Param("type") String type);
|
|
|
|
/** 분류 이름 변경 시 기존 내역 일괄 갱신 */
|
|
int renameCategory(@Param("memberId") Long memberId,
|
|
@Param("type") String type,
|
|
@Param("oldName") String oldName,
|
|
@Param("newName") String newName);
|
|
|
|
/* ----- 항목-태그 ----- */
|
|
int insertEntryTag(@Param("entryId") Long entryId, @Param("tagId") Long tagId);
|
|
|
|
int deleteEntryTagsByEntryId(@Param("entryId") Long entryId);
|
|
|
|
List<String> findTagNamesByEntryId(@Param("entryId") Long entryId);
|
|
}
|