JPA的一些用法

1
2
3
4
5
6
findFirstByOrderByIdDesc() // 1.查询ID最大的一条数据,注意first后面要跟by()。
findTop5ByOrderByIdAsc() // 2. 查询top5。id从小到大排序,return list
findFirstByValidAtBeforeAndInvalidAtAfterOrderByCreatedAtDesc(Instant time1,Instant time2) //3. 查询数据在某一时间段内。
findByNameLike(String name) //4. like查询,return list
findByIdIsBetween(Integer low, Integer high) //5. 查询数据在某一范围,与3相似。return list
findByMoneyOrderByIdDesc(int money) //6.相同钱数的人,根据id排。 return list
Jie wechat
学就完事