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>
26 lines
710 B
C#
26 lines
710 B
C#
using SqlSugar;
|
|
using WmsLite.Api.Models;
|
|
using WmsLite.Api.Repositories.Interfaces;
|
|
|
|
namespace WmsLite.Api.Repositories;
|
|
|
|
public class SysUserRepository : ISysUserRepository
|
|
{
|
|
private readonly ISqlSugarClient _db;
|
|
|
|
public SysUserRepository(ISqlSugarClient db)
|
|
{
|
|
_db = db;
|
|
}
|
|
|
|
public async Task<SysUser?> GetByUsernameAsync(string tenantId, string ownerCode, string username)
|
|
{
|
|
var tenant = tenantId.Trim();
|
|
var owner = ownerCode.Trim();
|
|
var user = username.Trim();
|
|
return await _db.Queryable<SysUser>()
|
|
.Where(x => !x.IsDeleted && x.TenantId == tenant && x.OwnerCode == owner && x.Username == user)
|
|
.FirstAsync();
|
|
}
|
|
}
|