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;
|
}
|
}
|
}
|