Files
sb-backend/src/main/java/com/sb/web/account/mapper/InvestMapper.java
T
ByungCheol 2a2f81dc32 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>
2026-05-31 15:43:09 +09:00

45 lines
1.6 KiB
Java

package com.sb.web.account.mapper;
import com.sb.web.account.domain.InvestHolding;
import com.sb.web.account.domain.InvestTrade;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 투자 보유종목/매매이력 매퍼. 모든 조회/수정은 member_id(소유자)로 격리한다.
*/
@Mapper
public interface InvestMapper {
/* ===== 보유 종목 ===== */
List<InvestHolding> findHoldingsByMember(@Param("memberId") Long memberId);
List<InvestHolding> findHoldingsByWallet(@Param("memberId") Long memberId,
@Param("walletId") Long walletId);
InvestHolding findHoldingByIdAndMember(@Param("id") Long id, @Param("memberId") Long memberId);
int insertHolding(InvestHolding holding);
int updateHolding(InvestHolding holding);
int deleteHolding(@Param("id") Long id, @Param("memberId") Long memberId);
/* ===== 매매 이력 ===== */
/** 회원의 전체 매매(집계용) — 종목·거래일·id 순 */
List<InvestTrade> findTradesByMember(@Param("memberId") Long memberId);
List<InvestTrade> findTradesByHolding(@Param("holdingId") Long holdingId,
@Param("memberId") Long memberId);
InvestTrade findTradeByIdAndMember(@Param("id") Long id, @Param("memberId") Long memberId);
int insertTrade(InvestTrade trade);
int deleteTrade(@Param("id") Long id, @Param("memberId") Long memberId);
int deleteTradesByHolding(@Param("holdingId") Long holdingId, @Param("memberId") Long memberId);
}