|
|
@ -79,54 +79,70 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
|
|
|
|
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input, string keyWord) |
|
|
|
{ |
|
|
|
Expression<Func<teamitems, items, TeamitemDto>> select = (a, b) => new TeamitemDto |
|
|
|
try |
|
|
|
{ |
|
|
|
GoodsId = b.GoodsId, |
|
|
|
HasFilter = b.HasFilter, |
|
|
|
Platform = b.Platform, |
|
|
|
GoodsUrl = b.GoodsUrl, |
|
|
|
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson) |
|
|
|
}; |
|
|
|
|
|
|
|
var search = input.Search; |
|
|
|
select = select.BuildExtendSelectExpre(); |
|
|
|
|
|
|
|
var q_titem = GetIQueryable(); |
|
|
|
var q = from a in q_titem.AsExpandable() |
|
|
|
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab |
|
|
|
from b in ab.DefaultIfEmpty() |
|
|
|
select @select.Invoke(a, b); |
|
|
|
|
|
|
|
int state = int.Parse(search.Keyword); |
|
|
|
|
|
|
|
//查询对应状态
|
|
|
|
var where = LinqHelper.True<TeamitemDto>(); |
|
|
|
if (state == 0) |
|
|
|
{ |
|
|
|
where = where.And(c => c.State == state || c.State == (int)TeamItemState.已发布比价); |
|
|
|
} |
|
|
|
else { |
|
|
|
if (state == 6) |
|
|
|
Expression<Func<teamitems, items, cats, TeamitemDto>> select = (a, b, c) => new TeamitemDto |
|
|
|
{ |
|
|
|
where = where.And(c => c.State == state || c.State == (int)TeamItemState.待修改); |
|
|
|
} |
|
|
|
else |
|
|
|
GoodsId = b.GoodsId, |
|
|
|
HasFilter = b.HasFilter, |
|
|
|
Platform = b.Platform, |
|
|
|
GoodsUrl = b.GoodsUrl, |
|
|
|
CatName = c == null ? String.Empty : c.Name, |
|
|
|
Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<TeamItemExtension>>(a.ExtensionJson) |
|
|
|
}; |
|
|
|
|
|
|
|
var search = input.Search; |
|
|
|
select = select.BuildExtendSelectExpre(); |
|
|
|
|
|
|
|
var q_titem = GetIQueryable(); |
|
|
|
var q = from a in q_titem.AsExpandable() |
|
|
|
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab |
|
|
|
from b in ab.DefaultIfEmpty() |
|
|
|
join c in Db.GetIQueryable<cats>() on a.CatId equals c.Id into bc |
|
|
|
from c in bc.DefaultIfEmpty() |
|
|
|
select @select.Invoke(a, b, c); |
|
|
|
|
|
|
|
int state = 0; |
|
|
|
bool searchState= int.TryParse(search.Keyword, out state); |
|
|
|
|
|
|
|
//查询对应状态
|
|
|
|
var where = LinqHelper.True<TeamitemDto>(); |
|
|
|
|
|
|
|
if (searchState) |
|
|
|
{ |
|
|
|
where = where.And(c => c.State == state); |
|
|
|
if (state == 0) |
|
|
|
{ |
|
|
|
where = where.And(c => c.State == state || c.State == (int)TeamItemState.已发布比价); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (state == 6) |
|
|
|
{ |
|
|
|
where = where.And(c => c.State == state || c.State == (int)TeamItemState.待修改); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
where = where.And(c => c.State == state); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
where = where.AndIf(!string.IsNullOrEmpty(keyWord), d => d.Title.Contains(keyWord)); |
|
|
|
where = where.AndIf(!string.IsNullOrEmpty(keyWord), d => string.IsNullOrEmpty(d.CatName) ? true : d.CatName.Contains(keyWord)); |
|
|
|
|
|
|
|
where = where.And(c => c.TeamId == _operator.TeamId); |
|
|
|
where = where.And(c => c.TeamId == _operator.TeamId); |
|
|
|
|
|
|
|
input.SortField = "CreateTime"; |
|
|
|
input.SortType = "desc"; |
|
|
|
input.SortField = "CreateTime"; |
|
|
|
input.SortType = "desc"; |
|
|
|
|
|
|
|
var list = q.Where(where).GetPageResultAsync(input).Result; |
|
|
|
var list = q.Where(where).GetPageResultAsync(input).Result; |
|
|
|
|
|
|
|
return list; |
|
|
|
|
|
|
|
return list; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
throw new Exception(ex.StackTrace); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -194,7 +210,7 @@ namespace Coldairarrow.Business.HuiYan |
|
|
|
ItemImg = model.ItemImg, |
|
|
|
Sales = model.Sales, |
|
|
|
Title = model.Title, |
|
|
|
|
|
|
|
CatId=model.CatId, |
|
|
|
ItemId = model.ItemId |
|
|
|
}); |
|
|
|
|
|
|
|