zoukankan      html  css  js  c++  java
  • paip.取当天记录的方法sql跟hql hibernate



    paip.取当天记录的方法sql跟hql hibernate

    #------两个方法...函数法和日期计算法..
    函数法: DATEDIFF(d,createTime,GETDATE())=0   //d指定为day
    hb也有一样的函数..
    日期 计算法: where  createTime>='2014-5-4 00:00:01' and createTime<='2014-5-4 23:59:59'
    where  createTime='2014-5-4 00:00:00'

    应该优先使用日期 计算法,,因为这个方法能使用索引了...不个日期时间转换为long数字...

    作者 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com
    转载请注明来源: http://blog.csdn.net/attilax

    #-----如下
        public AwardWeixin todayJoinRecode(String uid, String actid) {
            // 下午12:53:37 2014-4-30
            Session session = getSession();
            String hql = "from AwardWeixin where activityId = ? and openid=? and createtime=?";
            List<AwardWeixin> awardList = null;
            Query q = session.createQuery(hql);
            q.setParameter(0, actid);
            q.setParameter(1, uid);
            q.setParameter(2, DateUtil.today_notime());
            awardList = q.list();

            // if (awardList.size() == 0) // new user add 3tsi
            // {}
            // System.out.println(awardList.size());
            return awardList.get(0);
        }

  • 相关阅读:
    HDR算法(一)
    机器视觉话题入门资料---能看懂大致原理再去纠细节
    WRT callback
    dependency of static library
    dll 和 lib--初级
    memory corruption
    Python~函数的参数
    Python~函数
    Python~if,while,for~顺序,判断,循环
    Python~list,tuple^_^dict,set
  • 原文地址:https://www.cnblogs.com/attilax/p/5963988.html
Copyright © 2011-2022 走看看