39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Work.Business.ProductMappingBLL
|
|
{
|
|
public class MappingTaoBaoBLL
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="prodList"></param>
|
|
/// <param name="minPrice"></param>
|
|
/// <param name="maxPrice"></param>
|
|
/// <param name="isGetTitle">如果是标题搜索,则放宽限制</param>
|
|
/// <returns></returns>
|
|
public static List<Tuple<string, int, int,string>> FilterItems(List<Tuple<string, int, int,string>> prodList, int minPrice, int maxPrice = 0, bool isGetTitle = false, decimal multiple = 20M)
|
|
{
|
|
if (prodList == null || prodList.Count == 0)
|
|
return new List<Tuple<string, int, int,string>>();
|
|
|
|
var result = prodList.Where(p => !string.IsNullOrEmpty(p.Item1) && p.Item2 >= minPrice && p.Item3 >= maxPrice && p.Item3 < (maxPrice * 3.5M + 3000)).ToList();
|
|
var resultx = result.Where(r => r.Item2 != r.Item3).ToList();
|
|
if (resultx.Count > 0)
|
|
return resultx;
|
|
if (result.Count > 0)
|
|
return result;
|
|
|
|
if (isGetTitle)
|
|
{
|
|
result = prodList.Where(p => !string.IsNullOrEmpty(p.Item1) && p.Item2 >= minPrice && p.Item3 < (maxPrice * multiple + 3000)).ToList();
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|