@Query(value = "SELECT * FROM xxx" + "WHERE (:name IS NULL OR name LIKE %:name%) " + "AND (:startDate IS NULL OR create_time >= :startDate) " + "AND (:endDate IS NULL OR create_time <= :endDate) " + "ORDER BY id " + "LIMIT :start, :size", nativeQuery = true) List<xxxEntity> listxxxs(@Param("name") String name, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("start") Integer start,@Param("size") Integer size); @Query(value = "SELECT count(1) FROM xxx" + "WHERE (:name IS NULL OR name LIKE %:name%) " + "AND (:startDate IS NULL OR create_time >= :startDate) " + "AND (:endDate IS NULL OR create_time <= :endDate) ", nativeQuery = true) Integer countxxxs(@Param("name") String name, @Param("startDate") String startDate, @Param("endDate") String endDate);
07-25
1693