Commit b51d2c87 by xin.yang

fix bug

parent d338a74f
......@@ -485,7 +485,16 @@ namespace Siger.ApiACC.Controllers
[HttpGet]
public IActionResult GetFixtureToolList(string categoryid)
{
var list = _toolsRepository.GetDataList(categoryid.ToInt(), ProjectId);
var categorys = _toolsCategoryRepository.GetList(q => q.projectId == ProjectId && q.status == (int)RowState.Valid).ToList();
var categoryIds = new List<int>();
if (categoryid.ToInt() > 0)
{
var cate = categorys.FirstOrDefault(q => q.id == categoryid.ToInt());
var sonCates = GetSonCategoryList(cate.guid, categorys);
categoryIds = sonCates.Select(q => q.id).ToList();
categoryIds.Add(categoryid.ToInt());
}
var list = _toolsRepository.GetDataList(categoryIds, ProjectId);
return new ObjectResult(list);
}
}
......
......@@ -87,7 +87,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories
}
public IEnumerable<ResponseFixtureTools> GetDataList(int categoryid, int projectid)
public IEnumerable<ResponseFixtureTools> GetDataList(List<int> categoryid, int projectid)
{
var query = from q in _context.siger_automation_fixture_tools
join p in _context.siger_automation_fixture_tools_category on q.category equals p.guid
......@@ -109,9 +109,9 @@ namespace Siger.Middlelayer.AccRepository.Repositories
status = q.status,
updatetime = q.updatetime.HasValue && q.updatetime > DateTime.MinValue ? q.updatetime.Value.ToString(ParameterConstant.DateTimeFormat) : ""
};
if (categoryid > 0)
if (categoryid.Any())
{
query = query.Where(q => q.categoryid == categoryid);
query = query.Where(q => categoryid.Contains(q.categoryid));
}
var entities = query.OrderByDescending(q => q.id).AsNoTracking().ToList();
return entities;
......
......@@ -12,7 +12,7 @@ namespace Siger.Middlelayer.AccRepository.Repositories.Interface
IPagedCollectionResult<ResponseFixtureTools> GetPagedList(List<int> category, string code, string name, int state,
int projectid, int page, int pagesize, string toexcel = "");
IEnumerable<ResponseFixtureTools> GetDataList(int categoryid, int projectid);
IEnumerable<ResponseFixtureTools> GetDataList(List<int> categoryid, int projectid);
ResponseProductFixtureInfo GetProductFixtureLocation(int projectId, string guid);
......
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