Commit a24b590c by xin.yang

fix bug

parent f1be7fa1
...@@ -34,7 +34,24 @@ namespace Siger.ApiACC.Controllers ...@@ -34,7 +34,24 @@ namespace Siger.ApiACC.Controllers
public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize) public IActionResult GetPageList(string category, string code, string name, string state, int page, int pagesize)
{ {
var data = _toolsRepository.GetPagedList(category.ToInt(), code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize); var data = _toolsRepository.GetPagedList(category.ToInt(), code, name, string.IsNullOrEmpty(state) ? -1 : state.ToInt(), ProjectId, page, pagesize);
return new PagedObjectResult(data.Data, data.Total, page, pagesize); var list = new List<ResponseFixtureTools>();
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
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] [HttpPost]
......
...@@ -33,6 +33,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories ...@@ -33,6 +33,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
id = q.id, id = q.id,
name = q.name, name = q.name,
guid = q.guid, guid = q.guid,
cate_guid = p.guid,
categoryid = p.id, categoryid = p.id,
category = p.name, category = p.name,
managetype = q.managetype, managetype = q.managetype,
......
...@@ -30,6 +30,7 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -30,6 +30,7 @@ namespace Siger.Middlelayer.AccRepository.Response
{ {
public int id { get; set; } public int id { get; set; }
public string guid { get; set; } public string guid { get; set; }
public string cate_guid { get; set; }
/// <summary> /// <summary>
/// 工装类别ID /// 工装类别ID
/// </summary> /// </summary>
...@@ -77,6 +78,8 @@ namespace Siger.Middlelayer.AccRepository.Response ...@@ -77,6 +78,8 @@ namespace Siger.Middlelayer.AccRepository.Response
public int status { get; set; } public int status { get; set; }
public string updatetime { get; set; } public string updatetime { 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