重构账单查询sql
All checks were successful
Docker Build & Deploy / Build Docker Image (push) Successful in 26s
Docker Build & Deploy / Deploy to Production (push) Successful in 7s
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 2s
Docker Build & Deploy / WeChat Notification (push) Successful in 2s

This commit is contained in:
SunCheng
2026-01-28 10:58:15 +08:00
parent 5c9d7c5db1
commit b71eadd4f9
19 changed files with 1433 additions and 730 deletions

46
Repository/AGENTS.md Normal file
View File

@@ -0,0 +1,46 @@
# REPOSITORY LAYER KNOWLEDGE BASE
**Generated:** 2026-01-28
**Parent:** EmailBill/AGENTS.md
## OVERVIEW
Data access layer using FreeSql with BaseRepository pattern and global usings.
## STRUCTURE
```
Repository/
├── BaseRepository.cs # Generic repository base
├── GlobalUsings.cs # Common imports
├── BudgetRepository.cs # Budget data access
├── TransactionRecordRepository.cs # Transaction data access
├── EmailMessageRepository.cs # Email data access
└── TransactionStatisticsDto.cs # Statistics DTOs
```
## WHERE TO LOOK
| Task | Location | Notes |
|------|----------|-------|
| Base patterns | BaseRepository.cs | Generic CRUD operations |
| Budget data | BudgetRepository.cs | Budget queries and updates |
| Transaction data | TransactionRecordRepository.cs | Financial data access |
| Email data | EmailMessageRepository.cs | Email processing storage |
| Statistics | TransactionStatisticsDto.cs | Data transfer objects |
## CONVENTIONS
- Inherit from BaseRepository<T> for all repositories
- Use GlobalUsings.cs for shared imports
- Async/await pattern for all database operations
- Method names: GetAllAsync, GetByIdAsync, InsertAsync, UpdateAsync
- Return domain entities, not DTOs (except in query results)
## ANTI-PATTERNS (THIS LAYER)
- Never return anonymous types from methods
- Don't expose FreeSql ISelect directly
- Avoid business logic in repositories
- No synchronous database calls
- Don't mix data access with service logic
## UNIQUE STYLES
- Generic constraints: where T : BaseEntity
- Fluent query building with FreeSql extension methods
- Paged query patterns for large datasets