Commit 66e4fc02 by yiyu.li
parents 310a784f 44a59eea
......@@ -51,6 +51,23 @@ namespace Siger.ApiACC.Controllers
parentcateIds.Reverse();
item.parentcategoryids = parentcateIds;
var models = new List<ResponseAumationFixtureToolsAssembly>();
var details = _toolsAssemblyRepository.GetDetailList(item.fixtureguid, ProjectId);
foreach(var model in details)
{
var cates1 = GetParentCategoryList(model.cate_guid, categorys);
var cateIds1 = cates1.Select(q => q.id).ToList();
cateIds1.Reverse();
model.categoryids = cateIds1;
var parentcates1 = GetParentCategoryList(model.parentcate_guid, categorys);
var parentcateIds1 = parentcates1.Select(q => q.id).ToList();
parentcateIds1.Reverse();
model.parentcategoryids = parentcateIds1;
models.Add(model);
}
item.children = models;
list.Add(item);
}
return new PagedObjectResult(list, data.Total, page, pagesize);
......@@ -64,9 +81,9 @@ namespace Siger.ApiACC.Controllers
}
[HttpGet]
public IActionResult GetDetail(string id)
public IActionResult GetDetail(string guid)
{
var data = _toolsAssemblyRepository.GetDetailList(id.ToInt(), ProjectId);
var data = _toolsAssemblyRepository.GetDetailList(guid, ProjectId);
return new ObjectResult(data);
}
......
......@@ -51,7 +51,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
category = c2.name,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : "",
cate_guid = t2.guid,
parentcate_guid = t1.guid
parentcate_guid = t1.guid,
parentguid = q.parent,
fixtureguid = q.son
};
Expression<Func<ResponseAumationFixtureToolsAssembly, bool>> categoryExpression = f => true;
if (category > 0)
......@@ -74,7 +76,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
return new PagedCollectionResult<ResponseAumationFixtureToolsAssembly>(entities, totalCount);
}
public IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(int id, int projectid)
public IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(string parent, int projectid)
{
var query = from q in _context.siger_automation_fixture_tools_assembly
join t1 in _context.siger_automation_fixture_tools on q.parent equals t1.guid into tt1
......@@ -84,7 +86,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
join c2 in _context.siger_automation_fixture_tools_category on t2.category equals c2.guid
join u in _context.siger_project_user on q.updator equals u.mid into uu
from u in uu.DefaultIfEmpty()
where q.projectId == projectid && q.id == id
where q.projectId == projectid && q.parent == parent
select new ResponseAumationFixtureToolsAssembly
{
id = q.id,
......@@ -101,7 +103,11 @@ 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,
parentguid = q.parent,
fixtureguid = q.son
};
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
......
......@@ -118,7 +118,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
public ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid)
{
var query = from q in _context.siger_automation_fixture_tools
join l in _context.siger_automation_location on q.guid equals l.guid
join l in _context.siger_automation_location on q.guid equals l.fixturetools
select new ResponseProductFixtureInfo
{
FixtureGuid=q.guid,
......
......@@ -10,6 +10,6 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
{
IPagedCollectionResult<ResponseAumationFixtureToolsAssembly> GetPagedList(int category, string code, string name, int projectid, int page, int pagesize);
IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(int id, int projectid);
IEnumerable<ResponseAumationFixtureToolsAssembly> GetDetailList(string parent, int projectid);
}
}
......@@ -139,5 +139,11 @@ namespace Siger.Middlelayer.AccRepository.Response
public List<int> parentcategoryids { get; set; } = new List<int>();
public string cate_guid { get; set; }
public List<int> categoryids { get; set; } = new List<int>();
public string parentguid { get; set; }
public string fixtureguid { get; set; }
public List<ResponseAumationFixtureToolsAssembly> children { get; set; }
}
}
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