SELECT<include refid="Base_Column_List"/>FROMmmall_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