| | |
| | | public ResponseResult saveElement(String groupId, ElementCreateDTO elementCreate) { |
| | | boolean saveElement = groupElementService.saveElement(groupId, elementCreate); |
| | | if (!saveElement) { |
| | | return ResponseResult.error("Failed to save the element."); |
| | | return ResponseResult.error("保存元素失败"); |
| | | } |
| | | |
| | | // save coordinate |
| | |
| | | elementCreate.getResource().getContent().getGeometry().convertToList(), elementCreate.getId()); |
| | | |
| | | return saveCoordinate ? |
| | | ResponseResult.success() : ResponseResult.error("Failed to save the coordinate."); |
| | | ResponseResult.success() : ResponseResult.error("保存坐标失败"); |
| | | } |
| | | |
| | | |
| | |
| | | public ResponseResult updateElement(String elementId, ElementUpdateDTO elementUpdate, String username) { |
| | | boolean updElement = groupElementService.updateElement(elementId, elementUpdate, username); |
| | | if (!updElement) { |
| | | return ResponseResult.error("Failed to update the element."); |
| | | return ResponseResult.error("更新元素失败"); |
| | | } |
| | | |
| | | // delete all coordinates according to element id. |
| | |
| | | elementUpdate.getContent().getGeometry().convertToList(), elementId); |
| | | |
| | | return delCoordinate && saveCoordinate ? |
| | | ResponseResult.success() : ResponseResult.error("Failed to update the coordinate."); |
| | | ResponseResult.success() : ResponseResult.error("更新坐标失败"); |
| | | } |
| | | |
| | | @Override |
| | | public ResponseResult deleteElement(String elementId) { |
| | | boolean delElement = groupElementService.deleteElement(elementId); |
| | | if (!delElement) { |
| | | return ResponseResult.error("Failed to delete the element."); |
| | | return ResponseResult.error("删除元素失败"); |
| | | } |
| | | |
| | | // delete all coordinates according to element id. |
| | | boolean delCoordinate = elementCoordinateService.deleteCoordinateByElementId(elementId); |
| | | |
| | | return delCoordinate ? |
| | | ResponseResult.success() : ResponseResult.error("Failed to delete the coordinate."); |
| | | ResponseResult.success() : ResponseResult.error("删除坐标失败"); |
| | | } |
| | | |
| | | @Override |