BaseDaoI.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. package com.post.dao;
  2. import java.io.Serializable;
  3. import java.util.List;
  4. import java.util.Map;
  5. public interface BaseDaoI<T> {
  6. public Serializable save(T o);
  7. /**
  8. * 删除一个对象
  9. *
  10. * @param o
  11. */
  12. public void delete(T o);
  13. /**
  14. * 更新一个对象
  15. *
  16. * @param o
  17. */
  18. public void update(T o);
  19. /**
  20. * 保存或更新对象
  21. *
  22. * @param o
  23. */
  24. public void saveOrUpdate(T o);
  25. /**
  26. * 查询
  27. *
  28. * @param hql
  29. * @return
  30. */
  31. public List<T> find(String hql);
  32. /**
  33. * 查询集合
  34. *
  35. * @param hql
  36. * @param param
  37. * @return
  38. */
  39. public List<T> find(String hql, Map<String, Object> params);
  40. /**
  41. * 查询集合
  42. *
  43. * @param hql
  44. * @param param
  45. * @return
  46. */
  47. public List<T> find(String hql, List<Object> param);
  48. /**
  49. * 查询集合(带分页)
  50. *
  51. * @param hql
  52. * @param param
  53. * @param page
  54. * 查询第几页
  55. * @param rows
  56. * 每页显示几条记录
  57. * @return
  58. */
  59. public List<T> find(String hql, Map<String, Object> params, Integer page, Integer rows);
  60. /**
  61. * 查询集合(带分页)
  62. *
  63. * @param hql
  64. * @param param
  65. * @param page
  66. * @param rows
  67. * @return
  68. */
  69. public List<T> find(String hql, List<Object> param, Integer page, Integer rows);
  70. public List<T> find(String hql, Integer page, Integer rows);
  71. /**
  72. * 获得一个对象
  73. *
  74. * @param c
  75. * 对象类型
  76. * @param id
  77. * @return Object
  78. */
  79. public T get(Class<T> c, Serializable id);
  80. /**
  81. * 获得一个对象
  82. *
  83. * @param hql
  84. * @param param
  85. * @return Object
  86. */
  87. public T get(String hql, List<Object> param);
  88. /**
  89. * select count(*) from 类
  90. *
  91. * @param hql
  92. * @return
  93. */
  94. public T get(String hql, Map<String, Object> params);
  95. public Long count(String hql);
  96. /**
  97. * select count(*) from 类
  98. *
  99. * @param hql
  100. * @param param
  101. * @return
  102. */
  103. public Long count(String hql, Map<String, Object> params);
  104. /**
  105. * select count(*) from 类
  106. *
  107. * @param hql
  108. * @param param
  109. * @return
  110. */
  111. public Long count(String hql, List<Object> param);
  112. /**
  113. * 执行HQL语句
  114. *
  115. * @param hql
  116. * @return 响应数目
  117. */
  118. public Integer executeHql(String hql);
  119. /**
  120. * 执行HQL语句
  121. *
  122. * @param hql
  123. * @param param
  124. * @return 响应数目
  125. */
  126. public Integer executeHql(String hql, Map<String, Object> params);
  127. /**
  128. * 执行HQL语句
  129. *
  130. * @param hql
  131. * @param param
  132. * @return
  133. */
  134. public Integer executeHql(String hql, List<Object> param);
  135. public Double sum(String hql);
  136. public Double sum(String hql, Map<String, Object> params);
  137. public Object[] summ(String hql, Map<String, Object> params);
  138. }