using SqlSugar;
|
using System;
|
using TProduct.HttpClient;
|
|
namespace TProduct.DAL
|
{
|
/// <summary>
|
/// 登录用户
|
/// </summary>
|
public class LoginUser : BaseLiteSqlDAL_DataSync<Entity.LoginUser>
|
{
|
public override ISqlSugarClient Connection
|
{
|
get { return TProduct.DAL.SQLite.ConfigHelper.MainConn; }
|
}
|
|
/// <summary>
|
/// 登录名是否存在
|
/// </summary>
|
public bool IsLoginName(string LoginName)
|
{
|
using (ISqlSugarClient db = Connection)
|
{
|
return db.Queryable<Entity.LoginUser>().Where(x => x.LoginName == LoginName).Any();
|
}
|
}
|
|
/// <summary>
|
/// 根据登录名获取登录信息
|
/// </summary>
|
public Entity.LoginUser GetByLoginName(string LoginName)
|
{
|
if (string.IsNullOrEmpty(LoginName))
|
return default;
|
using (ISqlSugarClient db = Connection)
|
{
|
return db.Queryable<Entity.LoginUser>().Single(x => x.LoginName.Contains(LoginName));
|
}
|
}
|
|
/// <summary>
|
/// 更新 SetValue
|
/// </summary>
|
public bool UpdateLastLoginTime(long ID)
|
{
|
using (ISqlSugarClient db = Connection)
|
{
|
var result = db.Updateable<Entity.LoginUser>()
|
.SetColumns("LastLoginTime", DateTime.Now)
|
.Where(x => x.ID == ID).ExecuteCommandHasChange();
|
|
if (result && TProduct.CorpConfig.Instance.RealTimeRemoteService.IsSynMainData)
|
{
|
var dto = GetByID(ID);
|
HttpClientHelper.Build(this.TableName, "Update@V1.0").Put<bool>(dto);
|
}
|
return result;
|
}
|
|
}
|
|
}
|
}
|