Files
EmailBill/Repository/BudgetArchiveRepository.cs

38 lines
1.1 KiB
C#
Raw Normal View History

namespace Repository;
public interface IBudgetArchiveRepository : IBaseRepository<BudgetArchive>
{
Task<BudgetArchive?> GetArchiveAsync(int year, int month);
Task<List<BudgetArchive>> GetListAsync(int year, int month);
2026-01-15 20:00:41 +08:00
Task<List<BudgetArchive>> GetArchivesByYearAsync(int year);
}
public class BudgetArchiveRepository(
IFreeSql freeSql
) : BaseRepository<BudgetArchive>(freeSql), IBudgetArchiveRepository
{
public async Task<BudgetArchive?> GetArchiveAsync(int year, int month)
{
return await FreeSql.Select<BudgetArchive>()
.Where(a => a.Year == year &&
a.Month == month)
.ToOneAsync();
}
public async Task<List<BudgetArchive>> GetListAsync(int year, int month)
{
return await FreeSql.Select<BudgetArchive>()
.Where(a => a.Year == year && a.Month == month)
.ToListAsync();
}
2026-01-15 20:00:41 +08:00
public async Task<List<BudgetArchive>> GetArchivesByYearAsync(int year)
{
return await FreeSql.Select<BudgetArchive>()
.Where(a => a.Year == year)
.OrderBy(a => a.Month)
.ToListAsync();
}
}