mybatits的if有多个判断条件
1个回答
2016-12-18 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517181
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
举个正确列子给大家参考,以下是用map来进行传递过个参数做条件判断
<select id="findod" parameterType="java.util.Map" resultMap="odMap">
select * from order_day where 1 = 1
<if test="start != null and start != ''">
and date >= #{start}
</if>
<if test="end != null and end != ''">
and #{end} > date
</if>
<if test="appid != null and appid != ''">
and appid=${appid}
</if>
<if test="operators != null and operators != ''">
and operators=${operators}
</if>
limit ${Page.startPos},${Page.pageSize};
</select>
<select id="findod" parameterType="java.util.Map" resultMap="odMap">
select * from order_day where 1 = 1
<if test="start != null and start != ''">
and date >= #{start}
</if>
<if test="end != null and end != ''">
and #{end} > date
</if>
<if test="appid != null and appid != ''">
and appid=${appid}
</if>
<if test="operators != null and operators != ''">
and operators=${operators}
</if>
limit ${Page.startPos},${Page.pageSize};
</select>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询