nutz sql

Cnd cnd = Cnd.where("user_id", "=", userId)
                .and("current_id", "=", currentLineId)
                .and("device_id", "=", deviceId)
                .and("status","=",1);
        if (startTime != null && startTime.length()!=0) {
            cnd = cnd.and("createTime", ">", simpleDateFormat.parse(startTime).getTime());
        }
        if (endTime != null && endTime.length()!=0) {
            cnd = cnd.and("createTime", "<", simpleDateFormat.parse(endTime).getTime());
        }
    //二选一,就是传进来的是ip或者是src_ip
if (ipOrSrcIp != null && ipOrSrcIp.length()!=0) { SqlExpressionGroup sqlExpressionGroup = new SqlExpressionGroup(); sqlExpressionGroup.or("src_ip", "like", "%" + ipOrSrcIp + "%") .or("ip", "like", "%" + ipOrSrcIp + "%"); cnd.and(sqlExpressionGroup); }
posted @ 2019-12-12 11:14  忧伤还是快乐EL  阅读(287)  评论(0编辑  收藏  举报