ibatis中模糊查询和传数组

1.模糊查询:
<select id="searorder_bynum"  parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
    <![CDATA[
        SELECT od.orderid,od.ordertime,od.telphone,od.totalprice,od.fromip,od.dispatched,od.dispatchuser FROM orders od where 1=1
    ]]>
      <dynamic prepend="">
         <isNotNull prepend=" and " property="ordernum">
               od.orderid like '%$ordernum$%'
         </isNotNull>
      </dynamic>
</select>
2.传数组时,先把值拼成以','号分隔的的字符串,传入xml文件中,然后在xml中
<update id="updateDispatch" parameterClass="java.util.HashMap">
<![CDATA[
update orders set orders.dispatched=1,orders.dispatchuser=#user# where orders.orderid in  ($orderlist$)]]>
</update>

你可能感兴趣的:(xml,ibatis)