SjHkdnDAOImpl.java 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. package com.huimv.sj.dao;
  2. import java.sql.SQLException;
  3. import java.util.Date;
  4. import java.util.List;
  5. import java.util.Map;
  6. import org.springframework.orm.ibatis.SqlMapClientCallback;
  7. import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
  8. import com.huimv.busi.xt.constant.XtSqlMapConstant;
  9. import com.huimv.busi.xt.utils.DynamicDataSourceHolder;
  10. import com.huimv.sj.dataobject.SjHkdn;
  11. import com.huimv.sj.dataobject.SjHkdnExample;
  12. import com.ibatis.sqlmap.client.SqlMapExecutor;
  13. public class SjHkdnDAOImpl extends SqlMapClientDaoSupport implements SjHkdnDAO {
  14. /**
  15. * This method was generated by Apache iBATIS ibator.
  16. * This method corresponds to the database table sj_hk_dn
  17. *
  18. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  19. */
  20. public SjHkdnDAOImpl() {
  21. super();
  22. }
  23. /**
  24. * This method was generated by Apache iBATIS ibator.
  25. * This method corresponds to the database table sj_hk_dn
  26. *
  27. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  28. */
  29. public int countByExample(SjHkdnExample example) {
  30. DynamicDataSourceHolder.setRouteKey("");
  31. Integer count = (Integer) getSqlMapClientTemplate().queryForObject("sj_hk_dn.ibatorgenerated_countByExample", example);
  32. DynamicDataSourceHolder.removeRouteKey();
  33. return count;
  34. }
  35. /**
  36. * This method was generated by Apache iBATIS ibator.
  37. * This method corresponds to the database table sj_hk_dn
  38. *
  39. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  40. */
  41. public int deleteByExample(SjHkdnExample example) {
  42. int rows = getSqlMapClientTemplate().delete("sj_hk_dn.ibatorgenerated_deleteByExample", example);
  43. return rows;
  44. }
  45. /**
  46. * This method was generated by Apache iBATIS ibator.
  47. * This method corresponds to the database table sj_hk_dn
  48. *
  49. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  50. */
  51. public int deleteByPrimaryKey(Integer id) {
  52. SjHkdn key = new SjHkdn();
  53. key.setId(id);
  54. int rows = getSqlMapClientTemplate().delete("sj_hk_dn.ibatorgenerated_deleteByPrimaryKey", key);
  55. return rows;
  56. }
  57. /**
  58. * This method was generated by Apache iBATIS ibator.
  59. * This method corresponds to the database table sj_hk_dn
  60. *
  61. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  62. */
  63. public void insert(SjHkdn record) {
  64. getSqlMapClientTemplate().insert("sj_hk_dn.ibatorgenerated_insert", record);
  65. }
  66. /**
  67. * This method was generated by Apache iBATIS ibator.
  68. * This method corresponds to the database table sj_hk_dn
  69. *
  70. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  71. */
  72. public void insertSelective(SjHkdn record) {
  73. getSqlMapClientTemplate().insert("sj_hk_dn.ibatorgenerated_insertSelective", record);
  74. }
  75. /**
  76. * This method was generated by Apache iBATIS ibator.
  77. * This method corresponds to the database table sj_hk_dn
  78. *
  79. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  80. */
  81. @SuppressWarnings("unchecked")
  82. public List<SjHkdn> selectByExample(SjHkdnExample example) {
  83. DynamicDataSourceHolder.setRouteKey("");
  84. List<SjHkdn> list = getSqlMapClientTemplate().queryForList("sj_hk_dn.ibatorgenerated_selectByExample", example);
  85. DynamicDataSourceHolder.removeRouteKey();
  86. return list;
  87. }
  88. /**
  89. * This method was generated by Apache iBATIS ibator.
  90. * This method corresponds to the database table sj_hk_dn
  91. *
  92. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  93. */
  94. public SjHkdn selectByPrimaryKey(Integer id) {
  95. DynamicDataSourceHolder.setRouteKey("");
  96. SjHkdn key = new SjHkdn();
  97. key.setId(id);
  98. SjHkdn record = (SjHkdn) getSqlMapClientTemplate().queryForObject("sj_hk_dn.ibatorgenerated_selectByPrimaryKey", key);
  99. DynamicDataSourceHolder.removeRouteKey();
  100. return record;
  101. }
  102. /**
  103. * This method was generated by Apache iBATIS ibator.
  104. * This method corresponds to the database table sj_hk_dn
  105. *
  106. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  107. */
  108. public int updateByExampleSelective(SjHkdn record, SjHkdnExample example) {
  109. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  110. int rows = getSqlMapClientTemplate().update("sj_hk_dn.ibatorgenerated_updateByExampleSelective", parms);
  111. return rows;
  112. }
  113. /**
  114. * This method was generated by Apache iBATIS ibator.
  115. * This method corresponds to the database table sj_hk_dn
  116. *
  117. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  118. */
  119. public int updateByExample(SjHkdn record, SjHkdnExample example) {
  120. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  121. int rows = getSqlMapClientTemplate().update("sj_hk_dn.ibatorgenerated_updateByExample", parms);
  122. return rows;
  123. }
  124. /**
  125. * This method was generated by Apache iBATIS ibator.
  126. * This method corresponds to the database table sj_hk_dn
  127. *
  128. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  129. */
  130. public int updateByPrimaryKeySelective(SjHkdn record) {
  131. int rows = getSqlMapClientTemplate().update("sj_hk_dn.ibatorgenerated_updateByPrimaryKeySelective", record);
  132. return rows;
  133. }
  134. /**
  135. * This method was generated by Apache iBATIS ibator.
  136. * This method corresponds to the database table sj_hk_dn
  137. *
  138. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  139. */
  140. public int updateByPrimaryKey(SjHkdn record) {
  141. int rows = getSqlMapClientTemplate().update("sj_hk_dn.ibatorgenerated_updateByPrimaryKey", record);
  142. return rows;
  143. }
  144. /**
  145. * This class was generated by Apache iBATIS ibator.
  146. * This class corresponds to the database table sj_hk_dn
  147. *
  148. * @ibatorgenerated Thu Oct 27 14:01:58 CST 2016
  149. */
  150. private static class UpdateByExampleParms extends SjHkdnExample {
  151. private Object record;
  152. public UpdateByExampleParms(Object record, SjHkdnExample example) {
  153. super(example);
  154. this.record = record;
  155. }
  156. public Object getRecord() {
  157. return record;
  158. }
  159. }
  160. public Date selectHkdnMaxtimeByParam(Map<String, Object> paramMap) {
  161. DynamicDataSourceHolder.setRouteKey("");
  162. Date date = (Date) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_SELECT_HKDN_MAXTIME_BY_PARAM, paramMap);
  163. DynamicDataSourceHolder.removeRouteKey();
  164. return date;
  165. }
  166. /**
  167. * 插入地暖数据
  168. */
  169. public void insertHkdnByParam(List<SjHkdn> paramMapList) {
  170. SjHkdnSqlMapClientCallback sjHkdnSqlMapClientCallback = new SjHkdnSqlMapClientCallback();
  171. sjHkdnSqlMapClientCallback.setParamMapList(paramMapList);
  172. getSqlMapClientTemplate().execute(sjHkdnSqlMapClientCallback);
  173. }
  174. /**
  175. * 插入数据的回调类
  176. */
  177. private class SjHkdnSqlMapClientCallback implements SqlMapClientCallback {
  178. private List<SjHkdn> paramMapList;
  179. public void setParamMapList(List<SjHkdn> paramMapList) {
  180. this.paramMapList = paramMapList;
  181. }
  182. @Override
  183. public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
  184. executor.startBatch();
  185. for (SjHkdn sjHkdn : paramMapList) {
  186. executor.insert("sj_hk_dn.ibatorgenerated_insertSelective", sjHkdn);
  187. }
  188. executor.executeBatch();
  189. return null;
  190. }
  191. }
  192. @SuppressWarnings("unchecked")
  193. public List<SjHkdn> selectQcdnByParam(Map<String, Object> searchParam) {
  194. DynamicDataSourceHolder.setRouteKey("");
  195. List<SjHkdn> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_QCHKDN_BY_PARAM, searchParam);
  196. DynamicDataSourceHolder.removeRouteKey();
  197. return list;
  198. }
  199. @SuppressWarnings("unchecked")
  200. public List<SjHkdn> selectDqdnByParam(Map<String, Object> searchParam) {
  201. DynamicDataSourceHolder.setRouteKey("");
  202. List<SjHkdn> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_DQHKDN_BY_PARAM, searchParam);
  203. DynamicDataSourceHolder.removeRouteKey();
  204. return list;
  205. }
  206. @SuppressWarnings("unchecked")
  207. public List<SjHkdn> selectHkdnCgqidByParam(Map<String, Object> searchParam) {
  208. DynamicDataSourceHolder.setRouteKey("");
  209. List<SjHkdn> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_HKDN_CGQID_BY_PARAM, searchParam);
  210. DynamicDataSourceHolder.removeRouteKey();
  211. return list;
  212. }
  213. }