大于,小于,等于,大于等于,小于等于

 public List<实体类> getBetweenStartDateAndEndDate(
            Session session, int id, DateTime startDateTime, DateTime endDateTime) {
        DateTime endDate = endDateTime.plusDays(1);//查询日期必须要加1天,不然查不到今天创建的记录,要考虑23:59:59秒的问题
        StringBuffer hql = new StringBuffer(
                "FROM 实体类 WHERE poolid = '" + id + "' AND createDt >= '"
                + startDateTime.toString("yyyy-MM-dd") + "' AND createDt <'"
                + endDate.toString("yyyy-MM-dd") + "' ORDER BY id ASC");
        Query query = session.createQuery(hql.toString());
        List<实体类> cps = query.list();
        return cps;
    }

 

相关文章:

  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-06-04
  • 2022-01-23
  • 2022-12-23
  • 2021-12-28
猜你喜欢
  • 2021-12-05
  • 2022-03-07
  • 2021-12-22
  • 2022-12-23
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案