zoukankan      html  css  js  c++  java
  • MySQL、mybatis的查询条件-时间段

    1.配置文件中的写法

    <if test="startTime !=null and startTime !='' ">
             <![CDATA[ and createTime  >=  #{startTime}  ]]>
        </if>
        <if test="endTime !=null and endTime!='' "  >
             <![CDATA[ and createTime <=  #{endTime}  ]]>
        </if>

    2.Java代码中参数的传递

    》实体类中的成员变量

    private Date startTime;

    private Date endTime;

    entity.setStartTime(startTime);
    entity.setEndTime(endTime);

    》使用map集合封装参数

    Map<String, Object> map = new HashMap<String, Object>();
    map.put("startTime", startTime);
    map.put("endTime", endTime);

    IT技术和行业交流群 417691667

  • 相关阅读:
    es6
    vue-router
    vue-lazyload
    java-number2
    echart事件
    weui了解
    java-number
    Java判断语句
    java 循环控制
    The access type for the readers of the blog.
  • 原文地址:https://www.cnblogs.com/sun-rain/p/5762982.html
Copyright © 2011-2022 走看看