在不使用复杂对象的情况下将多个参数传递给SELECT [英] Passing multiple arguments into a SELECT without using a complex object

查看:66
本文介绍了在不使用复杂对象的情况下将多个参数传递给SELECT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将startSequenceIdstopSequenceIdorderNumber传递到SQL映射中,但是,我不想使用类型化的对象,即parameterType="com.abc.Order",我可以这样做吗?

I am trying to pass in startSequenceId, stopSequenceId, orderNumber into the SQL map, however, i don't wish to use a typed object, i.e. parameterType="com.abc.Order", can i do so?

<select id="getSequenceIdByOrderNumber" parameterType="?" resultType="int">
    select *
    from log
    where seq_id
    between #{startSequenceId} and #{stopSequenceId}
    and order_no = #{orderNumber}
    and rownum = 1
</select>

推荐答案

@Chin我将通过一个简单的示例发布我无论如何键入的内容,尽管您找到了要查找的内容.我使用iBatis 2.3.4的示例

@Chin I'll post what I had typed anyway with a simple example though you found what your looking for. My example using iBatis 2.3.4

<select id="retrieveTestXXX" parameterClass="java.util.Map" resultClass="java.lang.Integer">
    SELECT
    example_table.id
    FROM example_table
    WHERE example_table.xx_id = #testId# AND example_table.xx_id = #test2Id#
</select>

希望这会有所帮助.

这篇关于在不使用复杂对象的情况下将多个参数传递给SELECT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆