@Query使用Pageable 进行分页查询排序
Pageable:Pageable pageable = new PageRequest(pageNo-1,pageSize,sort);
Sort:Sort.Order order = new Sort.Order(Sort.Direction.DESC,"createdTime");Sort sort = new Sort(order);
@Query(value = "SELECT * from PrpLorderTaskInfo t where t.assistorCode = :userCode and ( t.registNo " +
"like %:registNo% or t.licenseNo like %:registNo% )
-- #pageable
",//
-- #pageable
固定格式引入pageable
countQuery = "SELECT COUNT(1) FROM PrpLorderTaskInfo t where t.assistorCode = :userCode and ( t.registNo " +
"like %:registNo% or t.licenseNo like %:registNo%)" ,nativeQuery=true)
Page<PrpLorderTaskInfo> findByUserCodeRegistNo(@Param("registNo") String registNo,@Param("userCode") String userCode, Pageable pageable);
@Query查询条目
@Query(value = "SELECT COUNT(t.id) FROM PrpLorderTaskInfo t where t.assistorCode = :userCode and t.receiveTime >= to_date(:date,'YYYY/MM/DD')")
int countByAssistorCodeMonth(@Param("userCode")String userCode,@Param("date") String date);