ningshuxia
2022-12-12 e78f5936fee9ab4fff600515bb20a41a28f329c4
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
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
 
namespace IStation.DAL
{
    /// <summary>
    /// Dma点位映射关系
    /// </summary>
    public partial class DmaSiteMapping : CorpDAL<Entity.DmaSiteMapping>
    {
        /// <summary>
        /// 
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return ConfigHelper.DefaultConnectionConfig; }
 
        }
 
        /// <summary>
        /// 通过 DmaAreaID 获取
        /// </summary>
        public List<Entity.DmaSiteMapping> GetByDmaAreaID(long CorpID, long DmaAreaID)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.DmaSiteMapping>()
                    .Where(x => x.CorpID == CorpID && x.DmaAreaID == DmaAreaID).ToList(); 
            }
        }
 
        /// <summary>
        /// 通过 DmaSiteID 获取
        /// </summary>
        public List<Entity.DmaSiteMapping> GetByDmaSiteID(long CorpID, long DmaSiteID)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.DmaSiteMapping>()
                    .Where(x => x.CorpID == CorpID && x.DmaSiteID == DmaSiteID).ToList();
            }
        }
 
        /// <summary>
        /// 更新方向
        /// </summary>
        public bool UpdateDirection(long CorpID, long ID, int Direction)
        {
            using (SqlSugarClient db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Updateable<Entity.DmaSiteMapping>()
                    .SetColumns(x => x.Direction == Direction).Where(x => x.CorpID == CorpID && x.ID == ID)
                    .ExecuteCommand() > 0;
            }
        }
 
    }
}