init 项目代码初始化
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using Dlhis.Basic.MealUser.Request;
|
||||
using Dlhis.Basic.MealUser.Response;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.MealUser.Services.Implements;
|
||||
|
||||
public class MealUserService : IMealUserService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public MealUserService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Pagination<MealUserResponse>> GetPageAsync(MealUserPageRequest request)
|
||||
{
|
||||
var page = await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Select<MealUserResponse>()
|
||||
.ToPageListAsync(request);
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task AddAsync(MealUserAddRequest request)
|
||||
{
|
||||
//todo 获取档案信息
|
||||
|
||||
var entity = new CanteenUserEntity
|
||||
{
|
||||
UserId = request.UserId,
|
||||
UserType = request.UserType,
|
||||
UserCode = "",
|
||||
CarNo = "",
|
||||
Balance = 0,
|
||||
BalanceOfRecharge = 0,
|
||||
BalanceOfSubsidies = 0,
|
||||
Version = 0,
|
||||
};
|
||||
await _dbContext.InsertAsync(entity);
|
||||
}
|
||||
|
||||
public async Task<MealUserResponse> GetMealUserAsync(string userId)
|
||||
{
|
||||
return await _dbContext.Queryable<CanteenUserEntity>()
|
||||
.Where(x => x.UserId == userId)
|
||||
.Select<MealUserResponse>()
|
||||
.FirstAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user