lixiaojun
2022-11-23 48bf955aa337d70111afcc0ff87e0e0671b510c8
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
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using IStation.Untity;
 
 
namespace IStation.DAL
{
    /// <summary>
    /// SIM缴费记录
    /// </summary>
    public partial class SimPaymentRecord : CorpDAL<Entity.SimPaymentRecord> 
    {
        /// <summary>
        /// 
        /// </summary>
        public override ConnectionConfig ConnectionConfig
        {
            get { return ConfigHelper.DefaultConnectionConfig; }
        }
 
        /// <summary>
        /// 通过 CardID 获取
        /// </summary>
        public List<Entity.SimPaymentRecord> GetByCardID(long CorpID, long CardID)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.SimPaymentRecord>().Where(x => x.CorpID == CorpID && x.CardID == CardID).ToList();
            }
        }
 
        /// <summary>
        /// 通过 CardIds 获取
        /// </summary>
        public List<Entity.SimPaymentRecord> GetByCardIds(long CorpID, List<long> CardIds)
        {
            if (CardIds == null || CardIds.Count < 1)
                return default;
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.SimPaymentRecord>().Where(x => x.CorpID == CorpID && CardIds.Contains(x.CardID)).ToList();
            }
        }
 
        /// <summary>
        /// 通过 BelongType 和 BelongID 获取
        /// </summary>
        public List<Entity.SimPaymentRecord> GetByBelongTypeAndBelongID(long CorpID, string BelongType, long BelongID)
        {
            using (var db = new SqlSugarClient(ConnectionConfig))
            {
                return db.Queryable<Entity.SimPaymentRecord, Entity.Product>((x, y) => x.CardID == y.ID)
                    .Where((x, y) => y.CorpID == CorpID && y.BelongType == BelongType && y.BelongID == BelongID)
                    .Select(x => x).ToList();
            }
        }
 
 
 
 
 
    }
}