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

jpa 相关的sql

上一篇:MySQL 批量删除表


下一篇:navicat连接另一台电脑上的mysql服务器报错1130 - Host '10.50.22.167' is not allowed to connect this mysql server