'respository'

This commit is contained in:
zhougf committed 2026-05-31 01:03:55 +08:00
1 parent fa1b286463
commit 38ecbf82e5
41 files changed
+67 -120

No files matched your search

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
using SqlSugar;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Inventory;
using WmsLite.Api.Infrastructure.Auth;
using WmsLite.Api.Models;
using WmsLite.Api.Repositories.Interfaces;
@@ -11,10 +12,12 @@ namespace WmsLite.Api.Repositories;
public class InventoryTransactionRepository : IInventoryTransactionRepository
{
private readonly ISqlSugarClient _db;
private readonly ICurrentUserContext _userContext;
public InventoryTransactionRepository(ISqlSugarClient db)
public InventoryTransactionRepository(ISqlSugarClient db, ICurrentUserContext userContext)
{
_db = db;
_userContext = userContext;
}
public async Task<long> InsertAsync(InventoryTransaction entity)
@@ -30,8 +33,8 @@ public class InventoryTransactionRepository : IInventoryTransactionRepository
{
var pageIndex = query.PageIndex <= 0 ? 1 : query.PageIndex;
var pageSize = query.PageSize <= 0 ? 20 : query.PageSize;
var tenant = query.TenantId.Trim();
var owner = query.OwnerCode.Trim();
var tenant = _userContext.TenantId.Trim();
var owner = _userContext.OwnerCode.Trim();
var dbQuery = _db.Queryable<InventoryTransaction>()
.Where(x => !x.IsDeleted && x.TenantId == tenant && x.OwnerCode == owner)