From 7fff6e8236c1656f6ae0a507ec16a636a6221de5 Mon Sep 17 00:00:00 2001 From: hjhan Date: Tue, 25 Aug 2026 11:07:26 +0800 Subject: [PATCH] =?UTF-8?q?fix(swap-eod):=20=E7=94=A8=20MarginModes.ForLin?= =?UTF-8?q?q=20=E6=9B=BF=E6=8D=A2=20EF=20LINQ=20=E4=B8=AD=E7=9A=84=20Margi?= =?UTF-8?q?nModes.Contains?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit swap_position 的 EF 查询在 Where 里使用 MarginModes.Contains(x.InterestMode), 该静态方法无法被 EF Core 翻译成 SQL,导致有数据时抛 Translation failed。 改用 MarginModes.ForLinq(List 形态)即可翻译为 IN (...)。 内存集合(details/interests 已 ToList)不受影响,无需改动。 --- YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs index d13a96ec..f9fb7204 100644 --- a/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs +++ b/YLErpDAL/Modules/SwapModule/SwapEodPositionService.cs @@ -3556,7 +3556,7 @@ namespace YLErp.Modules.SwapModule // 主查询分页后再取同交易、同估值日的全部辅助腿,避免利息/保证金归集跨估值日串数据。 var eodPositions = DbContext.eod_swap_position.Where(interestPredicate).ToList(); var marginPositions = DbContext.swap_position - .Where(x => tradeIds.Contains(x.SwapTradeId) && MarginModes.Contains(x.InterestMode) && x.IsInitial && !x.Invalid) + .Where(x => tradeIds.Contains(x.SwapTradeId) && MarginModes.ForLinq.Contains(x.InterestMode) && x.IsInitial && !x.Invalid) .ToList(); var tradeExtends = DbContext.trade_extend.Where(x => tradeIds.Contains(x.TradeId)).ToList(); Dictionary tradeDic = new Dictionary();