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>

  • 相关阅读:
    Centos7 定时任务
    Linux启动配置文件和运行等级runlevel
    Linux 网卡命名规则
    将博客搬至CSDN
    Lua调用C++动态链接库.so
    使用shell脚本执行批量mongosh语句
    TCP和UDP详解
    经受时延的确认(Delay ACK)
    18张图带你了解衡量网络性能的四大指标:带宽、时延、抖动、丢包
    TCP学习
  • 原文地址:https://www.cnblogs.com/mabaishui/p/5817975.html
Copyright © 2011-2022 走看看