WMSlite/WmsLite.Api/Repositories/HttpAccessLogRepository.cs
zhougf fa1b286463 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>
2026-05-24 14:17:47 +08:00

26 lines
664 B
C#

using System.Threading.Tasks;
using SqlSugar;
using WmsLite.Api.Common;
using WmsLite.Api.Models;
using WmsLite.Api.Repositories.Interfaces;
namespace WmsLite.Api.Repositories;
public class HttpAccessLogRepository : IHttpAccessLogRepository
{
private readonly ISqlSugarClient _db;
public HttpAccessLogRepository(ISqlSugarClient db)
{
_db = db;
}
public async Task<long> InsertAsync(HttpAccessLog entity)
{
entity.Id = entity.Id == 0 ? SnowFlakeSingle.Instance.NextId() : entity.Id;
entity.CreateTime ??= DateTime.Now;
await _db.Insertable(entity).ExecuteCommandAsync();
return entity.Id;
}
}