package com.yihu.wlyy.service.app.health;

import com.yihu.wlyy.entity.education.FoodComp;
import com.yihu.wlyy.entity.education.HealthNews;
import com.yihu.wlyy.repository.education.FoodCompDao;
import com.yihu.wlyy.repository.education.HealthNewsDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter.Operator;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 食物健康热量服务类
 * @author George
 *
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class FoodCompService extends BaseService {

	@Autowired
	private FoodCompDao foodCompDao;

	public List<FoodComp> getByPid(Long pid){
		return foodCompDao.findByPid(pid);
	}

	public FoodComp getById(Long id){
		return foodCompDao.findById(id);
	}

	public List<FoodComp> getByName(String name){
		return foodCompDao.findByName("%"+name+"%");
	}

}
