SjHklhqDAOImpl.java 7.7 KB

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