zoukankan      html  css  js  c++  java
  • mybatis防止sql注入

    1、资料

    http://my.oschina.net/chuibilong/blog/638950

    使用foreach标签处理 in ()的情况

    http://blog.csdn.net/gchonghavefun/article/details/8214223/

    2、实践

    List<OrderInfo> select2AllByBrands(@Param("paramBrands") List<Brand> brands,@Param("paramQuery") OrderInfo condition);

    <if test="paramBrands != null" >
    and brand.brand_id in
    <foreach collection="paramBrands" item="perBrand" open="(" close=")" separator=",">
    #{perBrand.brandId}
    </foreach>
    </if>

    <if test="paramQuery.orderAddress != null" >
    and ord.order_address like concat('%',#{paramQuery.orderAddress},'%')
    </if>
    <if test="paramQuery.shippingSn != null" >
    and brand.shipping_sn like concat('%',#{paramQuery.shippingSn},'%')
    </if>
    <if test="paramQuery.orderId != null" >
    and info.order_id like concat('%',#{paramQuery.orderId},'%')
    </if>
    <if test="paramQuery.goodsName != null" >
    and info.goods_name like concat('%',#{paramQuery.goodsName},'%')
    </if>
    <if test="paramQuery.orderPayType != null" >
    and ord.order_pay_type = #{paramQuery.orderPayType}
    </if>
    <if test="paramQuery.orderInfoState != null" >
    and info.order_info_state = #{paramQuery.orderInfoState}
    </if>
    <if test="paramQuery.startDate != null" >
    <![CDATA[and info.create_time >= #{paramQuery.startDate}]]>
    </if>
    <if test="paramQuery.endDate != null" >
    <![CDATA[and info.create_time <= #{paramQuery.endDate}]]>
    </if>

  • 相关阅读:
    谷歌浏览器禁止缩放和全面屏显示
    常用正则表达式
    封装时间函数
    年月日,时分秒,星期
    昨天,明天,月初,月末,最近七天,最近一个月,今天零时js
    React框架
    javaweb基础备忘
    一些java基础知识的备忘
    查看deepin版本
    java中堆栈的一些理解备忘
  • 原文地址:https://www.cnblogs.com/mabaishui/p/5817975.html
Copyright © 2011-2022 走看看