添加智能分类功能,支持获取未分类账单数量和列表;实现AI分类逻辑;更新相关API和前端视图
This commit is contained in:
@@ -60,6 +60,19 @@ public interface ITransactionRecordRepository : IBaseRepository<TransactionRecor
|
||||
/// <param name="emailMessageId">邮件ID</param>
|
||||
/// <returns>交易记录列表</returns>
|
||||
Task<List<TransactionRecord>> GetByEmailIdAsync(long emailMessageId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取未分类的账单数量
|
||||
/// </summary>
|
||||
/// <returns>未分类账单数量</returns>
|
||||
Task<int> GetUnclassifiedCountAsync();
|
||||
|
||||
/// <summary>
|
||||
/// 获取未分类的账单列表
|
||||
/// </summary>
|
||||
/// <param name="pageSize">每页数量</param>
|
||||
/// <returns>未分类账单列表</returns>
|
||||
Task<List<TransactionRecord>> GetUnclassifiedAsync(int pageSize = 10);
|
||||
}
|
||||
|
||||
public class TransactionRecordRepository(IFreeSql freeSql) : BaseRepository<TransactionRecord>(freeSql), ITransactionRecordRepository
|
||||
@@ -180,4 +193,20 @@ public class TransactionRecordRepository(IFreeSql freeSql) : BaseRepository<Tran
|
||||
.OrderBy(t => t.OccurredAt)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<int> GetUnclassifiedCountAsync()
|
||||
{
|
||||
return (int)await FreeSql.Select<TransactionRecord>()
|
||||
.Where(t => string.IsNullOrEmpty(t.Classify))
|
||||
.CountAsync();
|
||||
}
|
||||
|
||||
public async Task<List<TransactionRecord>> GetUnclassifiedAsync(int pageSize = 10)
|
||||
{
|
||||
return await FreeSql.Select<TransactionRecord>()
|
||||
.Where(t => string.IsNullOrEmpty(t.Classify))
|
||||
.OrderByDescending(t => t.OccurredAt)
|
||||
.Page(1, pageSize)
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user