XtYxcsYaDAOImpl.java 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. package com.huimv.xt.dao;
  2. import com.huimv.xt.dataobject.XtYxcsYa;
  3. import com.huimv.xt.dataobject.XtYxcsYaExample;
  4. import com.ibatis.sqlmap.client.SqlMapExecutor;
  5. import java.sql.SQLException;
  6. import java.util.List;
  7. import org.springframework.orm.ibatis.SqlMapClientCallback;
  8. import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
  9. public class XtYxcsYaDAOImpl extends SqlMapClientDaoSupport implements XtYxcsYaDAO {
  10. /**
  11. * This method was generated by Apache iBATIS ibator.
  12. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  13. *
  14. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  15. */
  16. public XtYxcsYaDAOImpl() {
  17. super();
  18. }
  19. /**
  20. * This method was generated by Apache iBATIS ibator.
  21. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  22. *
  23. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  24. */
  25. public int countByExample(XtYxcsYaExample example) {
  26. Integer count = (Integer) getSqlMapClientTemplate().queryForObject("xt_hk_yxcs_bys_ya.ibatorgenerated_countByExample", example);
  27. return count;
  28. }
  29. /**
  30. * This method was generated by Apache iBATIS ibator.
  31. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  32. *
  33. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  34. */
  35. public int deleteByExample(XtYxcsYaExample example) {
  36. int rows = getSqlMapClientTemplate().delete("xt_hk_yxcs_bys_ya.ibatorgenerated_deleteByExample", example);
  37. return rows;
  38. }
  39. /**
  40. * This method was generated by Apache iBATIS ibator.
  41. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  42. *
  43. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  44. */
  45. public int deleteByPrimaryKey(Integer id) {
  46. XtYxcsYa key = new XtYxcsYa();
  47. key.setId(id);
  48. int rows = getSqlMapClientTemplate().delete("xt_hk_yxcs_bys_ya.ibatorgenerated_deleteByPrimaryKey", key);
  49. return rows;
  50. }
  51. /**
  52. * This method was generated by Apache iBATIS ibator.
  53. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  54. *
  55. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  56. */
  57. public void insert(XtYxcsYa record) {
  58. getSqlMapClientTemplate().insert("xt_hk_yxcs_bys_ya.ibatorgenerated_insert", record);
  59. }
  60. /**
  61. * This method was generated by Apache iBATIS ibator.
  62. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  63. *
  64. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  65. */
  66. public void insertSelective(XtYxcsYa record) {
  67. getSqlMapClientTemplate().insert("xt_hk_yxcs_bys_ya.ibatorgenerated_insertSelective", record);
  68. }
  69. /**
  70. * This method was generated by Apache iBATIS ibator.
  71. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  72. *
  73. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  74. */
  75. @SuppressWarnings("unchecked")
  76. public List<XtYxcsYa> selectByExample(XtYxcsYaExample example) {
  77. List<XtYxcsYa> list = getSqlMapClientTemplate().queryForList("xt_hk_yxcs_bys_ya.ibatorgenerated_selectByExample", example);
  78. return list;
  79. }
  80. /**
  81. * This method was generated by Apache iBATIS ibator.
  82. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  83. *
  84. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  85. */
  86. public XtYxcsYa selectByPrimaryKey(Integer id) {
  87. XtYxcsYa key = new XtYxcsYa();
  88. key.setId(id);
  89. XtYxcsYa record = (XtYxcsYa) getSqlMapClientTemplate().queryForObject("xt_hk_yxcs_bys_ya.ibatorgenerated_selectByPrimaryKey", key);
  90. return record;
  91. }
  92. /**
  93. * This method was generated by Apache iBATIS ibator.
  94. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  95. *
  96. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  97. */
  98. public int updateByExampleSelective(XtYxcsYa record, XtYxcsYaExample example) {
  99. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  100. int rows = getSqlMapClientTemplate().update("xt_hk_yxcs_bys_ya.ibatorgenerated_updateByExampleSelective", parms);
  101. return rows;
  102. }
  103. /**
  104. * This method was generated by Apache iBATIS ibator.
  105. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  106. *
  107. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  108. */
  109. public int updateByExample(XtYxcsYa record, XtYxcsYaExample example) {
  110. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  111. int rows = getSqlMapClientTemplate().update("xt_hk_yxcs_bys_ya.ibatorgenerated_updateByExample", parms);
  112. return rows;
  113. }
  114. /**
  115. * This method was generated by Apache iBATIS ibator.
  116. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  117. *
  118. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  119. */
  120. public int updateByPrimaryKeySelective(XtYxcsYa record) {
  121. int rows = getSqlMapClientTemplate().update("xt_hk_yxcs_bys_ya.ibatorgenerated_updateByPrimaryKeySelective", record);
  122. return rows;
  123. }
  124. /**
  125. * This method was generated by Apache iBATIS ibator.
  126. * This method corresponds to the database table xt_hk_yxcs_bys_ya
  127. *
  128. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  129. */
  130. public int updateByPrimaryKey(XtYxcsYa record) {
  131. int rows = getSqlMapClientTemplate().update("xt_hk_yxcs_bys_ya.ibatorgenerated_updateByPrimaryKey", record);
  132. return rows;
  133. }
  134. /**
  135. * This class was generated by Apache iBATIS ibator.
  136. * This class corresponds to the database table xt_hk_yxcs_bys_ya
  137. *
  138. * @ibatorgenerated Fri Sep 08 13:22:44 CST 2017
  139. */
  140. private static class UpdateByExampleParms extends XtYxcsYaExample {
  141. private Object record;
  142. public UpdateByExampleParms(Object record, XtYxcsYaExample example) {
  143. super(example);
  144. this.record = record;
  145. }
  146. public Object getRecord() {
  147. return record;
  148. }
  149. }
  150. /**
  151. * 批量作废
  152. */
  153. public void batchUpdateHkyxcsyaByList(List<XtYxcsYa> yxcsYaList) {
  154. HpHkyxcsClientCallback hpHkyxcsClientCallback = new HpHkyxcsClientCallback();
  155. hpHkyxcsClientCallback.setYxcsYaList(yxcsYaList);
  156. getSqlMapClientTemplate().execute(hpHkyxcsClientCallback);
  157. }
  158. //回调
  159. public class HpHkyxcsClientCallback implements SqlMapClientCallback{
  160. private List<XtYxcsYa> yxcsYaList;
  161. public void setYxcsYaList(List<XtYxcsYa> yxcsYaList) {
  162. this.yxcsYaList = yxcsYaList;
  163. }
  164. public Object doInSqlMapClient(SqlMapExecutor executor)throws SQLException {
  165. executor.startBatch();
  166. XtYxcsYa yxcs = null;
  167. for(int i = 0 ; i < yxcsYaList.size(); i++) {
  168. yxcs = yxcsYaList.get(i);
  169. executor.update("xt_hk_yxcs_bys_ya.ibatorgenerated_updateByPrimaryKeySelective",yxcs);
  170. }
  171. executor.executeBatch();
  172. return null;
  173. }
  174. }
  175. }