package com.bizzan.bitrade.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.bizzan.bitrade.dao.AndroidLogDao;
import com.bizzan.bitrade.entity.AndroidLog;
import com.querydsl.core.types.Predicate;

@Service
public class AndroidLogService {

	@Autowired
	private AndroidLogDao dao;
	
	public void save(String os, String error) {
		
		AndroidLog log = new AndroidLog();
		log.setError(error);
		log.setOs(os);
		log.setCreateTime(new Date());
		dao.save(log);
	}
	
	public AndroidLog queryById(Long id) {
		return dao.findOne(id);
	}
	
	public Page<AndroidLog> findAll(Predicate predicate, Pageable pageable) {
        return dao.findAll(predicate, pageable);
    }
}
