feat: 门店员工与排班管理上线

This commit is contained in:
2025-12-04 09:32:03 +08:00
parent 1a5209a8b1
commit 19422df0f1
31 changed files with 1265 additions and 7 deletions

View File

@@ -55,6 +55,26 @@ public sealed class EfMerchantRepository(TakeoutAppDbContext context) : IMerchan
return staffs;
}
/// <inheritdoc />
public async Task<IReadOnlyList<MerchantStaff>> GetStaffByStoreAsync(long storeId, long tenantId, CancellationToken cancellationToken = default)
{
var staffs = await context.MerchantStaff
.AsNoTracking()
.Where(x => x.TenantId == tenantId && x.StoreId == storeId)
.OrderBy(x => x.Name)
.ToListAsync(cancellationToken);
return staffs;
}
/// <inheritdoc />
public Task<MerchantStaff?> FindStaffByIdAsync(long staffId, long tenantId, CancellationToken cancellationToken = default)
{
return context.MerchantStaff
.Where(x => x.TenantId == tenantId && x.Id == staffId)
.FirstOrDefaultAsync(cancellationToken);
}
/// <inheritdoc />
public async Task<IReadOnlyList<MerchantContract>> GetContractsAsync(long merchantId, long tenantId, CancellationToken cancellationToken = default)
{
@@ -161,6 +181,21 @@ public sealed class EfMerchantRepository(TakeoutAppDbContext context) : IMerchan
context.Merchants.Remove(existing);
}
/// <inheritdoc />
public async Task DeleteStaffAsync(long staffId, long tenantId, CancellationToken cancellationToken = default)
{
var existing = await context.MerchantStaff
.Where(x => x.TenantId == tenantId && x.Id == staffId)
.FirstOrDefaultAsync(cancellationToken);
if (existing == null)
{
return;
}
context.MerchantStaff.Remove(existing);
}
/// <inheritdoc />
public Task AddAuditLogAsync(MerchantAuditLog log, CancellationToken cancellationToken = default)
{