Spring CrudRepository findByInventoryIds(List inventoryIdList) - equivalent to IN clause

后端 未结 3 574
执念已碎
执念已碎 2020-11-29 17:35

In Spring CrudRepository, do we have support for \"IN clause\" for a field? ie something similar to the following?

 findByInventoryIds(List inve         


        
3条回答
  •  有刺的猬
    2020-11-29 17:49

    findByInventoryIdIn(List inventoryIdList) should do the trick.

    The HTTP request parameter format would be like so:

    Yes ?id=1,2,3
    No  ?id=1&id=2&id=3
    

    The complete list of JPA repository keywords can be found in the current documentation listing. It shows that IsIn is equivalent – if you prefer the verb for readability – and that JPA also supports NotIn and IsNotIn.

提交回复
热议问题