我用自定义删除方法编写了以下存储库,但我不知道如何使用REST访问它。
@RepositoryRestResource(collectionResourceRel = "carriers", path = "carriers")
public interface CarrierRepository extends PagingAndSortingRepository<CarrierEntity, Integer> {
@PreAuthorize("hasAnyRole('CUSTOMER') && #customerId == principal.customerId")
void deleteByIdAndCustomerId(
@RequestParam(name = "id", defaultValue = "") @Param("id") Integer id,
@RequestParam(name = "customerId", defaultValue = "") @Param("customerId") Integer customerId);
}
我检查了阿尔卑斯山的概况,并说它的暴露如下:
{
"name": "deleteByIdAndCustomerId",
"type": "SAFE",
"descriptors": [
{
"name": "id",
"type": "SEMANTIC"
},
{
"name": "customerId",
"type": "SEMANTIC"
}
]
}