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);
        }

  • 相关阅读:
    忍道
    2020.12.27
    2020.12.26
    2020.12.25
    记录
    卸载抖音
    汉化报告修改配置文件
    tcp校验client客户端的合法性
    tcp连接发送命令客户端接收后返回结果给服务端
    logging模块
  • 原文地址:https://www.cnblogs.com/attilax/p/15199232.html
Copyright © 2011-2022 走看看