Commit 46186344 by xin.yang

fix bug

parent 7a85a3ed
......@@ -39,7 +39,24 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string tool, string product, int page, int pagesize)
{
var data = _toolsProductRepository.GetPagedList(category.ToInt(), tool.ToInt(), product.ToInt(), ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var list = new List<ResponseAumationFixtureToolsProduct>();
foreach(var item in data.Data)
{
var cates = GetParentCategoryList(item.cate_guid, categorys);
var cateIds = cates.Select(q => q.id).ToList();
cateIds.Reverse();
item.categoryids = cateIds;
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
}
private IEnumerable<siger_automation_fixture_tools_category> GetParentCategoryList(string parentId, List<siger_automation_fixture_tools_category> sections)
{
var query = from c in sections where c.guid == parentId select c;
return query.ToList().Concat(query.ToList().SelectMany(t => GetParentCategoryList(t.parent, sections)));
}
[HttpPost]
......
......@@ -61,7 +61,8 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename = q.filename,
partnumber = t.partnumber,
specfication = t.specification,
productcode = p.code
productcode = p.code,
cate_guid = c.guid ?? ""
};
Expression<Func<ResponseAumationFixtureToolsProduct, bool>> categoryExpression = f => true;
if (category > 0)
......
......@@ -111,6 +111,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public string updatetime { get; set; }
public string fileurl { get; set; }
public string filename { get; set; }
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
}
public class ResponseAumationFixtureToolsAssembly
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment