我如何处理mybatis中的这个多参数问题

How do i deal with this multiple parameters issue in mybatis

我尝试使用 mabatis 的映射器编写查询,但目前无法完成

这是我的代码

String SQL_SELECTPAGE = "select b.writer, b.title, b.topicdate, b.lecturekey, b.tcontent" +
        "from (select rownum rn, a.* from (select * from topics WHERE LECTUREKEY = #{lid}" +
        "order by topicdate desc) a) b" +
        "where rn between #{c.start} and #{c.end}";

@Select(SQL_SELECTPAGE)
List<Topics> selectPage(@Param("lid") String lid, @Param("c") PaginationCriteria c);

PaginationCriteria 有开始和结束属性。

以下是 HTTP 状态 500 错误消息。我认为参数无法通过

... WHERE LECTUREKEY = ?order by topicdate desc) a) bwhere rn between ? and ? > ### Cause: java.sql.SQLSyntaxErrorException: ORA-00936:

如果有人能帮助我,我会很高兴

谢谢

您不能为行号子句使用 JDBC 绑定参数。在 MyBatis 中,任何用 #{...} 指定的都是绑定参数。基本上,您指定为 ${...} 的任何内容都是应该在这里工作的字符串替换。

所以像这样重写你的 where 子句where rn between ${c.start} and ${c.end}