- budget 테이블에 year/month 추가, (member,category)→(member,category,year,month) 유니크 교체 기존 상시 예산은 현재 월로 1회 이관 - 예산 조회/생성/현황/기간차트를 월별로(findByMember에 year/month) - copyMonth: 다른 월 예산을 대상 월로 복사(같은 분류 덮어씀) + POST /budgets/copy - 백업 복구 시 예산은 현재 월로 등록 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
1.6 KiB
Java
45 lines
1.6 KiB
Java
package com.sb.web.account.mapper;
|
|
|
|
import com.sb.web.account.domain.Budget;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 예산 매퍼. 모든 동작은 member_id(소유자)로 격리.
|
|
*/
|
|
@Mapper
|
|
public interface BudgetMapper {
|
|
|
|
List<Budget> findByMember(@Param("memberId") Long memberId,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month);
|
|
|
|
Budget findByIdAndMember(@Param("id") Long id, @Param("memberId") Long memberId);
|
|
|
|
int countByCategory(@Param("memberId") Long memberId,
|
|
@Param("category") String category,
|
|
@Param("excludeId") Long excludeId,
|
|
@Param("year") Integer year,
|
|
@Param("month") Integer month);
|
|
|
|
/** fromYear/fromMonth 예산을 toYear/toMonth 로 복사(같은 분류는 덮어씀). 복사된 건수 반환 */
|
|
int copyMonth(@Param("memberId") Long memberId,
|
|
@Param("fromYear") Integer fromYear,
|
|
@Param("fromMonth") Integer fromMonth,
|
|
@Param("toYear") Integer toYear,
|
|
@Param("toMonth") Integer toMonth);
|
|
|
|
int insert(Budget budget);
|
|
|
|
int update(Budget budget);
|
|
|
|
int delete(@Param("id") Long id, @Param("memberId") Long memberId);
|
|
|
|
/** 분류 이름 변경 시 예산 일괄 갱신 */
|
|
int renameCategory(@Param("memberId") Long memberId,
|
|
@Param("oldName") String oldName,
|
|
@Param("newName") String newName);
|
|
}
|