feat 钱包和钱包余额查询

This commit is contained in:
2024-11-12 16:08:49 +08:00
parent 1a0ba28249
commit 74912c2efc
6 changed files with 109 additions and 7 deletions

View File

@@ -0,0 +1,30 @@
using Dlhis.Canteen.Setting.Response;
using Dlhis.Entity.Canteen.Entities;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using SqlSugar;
namespace Dlhis.Canteen.Setting.Services.Implements;
public class WalletService : IWalletService
{
private readonly IDbContext _dbContext;
public WalletService(IDbContext dbContext)
{
_dbContext = dbContext;
}
/// <inheritdoc />
public async Task<List<WalletResponse>> GetListAsync()
{
return await _dbContext.Queryable<WalletEntity>()
.GroupBy(x => new { x.Code, x.Name })
.Select(x => new WalletResponse
{
Code = x.Code,
Name = x.Name,
Factories = SqlFunc.Subqueryable<WalletEntity>().Where(p => p.Code == x.Code).ToList(p => p.Factory)
})
.ToListAsync();
}
}