package com.zhiwei.manage.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Component;

import com.zhiwei.manage.bean.CrawTemplate;
@Component
public class CrawTemplateDaoImpl implements CrawTemplateDao{

	@Resource(name="newmongoTemplate")
	private MongoTemplate mongo;
	
	@Override
	public List<CrawTemplate> findAll() {
		return mongo.findAll(CrawTemplate.class);
	}

	@Override
	public String getSpIdByConfigName(String tempName) {
		return mongo.findOne(Query.query(Criteria.where("configName").is(tempName)), CrawTemplate.class).getId();
	}

}
