jpa 相关的sql

1.查询:

@Query(value = "select * from system_action sa where sa.parent_id = ?1 order by parent_id,index_of", nativeQuery = true)
public List<SystemAction> findAllByParentIdOrderByIndexOf(Long parentId);

2.修改:

@Modifying@Query(value = "UPDATE system_action AS per JOIN system_action AS b ON (per.`id` = ?1 AND b.`id` = ?2) SET per.`index_of` = b.`index_of`, b.`index_of` = per.`index_of`", nativeQuery = true)public void swapSort(Long currentId, Long swapId);
2.统计:

public int countByName(String name);

posted @ 2021-05-14 11:24  星空物语之韵  阅读(89)  评论(0编辑  收藏  举报