mybatis sql语句转化

SELECT
<include refid="Base_Column_List"/>
FROM
mmall_product
<where>
<if test="productName != null">
and name=#{productName}
</if>
<if test="productId">
and id=#{productId}
</if>
</where>
<where>标签对作用:如果where标签下的if标签成立,则将成立的第一个if标签下的and或or转为 where
posted @ 2018-05-19 22:40  Dar_Alpha  阅读(741)  评论(0编辑  收藏  举报