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);