SjScjfwjlDAOImpl.java 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. package com.huimv.sj.dao;
  2. import java.sql.SQLException;
  3. import java.util.List;
  4. import org.springframework.orm.ibatis.SqlMapClientCallback;
  5. import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
  6. import com.huimv.busi.xt.utils.DynamicDataSourceHolder;
  7. import com.huimv.sj.dataobject.SjHkdn;
  8. import com.huimv.sj.dataobject.SjScjfwjl;
  9. import com.huimv.sj.dataobject.SjScjfwjlExample;
  10. import com.ibatis.sqlmap.client.SqlMapExecutor;
  11. public class SjScjfwjlDAOImpl extends SqlMapClientDaoSupport implements SjScjfwjlDAO {
  12. /**
  13. * This method was generated by Apache iBATIS ibator.
  14. * This method corresponds to the database table sj_scj_fwjl
  15. *
  16. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  17. */
  18. public SjScjfwjlDAOImpl() {
  19. super();
  20. }
  21. /**
  22. * This method was generated by Apache iBATIS ibator.
  23. * This method corresponds to the database table sj_scj_fwjl
  24. *
  25. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  26. */
  27. public int countByExample(SjScjfwjlExample example) {
  28. DynamicDataSourceHolder.setRouteKey("");
  29. Integer count = (Integer) getSqlMapClientTemplate().queryForObject("sj_scj_fwjl.ibatorgenerated_countByExample", example);
  30. DynamicDataSourceHolder.removeRouteKey();
  31. return count;
  32. }
  33. /**
  34. * This method was generated by Apache iBATIS ibator.
  35. * This method corresponds to the database table sj_scj_fwjl
  36. *
  37. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  38. */
  39. public int deleteByExample(SjScjfwjlExample example) {
  40. int rows = getSqlMapClientTemplate().delete("sj_scj_fwjl.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_scj_fwjl
  46. *
  47. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  48. */
  49. public int deleteByPrimaryKey(Integer id) {
  50. SjScjfwjl key = new SjScjfwjl();
  51. key.setId(id);
  52. int rows = getSqlMapClientTemplate().delete("sj_scj_fwjl.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_scj_fwjl
  58. *
  59. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  60. */
  61. public void insert(SjScjfwjl record) {
  62. getSqlMapClientTemplate().insert("sj_scj_fwjl.ibatorgenerated_insert", record);
  63. }
  64. /**
  65. * This method was generated by Apache iBATIS ibator.
  66. * This method corresponds to the database table sj_scj_fwjl
  67. *
  68. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  69. */
  70. public void insertSelective(SjScjfwjl record) {
  71. getSqlMapClientTemplate().insert("sj_scj_fwjl.ibatorgenerated_insertSelective", record);
  72. }
  73. /**
  74. * This method was generated by Apache iBATIS ibator.
  75. * This method corresponds to the database table sj_scj_fwjl
  76. *
  77. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  78. */
  79. @SuppressWarnings("unchecked")
  80. public List<SjScjfwjl> selectByExample(SjScjfwjlExample example) {
  81. DynamicDataSourceHolder.setRouteKey("");
  82. List<SjScjfwjl> list = getSqlMapClientTemplate().queryForList("sj_scj_fwjl.ibatorgenerated_selectByExample", example);
  83. DynamicDataSourceHolder.removeRouteKey();
  84. return list;
  85. }
  86. /**
  87. * This method was generated by Apache iBATIS ibator.
  88. * This method corresponds to the database table sj_scj_fwjl
  89. *
  90. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  91. */
  92. public SjScjfwjl selectByPrimaryKey(Integer id) {
  93. DynamicDataSourceHolder.setRouteKey("");
  94. SjScjfwjl key = new SjScjfwjl();
  95. key.setId(id);
  96. SjScjfwjl record = (SjScjfwjl) getSqlMapClientTemplate().queryForObject("sj_scj_fwjl.ibatorgenerated_selectByPrimaryKey", key);
  97. DynamicDataSourceHolder.removeRouteKey();
  98. return record;
  99. }
  100. /**
  101. * This method was generated by Apache iBATIS ibator.
  102. * This method corresponds to the database table sj_scj_fwjl
  103. *
  104. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  105. */
  106. public int updateByExampleSelective(SjScjfwjl record, SjScjfwjlExample example) {
  107. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  108. int rows = getSqlMapClientTemplate().update("sj_scj_fwjl.ibatorgenerated_updateByExampleSelective", parms);
  109. return rows;
  110. }
  111. /**
  112. * This method was generated by Apache iBATIS ibator.
  113. * This method corresponds to the database table sj_scj_fwjl
  114. *
  115. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  116. */
  117. public int updateByExample(SjScjfwjl record, SjScjfwjlExample example) {
  118. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  119. int rows = getSqlMapClientTemplate().update("sj_scj_fwjl.ibatorgenerated_updateByExample", parms);
  120. return rows;
  121. }
  122. /**
  123. * This method was generated by Apache iBATIS ibator.
  124. * This method corresponds to the database table sj_scj_fwjl
  125. *
  126. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  127. */
  128. public int updateByPrimaryKeySelective(SjScjfwjl record) {
  129. int rows = getSqlMapClientTemplate().update("sj_scj_fwjl.ibatorgenerated_updateByPrimaryKeySelective", record);
  130. return rows;
  131. }
  132. /**
  133. * This method was generated by Apache iBATIS ibator.
  134. * This method corresponds to the database table sj_scj_fwjl
  135. *
  136. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  137. */
  138. public int updateByPrimaryKey(SjScjfwjl record) {
  139. int rows = getSqlMapClientTemplate().update("sj_scj_fwjl.ibatorgenerated_updateByPrimaryKey", record);
  140. return rows;
  141. }
  142. /**
  143. * This class was generated by Apache iBATIS ibator.
  144. * This class corresponds to the database table sj_scj_fwjl
  145. *
  146. * @ibatorgenerated Wed Dec 21 13:55:43 CST 2016
  147. */
  148. private static class UpdateByExampleParms extends SjScjfwjlExample {
  149. private Object record;
  150. public UpdateByExampleParms(Object record, SjScjfwjlExample example) {
  151. super(example);
  152. this.record = record;
  153. }
  154. public Object getRecord() {
  155. return record;
  156. }
  157. }
  158. /**
  159. * 插入访问数据
  160. */
  161. public void insertScjFwjlByParam(List<SjScjfwjl> paramMapList) {
  162. SjScjfwjlSqlMapClientCallback sjScjfwjlSqlMapClientCallback = new SjScjfwjlSqlMapClientCallback();
  163. sjScjfwjlSqlMapClientCallback.setParamMapList(paramMapList);
  164. getSqlMapClientTemplate().execute(sjScjfwjlSqlMapClientCallback);
  165. }
  166. /**
  167. * 插入数据的回调类
  168. */
  169. private class SjScjfwjlSqlMapClientCallback implements SqlMapClientCallback {
  170. private List<SjScjfwjl> paramMapList;
  171. public void setParamMapList(List<SjScjfwjl> paramMapList) {
  172. this.paramMapList = paramMapList;
  173. }
  174. @Override
  175. public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
  176. executor.startBatch();
  177. for (SjScjfwjl sjScjfwjl : paramMapList) {
  178. executor.insert("sj_scj_fwjl.ibatorgenerated_insertSelective", sjScjfwjl);
  179. }
  180. executor.executeBatch();
  181. return null;
  182. }
  183. }
  184. }