总Dao中封装了很多常用的增删改查方法,比如deleteByProperties、getByProerties、queryByProerties、updateByProper,如下:
package core.dao;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.hibernate.Session;
import com.huanke.bean.Pager;
import core.support.BaseParameter;
import core.support.QueryResult;
public interface Dao
{
public Session getSession();
/**
* 彻底清除会话
*/
public void clear();
/**
* 查询出对象实体的所有数目
*
* @return 返回对象实体所有数目
*/
public Long countAll();
/**
* 删除对象实体
*
* @param entity
* 对象实体
*/
public void delete(E entity);
/**
* 根据多个id参数删除对象
*
* @param id
* 多个id,以英文逗号隔开
* @return 返回true或者false
*/
public boolean deleteByPK(Serializable... id);
/**
* 以HQL的方式,根据单个属性删除对象实体
*
* @param propName
* 属性名称
* @param propValue
* 属性值
*/
public void deleteByProperties(String propName, Object propValue);
/**
* 以HQL的方式,根据多个属性删除对象实体
*
* @param propName
* 属性名称
* @param propValue
* 属性值
*/
public void deleteByProperties(String[] propName, Object[] propValue);
/**
* 根据各种查询条件返回对象实体数目
*
* @param parameter
* 各种查询条件
* @return 返回对象实体数目
*/
public Long doCount(BaseParameter parameter);
/**
* 根据各种查询条件返回分页列表
*
* @param parameter
* 各种查询条件
* @return 返回分页列表
*/
public QueryResult
doPaginationQuery(BaseParameter parameter);
/**
* 根据各种查询条件返回分页列表
*
* @param parameter
* 各种查询条件
* @param bool
* 默认为true;如果为false,增加属性是否为空等查询条件
* @return 返回分页列表
*/
public QueryResult
doPaginationQuery(BaseParameter parameter, boolean bool);
/**
* 根据各种查询条件返回对象实体列表
*
* @param parameter
* 各种查询条件
* @return 返回对象实体列表
*/
public List
doQuery(BaseParameter parameter);
/**
* 查询出所有的对象实体列表
*
* @return 返回对象实体列表
*/
public List
doQueryAll(); /** * 根据要返回的记录数目查询出对象实体列表 * * @param top * 要返回的记录数目 * @return 返回对象实体列表 */ public List
doQueryAll(Integer top); /** * 根据排序条件和要返回的记录数目查询出对象实体列表 * * @param sortedCondition * 排序条件 * @param top * 要返回的记录数目 * @return 返回对象实体列表 */ public List
doQueryAll(Map
sortedCondition, Integer top); /** * 邹猛 doQueryByInMethods(这里用一句话描述这个方法的作用) 用in方法的查询 * * @param param * @return List
* @exception @since * 1.0.0 */ public List
doQueryByInMethods(BaseParameter param); /** * 从会话缓存中删除此对象实体 * * @param entity * 待删除的对象实体 */ public void evict(E entity); /** * 根据ID立即加载持久化对象实体 * * @param id * ID值 * @return 返回对象实体 */ public E get(Serializable id); /** * 根据属性获取单个对象实体 * * @param propName * 属性名称 * @param propValue * 属性值 * @return 返回对象实体 */ public E getByProerties(String propName, Object propValue); /** * 根据属性和排序条件获取单个对象实体 * * @param propName * 属性名称 * @param propValue * 属性值 * @param sortedCondition * 排序条件 * @return 返回对象实体 */ public E getByProerties(String propName, Object propValue, Map
sortedCondition); /** * 根据属性数组获取单个对象实体 * * @param propName * 属性数组名称 * @param propValue * 属性数组值 * @return 返回对象实体 */ public E getByProerties(String[] propName, Object[] propValue); /** * 根据属性数组和排序条件获取单个对象实体 * * @param propName * 属性数组名称 * @param propValue * 属性数组值 * @param sortedCondition * 排序条件 * @return 返回对象实体 */ public E getByProerties(String[] propName, Object[] propValue, Map
sortedCondition); /** * 邹猛 getMaxId(这里用一句话描述这个方法的作用) 获取订单号种子id最大值 * * @return Long * @exception @since * 1.0.0 */ public Long getMaxId(); /** * 根据查询条件获取相应表的数据 KevinCui * * @param tableName * 表名 * @param columns * 列名(如果有多个,则中间用英文半角逗号分隔) * @param condition * 查询条件片断 * @return 操作成功返回集合,否则返回Null。 */ public List