Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.

Implement API security baseline (sys_user, JWT, audit fields, transactions,
unique constraints) and Web real login with 401 handling. Document setup
and development workflows in root, WmsLite.Api, and WmsLite.Web README files.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zhougfandCursor committed 2026-05-24 14:17:47 +08:00
commit fa1b286463
241 files changed
+31188

No files matched your search

@@ -0,0 +1,15 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Area;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IAreaRepository : IBaseRepository<Area>
{
Task<Area?> GetByWarehouseAndAreaCodeAsync(string tenantId, string ownerCode, string warehouseCode, string areaCode);
Task<Dictionary<string, string>> GetNameMapByWarehouseCodesAsync(string tenantId, string ownerCode, IEnumerable<string> warehouseCodes);
Task<PagedResult<Area>> GetPagedListAsync(AreaPagedQuery query);
}
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Common;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IBaseRepository<TEntity> where TEntity : BaseEntity, new()
{
Task<TEntity?> GetByIdAsync(long id);
Task<TEntity?> GetByIdAsync(long id, string tenantId, string ownerCode);
Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate);
Task<PagedResult<TEntity>> GetPagedListAsync(BasePagedQuery query);
Task<long> InsertAsync(TEntity entity);
Task<int> UpdateAsync(TEntity entity);
Task<int> SoftDeleteAsync(long id);
Task<int> SoftDeleteAsync(long id, string tenantId, string ownerCode);
}
@@ -0,0 +1,13 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Container;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IContainerRepository : IBaseRepository<Container>
{
Task<Container?> GetByCodeAsync(string tenantId, string ownerCode, string code);
Task<PagedResult<Container>> GetPagedListAsync(ContainerPagedQuery query);
}
@@ -0,0 +1,9 @@
using System.Threading.Tasks;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IHttpAccessLogRepository
{
Task<long> InsertAsync(HttpAccessLog entity);
}
@@ -0,0 +1,23 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Inventory;
using WmsLite.Api.Enums;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IInventoryRepository : IBaseRepository<Inventory>
{
Task<PagedResult<Inventory>> GetPagedListAsync(InventoryPagedQuery query);
Task<Inventory?> GetByStockKeyAsync(
string tenantId,
string ownerCode,
string warehouseCode,
string areaCode,
string zoneCode,
string locationCode,
InventoryKind inventoryKind,
string? materialCode,
string? containerCode);
}
@@ -0,0 +1,13 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Inventory;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IInventoryTransactionRepository
{
Task<long> InsertAsync(InventoryTransaction entity);
Task<PagedResult<InventoryTransaction>> GetPagedListAsync(InventoryTransactionPagedQuery query);
}
@@ -0,0 +1,36 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Location;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface ILocationRepository : IBaseRepository<Location>
{
Task<Location?> GetByWarehouseAreaZoneAndLocationCodeAsync(
string tenantId,
string ownerCode,
string warehouseCode,
string areaCode,
string zoneCode,
string locationCode);
/// <summary>按仓+库区+库位编码解析;若存在多行则取分区编码最小的一条。</summary>
Task<Location?> GetByWarehouseAreaAndLocationCodeAsync(
string tenantId,
string ownerCode,
string warehouseCode,
string areaCode,
string locationCode);
Task<PagedResult<Location>> GetPagedListAsync(LocationPagedQuery query);
Task<HashSet<string>> GetExistingCodesAsync(
string tenantId,
string ownerCode,
string warehouseCode,
string areaCode,
string zoneCode,
IReadOnlyCollection<string> codes);
Task InsertManyAsync(IReadOnlyList<Location> entities);
}
@@ -0,0 +1,15 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Material;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IMaterialRepository : IBaseRepository<Material>
{
Task<Material?> GetByCodeAsync(string tenantId, string ownerCode, string code);
Task<Dictionary<string, string>> GetNameMapByCodesAsync(string tenantId, string ownerCode, IEnumerable<string> codes);
Task<PagedResult<Material>> GetPagedListAsync(MaterialPagedQuery query);
}
@@ -0,0 +1,60 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Orders;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IInboundOrderRepository : IBaseRepository<InboundOrder>
{
Task<InboundOrder?> GetByOrderNoAsync(string tenantId, string ownerCode, string orderNo);
Task<PagedResult<InboundOrder>> GetPagedListAsync(InboundOrderPagedQuery query);
/// <summary>
/// 同一天、同一前缀下,符合「前缀+yyyyMMdd+5位数字」格式的最大流水号(无则返回 0)。用于生成 IN2026022312345。
/// </summary>
Task<int> GetMaxDailySequenceInboundAsync(string tenantId, string ownerCode, string orderPrefix, string dateYyyyMmDd);
}
public interface IInboundOrderLineRepository : IBaseRepository<InboundOrderLine>
{
Task<List<InboundOrderLine>> GetByOrderIdAsync(long orderId);
}
public interface IOutboundOrderRepository : IBaseRepository<OutboundOrder>
{
Task<OutboundOrder?> GetByOrderNoAsync(string tenantId, string ownerCode, string orderNo);
Task<PagedResult<OutboundOrder>> GetPagedListAsync(OutboundOrderPagedQuery query);
}
public interface IOutboundOrderLineRepository : IBaseRepository<OutboundOrderLine>
{
Task<List<OutboundOrderLine>> GetByOrderIdAsync(long orderId);
}
public interface ITransferOrderRepository : IBaseRepository<TransferOrder>
{
Task<TransferOrder?> GetByOrderNoAsync(string tenantId, string ownerCode, string orderNo);
Task<PagedResult<TransferOrder>> GetPagedListAsync(TransferOrderPagedQuery query);
}
public interface ITransferOrderLineRepository : IBaseRepository<TransferOrderLine>
{
Task<List<TransferOrderLine>> GetByOrderIdAsync(long orderId);
}
public interface IStocktakeOrderRepository : IBaseRepository<StocktakeOrder>
{
Task<StocktakeOrder?> GetByOrderNoAsync(string tenantId, string ownerCode, string orderNo);
Task<PagedResult<StocktakeOrder>> GetPagedListAsync(StocktakeOrderPagedQuery query);
}
public interface IStocktakeOrderLineRepository : IBaseRepository<StocktakeOrderLine>
{
Task<List<StocktakeOrderLine>> GetByOrderIdAsync(long orderId);
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
/// <summary>查询字典行(租户 + platform system 默认)。</summary>
public interface ISysDictItemRepository
{
/// <summary>
/// 读取当前租户 scope 以及 tenant_id=&quot;system&quot;, owner_code=&quot;system&quot; 的启用字典项。
/// 调用方自行合并优先级。
/// </summary>
Task<List<SysDictItem>> ListEnabledAsync(string tenantId, string ownerCode, IReadOnlyList<string>? categories);
}
@@ -0,0 +1,13 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Template;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface ISysTemplateRepository : IBaseRepository<SysTemplate>
{
Task<SysTemplate?> GetByBizTypeAsync(string tenantId, string ownerCode, string? bizType);
Task<PagedResult<SysTemplate>> GetPagedListAsync(SysTemplatePagedQuery query);
}
@@ -0,0 +1,8 @@
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface ISysUserRepository
{
Task<SysUser?> GetByUsernameAsync(string tenantId, string ownerCode, string username);
}
@@ -0,0 +1,15 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Warehouse;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IWarehouseRepository : IBaseRepository<Warehouse>
{
Task<Warehouse?> GetByCodeAsync(string tenantId, string ownerCode, string code);
Task<Dictionary<string, string>> GetNameMapByCodesAsync(string tenantId, string ownerCode, IEnumerable<string> codes);
Task<PagedResult<Warehouse>> GetPagedListAsync(WarehousePagedQuery query);
}
@@ -0,0 +1,20 @@
using System.Threading.Tasks;
using WmsLite.Api.Common;
using WmsLite.Api.Dtos.Zone;
using WmsLite.Api.Models;
namespace WmsLite.Api.Repositories.Interfaces;
public interface IZoneRepository : IBaseRepository<Zone>
{
Task<Zone?> GetByWarehouseAreaAndZoneCodeAsync(
string tenantId,
string ownerCode,
string warehouseCode,
string areaCode,
string zoneCode);
Task<Dictionary<string, string>> GetNameMapByWarehouseCodesAsync(string tenantId, string ownerCode, IEnumerable<string> warehouseCodes);
Task<PagedResult<Zone>> GetPagedListAsync(ZonePagedQuery query);
}