公共的service接口

  • package com.taotao.manager.service;  
  •   
  • import java.util.List;  
  •   
  • /** 
  •  * @author Administrator 
  •  * 
  •  * @param <T> 
  •  */  
  • public interface BaseService<T> {  
  •     public T queryById(Long Id);  
  •      List<T> queryAll();  
  •     /** 
  •      * 根据条件查询数据的条数 
  •      * @param t 
  •      * @return 
  •      */  
  •     Integer queryCountByWhere(T t);  
  •     /** 
  •      * 根据条件查询列表 
  •      * @param t 
  •      * @return 
  •      */  
  •     List<T> queryListByWheref(T t);  
  •       
  •   
  •     /** 
  •      * 根据分页查询 
  •      * @param page 页数 
  •      * @param rows 每页的行数 
  •      * @return 
  •      */  
  •     List<T> queryByPage(Integer page ,Integer rows) ;  
  •     /** 
  •      * 查询一条数据 
  •      * @return 
  •      */  
  •     T queryOne (T t);  
  •       
  •       
  •     /** 
  •      * 新增一条数据,不忽略空字段 
  •      * @param t 
  •      */  
  •     void save(T t);  
  •     /** 
  •      * 新增一条数据,忽略空字段 
  •      * @param t 
  •      */  
  •     void saveSelective(T t);  
  •       
  •       
  •     /** 
  •      * 更新,不忽略空字段。将空字段置为null 
  •      * @param t 
  •      */  
  •     void updateById(T t );  
  •     /** 
  •      * 更新,忽略空字段。 
  •      * @param t 
  •      */  
  •     void updateByIdSelective(T t );  
  •       
  •     /** 
  •      * 根据id删除一条数据 
  •      * @param id 
  •      */  
  •     void deleteById(Long id);  
  •   
  •     /** 
  •      * 根据id批量删除数据 
  •      * @param ids 
  •      */  
  •     void deleteByIds(List<Object> ids );  
  •       
  • }  
原文地址:https://www.cnblogs.com/zhangyuhang3/p/6901132.html