BaseService.java 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. package com.huimv.busi.xt.model;
  2. import java.sql.SQLException;
  3. import java.util.Date;
  4. import java.util.List;
  5. import java.util.Map;
  6. /**
  7. * 基础业务接口定义
  8. * @author hongjun.hu
  9. * @version 1.0
  10. */
  11. public interface BaseService {
  12. /**
  13. * 单表操作:根据动态条件记数记录集
  14. * @param nameSpace
  15. * @param example
  16. * @return
  17. * @throws SQLException
  18. */
  19. int countByExample(String nameSpace, Object example) throws SQLException;
  20. /**
  21. * 数据删除
  22. * @param sqlMapId sqlMapId
  23. * @param parameterObject parameterObject
  24. * @return 删除返回
  25. * @throws SQLException
  26. */
  27. public int delete(String sqlMapId, Object parameterObject)
  28. throws SQLException;
  29. /**
  30. * 单表操作:根据动态条件删除记录集
  31. * @param nameSpace nameSpace
  32. * @param example example
  33. * @return 删除返回
  34. * @throws SQLException
  35. */
  36. public int deleteByExample(String nameSpace, Object example)
  37. throws SQLException;
  38. /**
  39. * 单表操作:根据主键删除记录集
  40. * @param nameSpace
  41. * @param id
  42. * @return
  43. * @throws SQLException
  44. */
  45. public int deleteByPrimaryKey(String nameSpace, Long id)
  46. throws SQLException;
  47. public Date getCurrentDate() throws Exception;
  48. /** ************************手动sql操作******************************** */
  49. /**
  50. * 数据插入
  51. * @param sqlMapId
  52. * @param parameterObject
  53. * @return
  54. * @throws SQLException
  55. */
  56. public Object insert(String sqlMapId, Object parameterObject)
  57. throws SQLException;
  58. /** ************************ibator 单表sql操作******************************** */
  59. /**
  60. * 单表操作:插入记录集
  61. * @param nameSpace
  62. * @param record
  63. * @throws SQLException
  64. */
  65. void insertRecord(String nameSpace, Object record) throws SQLException;
  66. /**
  67. * 数据查询并返回全部列表
  68. * @param sqlMapId
  69. * @param parameterObject
  70. * @param resultObject
  71. * @return
  72. * @throws SQLException
  73. */
  74. @SuppressWarnings("rawtypes")
  75. public List queryForList(String sqlMapId, Object parameterObject)
  76. throws SQLException;
  77. /**
  78. * 数据查询并返回指定记录集大小的一个列表
  79. * @param sqlMapId
  80. * @param parameterObject
  81. * @param skipResults - 记录位移量
  82. * @param maxResults - 记录集大小
  83. * @return
  84. * @throws SQLException
  85. */
  86. @SuppressWarnings("rawtypes")
  87. public List queryForList(String sqlMapId, Object parameterObject,
  88. int skipResults, int maxResults) throws SQLException;
  89. /**
  90. * 数据查询并返回指定指keyProperty的一个Map对象
  91. * @param sqlMapId
  92. * @param parameterObject
  93. * @param keyProperty - Map key
  94. * @return
  95. * @throws SQLException
  96. */
  97. public Map<Object, Object> queryForMap(String sqlMapId, Object parameterObject,
  98. String keyProperty) throws SQLException;
  99. /**
  100. * 数据查询并返回指定keyProperty和valueProperty的一个Map对象
  101. * @param sqlMapId
  102. * @param parameterObject
  103. * @param keyProperty
  104. * @param valueProperty
  105. * @return
  106. * @throws SQLException
  107. */
  108. public Map<Object, Object> queryForMap(String sqlMapId, Object parameterObject,
  109. String keyProperty, String valueProperty) throws SQLException;
  110. /**
  111. * 数据查询并返回一个对象
  112. * @param sqlMapId
  113. * @param parameterObject
  114. * @return
  115. * @throws SQLException
  116. */
  117. public Object queryForObject(String sqlMapId, Object parameterObject)
  118. throws SQLException;
  119. /**
  120. * 数据查询并返回指定的对象
  121. * @param sqlMapId
  122. * @param parameterObject
  123. * @param resultObject
  124. * @return
  125. * @throws SQLException
  126. */
  127. public Object queryForObject(String sqlMapId, Object parameterObject,
  128. Object resultObject) throws SQLException;
  129. /**
  130. * 单表操作:根据条件动态查询记录集
  131. * @param nameSpace
  132. * @param example
  133. * @return
  134. * @throws SQLException
  135. */
  136. public List<Object> selectByExample(String nameSpace, Object example)
  137. throws SQLException;
  138. /**
  139. * 单表操作:根据主键查询记录集
  140. * @param nameSpace nameSpace
  141. * @param id id
  142. * @return Object
  143. * @throws SQLException
  144. */
  145. public Object selectByPrimaryKey(String nameSpace, Long id)
  146. throws SQLException;
  147. /**
  148. * 数据更新
  149. * @param sqlMapId sqlMapId
  150. * @param parameterObject parameterObject
  151. * @return int
  152. * @throws SQLException
  153. */
  154. public int update(String sqlMapId, Object parameterObject)
  155. throws SQLException;
  156. /**
  157. * 单表操作:根据主键更新记录集
  158. * @param nameSpace nameSpace
  159. * @param record record
  160. * @return int int
  161. * @throws SQLException
  162. */
  163. public int updateByPrimaryKey(String nameSpace, Object record)
  164. throws SQLException;
  165. /**
  166. * 单表操作:根据主键更新记录集
  167. * @param nameSpace nameSpace
  168. * @param record record
  169. * @return int int
  170. * @throws SQLException
  171. */
  172. public int updateByPrimaryKeySelective(String nameSpace, Object record)
  173. throws SQLException;
  174. }