Commit 9d78ae09 by xin.yang

some update

parent 96fead29
......@@ -37,9 +37,32 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string code, string name, int page, int pagesize)
{
var data = _toolsAssemblyRepository.GetPagedList(category.ToInt(), code, name, ProjectId, page, pagesize);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var list = new List<ResponseAumationFixtureToolsAssembly>();
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;
var parentcates = GetParentCategoryList(item.parentcate_guid, categorys);
var parentcateIds = parentcates.Select(q => q.id).ToList();
parentcateIds.Reverse();
item.parentcategoryids = parentcateIds;
list.Add(item);
}
return new PagedObjectResult(data.Data, 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)));
}
[HttpGet]
public IActionResult GetDetail(string id)
{
......
......@@ -48,7 +48,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
filename = q.filename,
categoryid = c2.id,
category = c2.name,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
cate_guid = t2.guid,
parentcate_guid = t1.guid
};
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0)
......
......@@ -130,5 +130,10 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; }
public string fileurl { get; set; }
public string filename { get; set; }
public string parentcate_guid { get; set; }
public List<int> parentcategoryids { get; set; } = new List<int>();
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
}
}
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