SjHkyqDAOImpl.java 7.8 KB

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