백테스팅 목록 아이템 삭제 기능추가

This commit is contained in:
Macbook
2026-06-12 00:43:07 +09:00
parent 423c60183e
commit 0d338fffe4
9 changed files with 244 additions and 34 deletions
@@ -173,6 +173,21 @@ public class PaperTradingService {
return listTrades(userId, null, null, null, null, null, 0, 100).getContent();
}
/** 체결 이력 일괄 삭제 (분석 목록에서 그룹 제거용) */
@Transactional
public int deleteTradesBatch(Long userId, List<Long> ids) {
if (ids == null || ids.isEmpty()) return 0;
long uid = TradingAccess.requireUserId(userId);
GcAppSettings app = appSettingsService.getEntity(uid, null);
GcPaperAccount account = getOrCreateAccount(uid, app);
List<Long> distinct = ids.stream().filter(id -> id != null && id > 0).distinct().toList();
if (distinct.isEmpty()) return 0;
List<GcPaperTrade> owned = tradeRepo.findByAccountIdAndIdIn(account.getId(), distinct);
if (owned.isEmpty()) return 0;
tradeRepo.deleteAll(owned);
return owned.size();
}
@Transactional(readOnly = true)
public PaperPageDto<PaperLedgerEntryDto> listLedger(Long userId,
LocalDateTime from, LocalDateTime to,