package com.lightinit.hsdatashow.impl;

import com.lightinit.hsdatashow.service.IMTLogService;
import org.springframework.stereotype.Service;

/**
 * Created by herbert on 2017/10/20.
 */
@Service
public class MTLogServiceImpl implements IMTLogService {

    /*@Autowired
    private MongoTemplate mtlogMongoTemplate;

    public List<MTLogInfo> QueryLogList(String dateStr, String keywords, int page, int rows) {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
        String tbName = "Nlog" + dateStr;
        Query query = new Query();
        if (keywords.isEmpty() == false) {
            Pattern pattern=Pattern.compile(".*?"+keywords+".*");
            query.addCriteria(Criteria.where("Message").regex(pattern));
        }
        query.skip((page-1)*rows);
        query.limit(rows);
        return mtlogMongoTemplate.find(query, MTLogInfo.class, tbName);
    }

    public long QueryLogCount(String dateStr, String keywords) {

        SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
        String tbName = "Nlog" + dateStr;
        Query query = new Query();
        if (keywords.isEmpty() == false) {
            Pattern pattern=Pattern.compile(".*?"+keywords+".*");
            query.addCriteria(Criteria.where("Message").regex(pattern));
        }
        return mtlogMongoTemplate.count(query, MTLogInfo.class, tbName);
    }*/
}
