重构存款预算
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 44s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 3s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
SunCheng
2026-01-20 19:11:05 +08:00
parent 44d9fbb0f6
commit 0ffeb41605
13 changed files with 1591 additions and 583 deletions

View File

@@ -28,10 +28,6 @@ public class BudgetRepository(IFreeSql freeSql) : BaseRepository<BudgetRecord>(f
{
query = query.Where(t => t.Type == TransactionType.Income);
}
else if (budget.Category == BudgetCategory.Savings)
{
query = query.Where(t => t.Type == TransactionType.None);
}
return await query.SumAsync(t => t.Amount);
}
@@ -41,8 +37,7 @@ public class BudgetRepository(IFreeSql freeSql) : BaseRepository<BudgetRecord>(f
var records = await FreeSql.Select<BudgetRecord>()
.Where(b => b.SelectedCategories.Contains(oldName) &&
((type == TransactionType.Expense && b.Category == BudgetCategory.Expense) ||
(type == TransactionType.Income && b.Category == BudgetCategory.Income) ||
(type == TransactionType.None && b.Category == BudgetCategory.Savings)))
(type == TransactionType.Income && b.Category == BudgetCategory.Income)))
.ToListAsync();
foreach (var record in records)