BaseService.java 1.21 KB
package com.bsth.service;

import java.io.Serializable;
import java.util.Map;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

/**
 * 
 * @ClassName: BaseService 
 * @Description: TODO(基础的Service接口) 
 * @author PanZhao 
 * @date 2016年3月17日 下午12:48:43 
 * 
 * @param <T>
 * @param <ID>
 */
public interface BaseService<T, ID extends Serializable> {
	/**
	 * 根据主键获取单个对象
	 * @param id
	 * @return
	 */
	T findById(ID id);
	
	/**
	 * 保存
	 * @param t
	 * @return
	 */
	Map<String, Object> save(T t);
	
	/**
	 * 
	 * @Title: list 
	 * @Description: TODO(多条件分页查询) 
	 * @param @param map 查询条件
	 * @param @param pageable 分页对象
	 * @throws
	 */
	Page<T> list(Map<String, Object> map, Pageable pageable);
	
	/**
	 * 
	 * @Title: list 
	 * @Description: TODO(多条件查询) 
	 * @throws
	 */
	Iterable<T> list(Map<String, Object> map);
	
	/**
	 * 获取所有
	 * @return
	 */
	Iterable<T> findAll();
	
	/**
	 * 
	 * @Title: deleteById 
	 * @Description: TODO(根据主键删除对象) 
	 * @param @param id
	 * @throws
	 */
	Map<String, Object> delete(ID id);
}