我关注了博客,并且能够在我的自定义 OData 服务上执行创建、读取和更新操作,但我无法找到任何用于删除操作的博客/文档。请帮忙。
问问题
72 次
1 回答
2
没有专门针对自定义 OData 服务执行删除操作的博客文章,但我们建议您遵循以下模式:
public class DeleteAddressCommand extends ErpCommand<Integer> {
private static final Logger logger = CloudLoggerFactory.getLogger(DeleteAddressCommand.class);
private final BusinessPartnerService service;
private final String businessPartnerId;
private final String addressId;
public DeleteAddressCommand(final BusinessPartnerService service,
final String businessPartnerId, final String addressId) {
super(HystrixUtil.getDefaultErpCommandSetter(
DeleteAddressCommand.class,
HystrixUtil.getDefaultErpCommandProperties().withExecutionTimeoutInMilliseconds(10000)));
this.service = service;
this.businessPartnerId = businessPartnerId;
this.addressId = addressId;
}
@Override
protected Integer run() throws Exception {
final BusinessPartnerAddress addressToDelete = BusinessPartnerAddress.builder()
.businessPartner(businessPartnerId)
.addressID(addressId)
.build();
final ODataDeleteResult oDataDeleteResult = service
.deleteBusinessPartnerAddress(addressToDelete)
.execute();
return oDataDeleteResult.getHttpStatusCode();
}
}
我粘贴了这个官方示例中的代码
最好的祝愿弗洛里安
于 2019-02-28T12:36:05.570 回答