首页 > 数据库技术 > 详细

jpa 相关的sql

时间:2021-05-14 15:31:05      阅读:20      评论:0      收藏:0      [点我收藏+]

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

原文:https://www.cnblogs.com/zxy-come-on/p/14767847.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!