サーバーからデータを取得するために、注釈を介して myBatis を使用しています。n日前のデータを取得しようとすると、注釈:
@Select("SELECT o.title from user_order o where current_date - date_trunc('day', o.dateoforder) < '#{n} days'")
ArrayList<OrderRecord> getOrderHistory(@Param("n") int n);
エラーを返します:
列インデックスが範囲外です: 1、列数: 0。データベースのクエリ中にエラーが発生しました。原因: org.postgresql.util.PSQLException: 列インデックスが範囲外です: 1、列数: 0。
また、
@Select("SELECT o.title from user_order o where current_date - date_trunc('day', o.dateoforder) < #{n}")
ArrayList<OrderRecord> getOrderHistory(@Param("n") String n);
nが「5日」のような場合、同様のエラーが発生します。
どのようなデータ型が期待されていますか?
私はPostgreSQLを使用しています。