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,57 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;
namespace WmsLite.Api.Infrastructure.HttpLogging;
/// <summary>
/// 将当前请求内 SqlSugar 产生的 SQL 收集到 <see cref="HttpContext.Items"/>,供 HTTP 日志合并输出。
/// </summary>
public static class HttpSqlLogContext
{
public const string ItemsKey = "WmsLite.HttpSqlLogBuffer";
public sealed class Buffer
{
private readonly List<string> _sql = new();
private readonly object _gate = new();
public void Append(string sql)
{
if (string.IsNullOrWhiteSpace(sql))
{
return;
}
lock (_gate)
{
_sql.Add(sql.Trim());
}
}
public IReadOnlyList<string> Snapshot()
{
lock (_gate)
{
return _sql.ToArray();
}
}
}
public static void StartRequest(HttpContext context)
{
context.Items[ItemsKey] = new Buffer();
}
public static void Append(HttpContext? context, string executableSql)
{
if (context?.Items[ItemsKey] is Buffer buffer)
{
buffer.Append(executableSql);
}
}
public static IReadOnlyList<string> GetSqlSnapshot(HttpContext context)
{
return context.Items[ItemsKey] is Buffer b ? b.Snapshot() : System.Array.Empty<string>();
}
}