tx
2025-04-09 fa7510e1ed63df0366787fa4ed1b3db6426d2b46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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;
            }
 
        }
 
    }
}