課程
/后端開發
/Java
/2小時學會Spring Boot
如果要復合查詢怎么實現呢?比如說有兩個條件的查詢
2017-09-15
源自:2小時學會Spring Boot 5-2
正在回答
一:在dao中Query注解 通過sql語句
public interface TaskDao extends JpaRepository<Task, Long> { ? @Query("select t from Task t where t.taskName = ? and t.createTime = ?") ?Task findByTaskName(String taskName, Date createTime); }
二:在dao中新增方法或者重寫jparepository里面的方法?
舉報
Spring Boot入門視頻教程,你將學會使用Spring Boot快速構建應用程序
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2017-09-15
一:在dao中Query注解 通過sql語句
public interface TaskDao extends JpaRepository<Task, Long> { ? @Query("select t from Task t where t.taskName = ? and t.createTime = ?") ?Task findByTaskName(String taskName, Date createTime); }
二:在dao中新增方法或者重寫jparepository里面的方法?