admin
2023-10-18 e80a22d84d2e1321843b4e18d99d9a9fc29d315e
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
using System.Threading.Tasks;
using RiskControl.NewService.Entity.RRAutoBIDB;
using RiskControl.NewService.Extension;
using SqlSugar;
 
namespace RiskControl.NewService.Service
{
    public class EventKgService:DbContext
    {
        /// <summary>
        /// 获取投资事件
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public async Task<Page<EventKgInvest>> GetInvestPage(ParamInvestSearch param)
        {
            var page = await RRAutoBIDB.Queryable<EventKgInvest>()
                .WhereIF(!string.IsNullOrWhiteSpace(param.Name), a => a.Name.Contains(param.Name))
                .WhereIF(!string.IsNullOrWhiteSpace(param.EventType), a => a.EventType == param.EventType)
                .WhereIF(!string.IsNullOrWhiteSpace(param.Financier), a => a.Financier.Contains(param.Financier))
                .WhereIF(!string.IsNullOrWhiteSpace(param.Investor), a => a.Investor.ToString().Contains(param.Investor))
                .WhereIF(!string.IsNullOrWhiteSpace(param.FinancingAmount), a => a.FinancingAmount.Contains(param.FinancingAmount))
                .WhereIF(!string.IsNullOrWhiteSpace(param.Rounds), a => a.Rounds.Contains(param.Rounds))
                .WhereIF(!string.IsNullOrWhiteSpace(param.Industry), a => a.Industry.Contains(param.Industry))
                .WhereIF(param.FinancingDateRange1 != null, a => a.FinancingDate >= param.FinancingDateRange1)
                .WhereIF(param.FinancingDateRange2 != null, a => a.FinancingDate <= param.FinancingDateRange2)
                .OrderBy(a=>a.FinancingDate,OrderByType.Desc)
                .ToPageAsync(param.PageIndex, param.PageSize);
            return page;
        }
        /// <summary>
        /// 获取并购事件
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public async Task<Page<EventKgAcquire>> GetAcquirePage(ParamAcquireSearch param)
        {
            var page = await RRAutoBIDB.Queryable<EventKgAcquire>()
                .WhereIF(!string.IsNullOrWhiteSpace(param.Name), a => a.Name.Contains(param.Name))
                .WhereIF(!string.IsNullOrWhiteSpace(param.EventType), a => a.EventType == param.EventType)
                .WhereIF(!string.IsNullOrWhiteSpace(param.Status), a => a.Status == param.Status)
                .WhereIF(!string.IsNullOrWhiteSpace(param.Vcpe), a => a.Vcpe == param.Vcpe)
                .WhereIF(!string.IsNullOrWhiteSpace(param.Acquiree), a => a.Acquiree.Contains(param.Acquiree))
                .WhereIF(!string.IsNullOrWhiteSpace(param.Acquirer), a => a.Acquirer.Contains(param.Acquirer))
                .WhereIF(!string.IsNullOrWhiteSpace(param.Industry), a => a.Industry.Contains(param.Industry))
                .WhereIF(param.StockRightRange1 != null, a => a.StockRight >= param.StockRightRange1)
                .WhereIF(param.StockRightRange2 != null, a => a.StockRight <= param.StockRightRange1)
                .WhereIF(param.StartDateRange1 != null, a => a.StartDate >= param.StartDateRange1)
                .WhereIF(param.StartDateRange2 != null, a => a.StartDate <= param.StartDateRange2)
                .WhereIF(param.EndDateRange1 != null, a => a.EndDate >= param.EndDateRange1)
                .WhereIF(param.EndDateRange2 != null, a => a.EndDate <= param.EndDateRange2)
                .OrderBy(a=>a.StartDate,OrderByType.Desc)
                .ToPageAsync(param.PageIndex, param.PageSize);
            return page;
        }
    }
}