Spring DATA JPA 中findAll 进行OrderBy

需要在 repository 中 定义这样的方法 :findAllByOrderByUpdatedAtDesc()

public List findAllByOrderByUpdatedAtDesc();

重要:(中间要多加一个By

findAllByOrderByUpdatedAtDesc();

The little ‘By’ does all the magic.

猜你喜欢

转载自blog.csdn.net/qq_37859539/article/details/82766442