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

猜你喜欢

转载自www.cnblogs.com/notchangeworld/p/12028072.html