Commit 43f95b8e by xin.yang

fix bug

parent 7ca6b796
...@@ -116,7 +116,7 @@ namespace Siger.ApiACC.Controllers ...@@ -116,7 +116,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid); var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if(parentExsit != null) if(parentExsit != null && !string.IsNullOrEmpty(parentExsit.parent))
{ {
throw new BadRequestException(RequestEnum.LevelCountError); throw new BadRequestException(RequestEnum.LevelCountError);
} }
...@@ -201,7 +201,7 @@ namespace Siger.ApiACC.Controllers ...@@ -201,7 +201,7 @@ namespace Siger.ApiACC.Controllers
throw new BadRequestException(RequestEnum.DataExist); throw new BadRequestException(RequestEnum.DataExist);
} }
var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid); var parentExsit = _toolsAssemblyRepository.Get(q => q.projectId == ProjectId && q.son == parentGuid);
if (parentExsit != null) if (parentExsit != null && !string.IsNullOrEmpty(parentExsit.parent))
{ {
throw new BadRequestException(RequestEnum.LevelCountError); throw new BadRequestException(RequestEnum.LevelCountError);
} }
......
...@@ -320,7 +320,7 @@ namespace Siger.ApiACC.Controllers ...@@ -320,7 +320,7 @@ namespace Siger.ApiACC.Controllers
var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt()); var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt());
if(exsit == null) if(exsit == null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(RequestEnum.ParentTypeError);
} }
else else
{ {
...@@ -352,6 +352,10 @@ namespace Siger.ApiACC.Controllers ...@@ -352,6 +352,10 @@ namespace Siger.ApiACC.Controllers
public IActionResult UpdateCategory([FromBody]RequestUpdateFixtureToolsCategory req) public IActionResult UpdateCategory([FromBody]RequestUpdateFixtureToolsCategory req)
{ {
var entity = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.id); var entity = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.id);
if(entity == null)
{
throw new BadRequestException(CommonEnum.RecordNotFound);
}
var data = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.name == req.name && var data = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.name == req.name &&
q.id != req.id); q.id != req.id);
if (data != null) if (data != null)
...@@ -364,7 +368,7 @@ namespace Siger.ApiACC.Controllers ...@@ -364,7 +368,7 @@ namespace Siger.ApiACC.Controllers
var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt()); var exsit = _toolsCategoryRepository.Get(q => q.projectId == ProjectId && q.status == (int)RowState.Valid && q.id == req.parentid.ToInt());
if (exsit == null) if (exsit == null)
{ {
throw new BadRequestException(CommonEnum.RecordNotFound); throw new BadRequestException(RequestEnum.ParentTypeError);
} }
else else
{ {
......
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