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
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
 
namespace IStation.DAL
{
    /// <summary>
    /// 建筑物
    /// </summary>
    public partial class Building : CorpTraceDAL_Sorter_UseStatus_TagName_TerminalId<Entity.Building>
    {
        /// <summary>
        /// 
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return ConfigHelper.DefaultConnectionConfig; }
 
        }
 
        /// <summary>
        /// 更新类型
        /// </summary>
        public bool UpdateType(long CorpID, long ID, string Type,long UpdateUserID,DateTime UpdateTime)
        {
            using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Updateable<Entity.Building>()
                    .SetColumns(x => x.Type == Type)
                    .SetColumns(x=>x.UpdateUserID==UpdateUserID)
                    .SetColumns(x=>x.UpdateTime==UpdateTime) 
                    .Where(x => x.CorpID == CorpID && x.ID == ID)
                    .ExecuteCommand() > 0;
            }
        }
 
        /// <summary>
        /// 通过 BelongType 和BelongID 获取
        /// </summary>
        public List<Entity.Building> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.Building>()
                    .Where(x => x.CorpID == CorpID && x.BelongType == BelongType && x.BelongID == BelongID).ToList();
            }
        }
 
 
 
 
 
    }
}