<select id="queryBidInfos" parameterType="String" resultType="BidInfo"> select * from bidInfo <where> <if test="bids != 'null'"> bid in (${bids}) </if> <if test="pids != 'null'"> and pid in (${pids}) </if> </where> </select>
参数(bids和pids)类型为String,在判断参数是否为空时,若在下划线部分为"pids != null" 或" pids != '' "的时候都无法达到理想效果,可以修改为 pids != 'null' 试试