mybatis避免sql的like注入

<select id="NotInByEvalQuestion" resultType="com.rm.eval.entity.EvalQnQuestion">
        SELECT * FROM eval_question  WHERE  1=1 and validate_flag='Y'
        <if test="title!=''and title!=null">
            and title like concat('%', #{title}, '%')
        </if>
        <if test="null != strlist and strlist.size > 0">
          and  id not in
            <foreach collection="strlist" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>

  

posted @ 2019-05-31 20:33  三号小玩家  阅读(1031)  评论(0编辑  收藏  举报
Title
三号小玩家的 Mail: 17612457115@163.com, 联系QQ: 1359720840 微信: QQ1359720840