java基礎訪問層數據封裝

直接上代碼,


package com.mischen.pay.common.core.dao;

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

import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.SqlSessionTemplate;

import com.mischen.pay.common.core.page.PageBean;
import com.mischen.pay.common.core.page.PageParam;

/**
 * @類功能說明: 數據訪問層基礎支撐接口.
 * @類修改者:
 */
public interface BaseDao<T> {

    /**
     * 函數功能說明 :單條插入數據.
     * 
     * @參數:@param entity
     * @參數:@return
     * @return:int
     * @throws
     */
    int insert(T entity);

    /**
     * 函數功能說明 : 批量插入數據.
     * 
     * @參數:@param list
     * @參數:@return
     * @return:int
     * @throws
     */
    int insert(List<T> list);

    /**
     * 函數功能說明 :根據id單條更新數據. 
     * 
     * @參數:@param entity
     * @參數:@return
     * @return:int
     * @throws
     */
    int update(T entity);

    /**
     * 函數功能說明 : 根據id批量更新數據. 
     * 
     * @參數:@param list
     * @參數:@return
     * @return:int
     * @throws
     */
    int update(List<T> list);

    /**
     * 函數功能說明 : 根據column批量更新數據. 
     * 
     * @參數:@param paramMap
     * @參數:@return
     * @return:int
     * @throws
     */
    int update(Map<String, Object> paramMap);

    /**
     * 函數功能說明 : 根據id查詢數據.
     * 
     * @參數:@param id
     * @參數:@return
     * @return:T
     * @throws
     */
    T getById(String id);

    /**
     * 函數功能說明 : 根據column查詢數據.
     * 
     * @參數:@param paramMap
     * @參數:@return
     * @return:T
     * @throws
     */
    public T getByColumn(Map<String, Object> paramMap);

    /**
     * 根據條件查詢 listBy: <br/>
     * 
     * @param paramMap
     * @return 返回實體
     */
    public T getBy(Map<String, Object> paramMap);
    
    /**
     * 根據條件查詢列表數據.
     */
    public List<T> listBy(Map<String, Object> paramMap);

    /**
     * 函數功能說明 : 根據column查詢列表數據. 
     * 
     * @參數:@param paramMap
     * @參數:@return
     * @return:List<T>
     * @throws
     */
    public List<T> listByColumn(Map<String, Object> paramMap);

    /**
     * 函數功能說明 : 根據column查詢記錄數.
     * 
     * @參數:@param paramMap
     * @參數:@return
     * @return:Long
     * @throws
     */
    Long getCountByColumn(Map<String, Object> paramMap);

    /**
     * 函數功能說明 : 根據id刪除數據.
     * 
     * @參數:@param id
     * @參數:@return
     * @return:int
     * @throws
     */
    int delete(String id);

    /**
     * 函數功能說明 : 根據id批量刪除數據.
     * 
     * @參數:@param list
     * @參數:@return
     * @return:int
     * @throws
     */
    int delete(List<T> list);

    /**
     * 函數功能說明 : 根據column批量刪除數據. 
     * 
     * @參數:@param paramMap
     * @參數:@return
     * @return:int
     * @throws
     */
    int delete(Map<String, Object> paramMap);

    /**
     * 函數功能說明 : 分頁查詢數據 . 
     * 
     * @參數:@param pageParam
     * @參數:@param paramMap
     * @參數:@return
     * @return:PageBean
     * @throws
     */
    public PageBean listPage(PageParam pageParam, Map<String, Object> paramMap);

    public SqlSessionTemplate getSessionTemplate();

    public SqlSession getSqlSession();
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章