feat: 가계부·게시판 백엔드 API 구현

- com.sb.web 패키지로 재구성: account / auth / board / user / admin / common
- 가계부(account): 내역(필터), 계좌·순자산, 예산, 분류, 정기 거래, 투자 포트폴리오
  (종목·매매 이력, 이동평균 평단·실현/평가손익)
- MyBatis + MariaDB + Redis 세션, BCrypt
- 스키마 자동 초기화(db/*.sql, 멱등), 사용자별 데이터 격리(member_id)
- 문서: docs/BACKEND.md, .env.example

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-05-31 15:43:09 +09:00
co-authored by Claude Opus 4.8
parent 9243a41385
commit 2a2f81dc32
121 changed files with 5899 additions and 31 deletions
@@ -0,0 +1,77 @@
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);
/** 기존 내역의 (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);
}