NutzCN Logo
问答 Cnd 怎么拼接时间条件语句呢
发布于 2332天前 作者 lalala 1767 次浏览 复制 上一个帖子 下一个帖子
标签:
 int sendCount = smsRecordService.count(Cnd.where("sendPhone", "=", phone));

然后我在接一个语句判断发送时间是否在今天, 这样子要怎么写啊,大佬

2 回复

用between比较好

好了嘻嘻嘻

 int sendCount = smsRecordService.count(Cnd.where("sendPhone", "=", phone).
                    and("sendTime","between",new Object[]{DateUtil.getQueryTimeByStart(),DateUtil.getQueryTimeByEnd()}));

public  static String getQueryTimeByStart(){
        return  getDate()+" 00:00:00";
    }

    public  static String getQueryTimeByEnd(){
        return  getDate()+" 23:59:59";
    }

    public static String getDate() {
        return getDate("yyyy-MM-dd");
    }
添加回复
请先登陆
回到顶部