jpa前端分页参数传递和定制返回属性

前端定制分页参数

&startTime=2019-02-01 12:21:12&endTime=2020-04-01 12:21:12&page=2&size=2&sort=createDate,desc&sort=id,desc

 controller参数

@PageableDefault(page = 0, value = 6, sort = {"sendTime"}, direction = Sort.Direction.DESC

定制返回属性

  @Query(nativeQuery = false,value = " select new Map(entityId,sendTime) from GpsInfo a where a.simNo=?1 and a.sendTime between ?2 and ?3")
    public Page<Map> findBySimNoAndSendTimeBetween(String simNo,Date startTime, Date endTime,Pageable pageable);

相关推荐