mybati,if test里条件须用and or 连接

如 <if test="offset != null and rows != null">

 

<select id="getsLog" parameterType="java.util.Map"
resultType="OrdersLogInfo">
SELECT * FROM orderslog
<where>
<if test="ordersid != null">
AND ordersid = #{ordersid}
</if>
<if test="type != null">
AND type = #{type}
</if>
</where>
ORDER BY id ASC
<if test="offset != null and rows != null">
LIMIT #{offset}, #{rows}
</if>
</select>

posted @ 2021-03-09 11:02  liness0713  阅读(1478)  评论(0编辑  收藏  举报