lixiaojun
2024-12-10 5587341ac6e50a040972d33d83de632e7d0c87af
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
using Yw.DAL.SQLite;
 
namespace HStation.DAL.SQLite
{
    /// <summary>
    /// 
    /// </summary>
    public partial class TransferRevitFile : BaseDAL<Entity.TransferRevitFile>, ITransferRevitFile
    {
        /// <summary>
        /// 
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return ConfigHelper.SQLiteConnectionConfig; }
        }
 
 
        /// <summary>
        /// 获取模糊列表
        /// </summary>
        public List<Entity.TransferRevitFile> GetFluzzyList
          (
                 string fileName,
                 string fileCode,
                 string fileSuffix,
                 string uploadUserName,
                 DateTime? startTime,
                 DateTime? endTime
            )
        {
            var exp = Expressionable.Create<Entity.TransferRevitFile>();
            exp.AndIF(!string.IsNullOrEmpty(fileName), x => x.FileName.Contains(fileName));
            exp.AndIF(!string.IsNullOrEmpty(fileCode), x => x.FileCode.Contains(fileCode));
            exp.AndIF(!string.IsNullOrEmpty(fileSuffix), x => x.FileSuffix.Contains(fileSuffix));
            exp.AndIF(!string.IsNullOrEmpty(uploadUserName), x => x.UploadUserName.Contains(uploadUserName));
            exp.AndIF(startTime.HasValue, x => x.UploadTime >= startTime.Value);
            exp.AndIF(endTime.HasValue, x => x.UploadTime <= endTime.Value);
 
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.TransferRevitFile>()
                    .Where(exp.ToExpression())
                    .OrderBy(x => x.UploadTime, OrderByType.Desc)
                    .ToList();
            }
        }
 
        /// <summary>
        /// 获取模糊分页列表
        /// </summary>
        public List<Entity.TransferRevitFile> GetFluzzyPageList
          (
                 string fileName,
                 string fileCode,
                 string fileSuffix,
                 string uploadUserName,
                 DateTime? startTime,
                 DateTime? endTime,
                 int PageIndex,
                 int PageSize,
                 ref int Total
            )
        {
            if (PageIndex < 1)
            {
                PageIndex = 1;
            }
            if (PageSize < 1)
            {
                PageSize = 1;
            }
            var exp = Expressionable.Create<Entity.TransferRevitFile>();
            exp.AndIF(!string.IsNullOrEmpty(fileName), x => x.FileName.Contains(fileName));
            exp.AndIF(!string.IsNullOrEmpty(fileCode), x => x.FileCode.Contains(fileCode));
            exp.AndIF(!string.IsNullOrEmpty(fileSuffix), x => x.FileSuffix.Contains(fileSuffix));
            exp.AndIF(!string.IsNullOrEmpty(uploadUserName), x => x.UploadUserName.Contains(uploadUserName));
            exp.AndIF(startTime.HasValue, x => x.UploadTime >= startTime.Value);
            exp.AndIF(endTime.HasValue, x => x.UploadTime <= endTime.Value);
 
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.TransferRevitFile>()
                    .Where(exp.ToExpression())
                    .OrderBy(x => x.UploadTime, OrderByType.Desc)
                    .ToPageList(PageIndex, PageSize, ref Total);
            }
        }
 
        /// <summary>
        /// 
        /// </summary>
        public bool IsExistFileCode(string FileCode)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.TransferRevitFile>()
                    .Where(x => x.FileCode == FileCode)
                    .Count() > 0;
            }
        }
 
        /// <summary>
        /// 
        /// </summary>
        public bool IsExistFileCodeExceptID(string FileCode, long ExceptID)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.TransferRevitFile>()
                    .Where(x => x.FileCode == FileCode && x.ID != ExceptID)
                    .Count() > 0;
            }
        }
 
 
 
 
 
    }
}