ningshuxia
2022-10-28 3ccb7c60e1ed8b6748ed7fb8b64b1dbe50d62abf
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
64
65
66
67
68
69
70
71
72
73
74
using SqlSugar;
using IStation.Untity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.DAL  
{
    /// <summary>
    /// 
    /// </summary>
    public class UserLoginLog:CorpDAL<Entity.UserLoginLog>
    {
        /// <summary>
        /// 
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return ConfigHelper.UserLoginConnectionConfig; }
        }
 
        /// <summary>
        /// 通过 UserID 获取分页列表
        /// </summary>
        public List<Entity.UserLoginLog> GetPageListByUserID
            (long UserID, DateTime StartTime, DateTime EndTime, int PageIndex, int PageSize, ref int Total)
        {
            if (EndTime < StartTime)
            {
                return default;
            }
            if (PageIndex < 1)
                PageIndex = 1;
            if (PageSize < 1)
                PageSize = 1;
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.UserLoginLog>()
                    .Where(x => x.UserID == UserID && x.LoginTime >= StartTime && x.LoginTime <= EndTime)
                    .OrderBy(x=>x.LoginTime,OrderByType.Desc)
                    .ToPageList(PageIndex,PageSize,ref Total);
            }
        }
 
        /// <summary>
        /// 通过 CorpID 获取分页列表
        /// </summary>
        public List<Entity.UserLoginLog> GetPageListByCorpID
            (long CorpID, DateTime StartTime, DateTime EndTime, int PageIndex, int PageSize, ref int Total)
        {
            if (EndTime < StartTime)
            {
                return default;
            }
            if (PageIndex < 1)
                PageIndex = 1;
            if (PageSize < 1)
                PageSize = 1;
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.UserLoginLog>()
                    .Where(x => x.CorpID == CorpID && x.LoginTime >= StartTime && x.LoginTime <= EndTime)
                    .OrderBy(x => x.LoginTime, OrderByType.Desc)
                    .ToPageList(PageIndex, PageSize, ref Total);
            }
        }
 
 
 
    }
}