123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- package com.huimv.sjlr.dao;
- import java.sql.SQLException;
- import java.util.List;
- import java.util.Map;
- import org.springframework.orm.ibatis.SqlMapClientCallback;
- import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
- import com.huimv.busi.xt.constant.XtSqlMapConstant;
- import com.huimv.sjlr.dataobject.SjlrGzda;
- import com.huimv.sjlr.dataobject.SjlrGzdaExample;
- import com.ibatis.sqlmap.client.SqlMapExecutor;
- public class SjlrGzdaDAOImpl extends SqlMapClientDaoSupport implements SjlrGzdaDAO {
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public SjlrGzdaDAOImpl() {
- super();
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int countByExample(SjlrGzdaExample example) {
- Integer count = (Integer) getSqlMapClientTemplate().queryForObject("sjlr_gzda.ibatorgenerated_countByExample", example);
- return count;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int deleteByExample(SjlrGzdaExample example) {
- int rows = getSqlMapClientTemplate().delete("sjlr_gzda.ibatorgenerated_deleteByExample", example);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int deleteByPrimaryKey(Integer id) {
- SjlrGzda key = new SjlrGzda();
- key.setId(id);
- int rows = getSqlMapClientTemplate().delete("sjlr_gzda.ibatorgenerated_deleteByPrimaryKey", key);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public void insert(SjlrGzda record) {
- getSqlMapClientTemplate().insert("sjlr_gzda.ibatorgenerated_insert", record);
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public void insertSelective(SjlrGzda record) {
- getSqlMapClientTemplate().insert("sjlr_gzda.ibatorgenerated_insertSelective", record);
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- @SuppressWarnings("unchecked")
- public List<SjlrGzda> selectByExample(SjlrGzdaExample example) {
- List<SjlrGzda> list = getSqlMapClientTemplate().queryForList("sjlr_gzda.ibatorgenerated_selectByExample", example);
- return list;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public SjlrGzda selectByPrimaryKey(Integer id) {
- SjlrGzda key = new SjlrGzda();
- key.setId(id);
- SjlrGzda record = (SjlrGzda) getSqlMapClientTemplate().queryForObject("sjlr_gzda.ibatorgenerated_selectByPrimaryKey", key);
- return record;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int updateByExampleSelective(SjlrGzda record, SjlrGzdaExample example) {
- UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
- int rows = getSqlMapClientTemplate().update("sjlr_gzda.ibatorgenerated_updateByExampleSelective", parms);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int updateByExample(SjlrGzda record, SjlrGzdaExample example) {
- UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
- int rows = getSqlMapClientTemplate().update("sjlr_gzda.ibatorgenerated_updateByExample", parms);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int updateByPrimaryKeySelective(SjlrGzda record) {
- int rows = getSqlMapClientTemplate().update("sjlr_gzda.ibatorgenerated_updateByPrimaryKeySelective", record);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- public int updateByPrimaryKey(SjlrGzda record) {
- int rows = getSqlMapClientTemplate().update("sjlr_gzda.ibatorgenerated_updateByPrimaryKey", record);
- return rows;
- }
- /**
- * This class was generated by Apache iBATIS ibator.
- * This class corresponds to the database table sjlr_gzda
- *
- * @ibatorgenerated Wed Mar 08 10:40:08 CST 2017
- */
- private static class UpdateByExampleParms extends SjlrGzdaExample {
- private Object record;
- public UpdateByExampleParms(Object record, SjlrGzdaExample example) {
- super(example);
- this.record = record;
- }
- public Object getRecord() {
- return record;
- }
- }
-
- /**
- * 获取公猪档案列表
- * @param parmaMap
- * @return
- */
- public List<SjlrGzda> getGzdaListByParam(Map<String, Object> paramMap) {
- @SuppressWarnings("unchecked")
- List<SjlrGzda> gzdaList = (List<SjlrGzda>)getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_SJLR_GZDA_BY_PARAM, paramMap);
- return gzdaList;
- }
- // /**
- // * 批量更新公猪档案
- // */
- // public void updateGzdaByExample(List<SjlrGzda> paramMapList) {
- // HpSjlrGzdaSqlMapClientCallback hpSjlrGzdaSqlMapClientCallback = new HpSjlrGzdaSqlMapClientCallback();
- // hpSjlrGzdaSqlMapClientCallback.setParamMapList(paramMapList);
- // getSqlMapClientTemplate().execute(hpSjlrGzdaSqlMapClientCallback);
- // }
- //
- // /**
- // * 回调
- // */
- // private class HpSjlrGzdaSqlMapClientCallback implements SqlMapClientCallback {
- // private List<SjlrGzda> paramMapList;
- //
- // public void setParamMapList(List<SjlrGzda> paramMapList) {
- // this.paramMapList = paramMapList;
- // }
- //
- // @Override
- // public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
- // executor.startBatch();
- // for (SjlrGzda sjlrGzda : paramMapList) {
- // executor.update("sjlr_gzda.ibatorgenerated_updateByExampleSelective", sjlrGzda);
- // }
- // executor.executeBatch();
- // return null;
- // }
- // }
-
- public void updatGzdaByParam(List<SjlrGzda> paramMapList,List<SjlrGzdaExample> gzdaExList) {
- HpSjlrGzdaSqlMapClientCallback hpSjlrGzdaSqlMapClientCallback = new HpSjlrGzdaSqlMapClientCallback();
- hpSjlrGzdaSqlMapClientCallback.setgzdaList(paramMapList);
- hpSjlrGzdaSqlMapClientCallback.setgzdaExList(gzdaExList);
- getSqlMapClientTemplate().execute(hpSjlrGzdaSqlMapClientCallback);
- }
-
- //回调
- public class HpSjlrGzdaSqlMapClientCallback implements SqlMapClientCallback {
- private List<SjlrGzda> sjlrGzdaList ;
- private List<SjlrGzdaExample> gzdaExList ;
- public void setgzdaList(List<SjlrGzda> sjlrGzdaList) {
- this.sjlrGzdaList=sjlrGzdaList;
- }
- public void setgzdaExList(List<SjlrGzdaExample> sjlrGzdaExList) {
- this.gzdaExList=sjlrGzdaExList;
- }
- public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
- executor.startBatch();
- for (int i=0;i<sjlrGzdaList.size();i++) {
- SjlrGzda sjlrGzda=new SjlrGzda();
- sjlrGzda=sjlrGzdaList.get(i);
- SjlrGzdaExample sjlrGzdaExample=new SjlrGzdaExample();
- sjlrGzdaExample= gzdaExList.get(i);
- //更新
- UpdateByExampleParms parms = new UpdateByExampleParms(sjlrGzda, sjlrGzdaExample);
- executor.update("sjlr_gzda.ibatorgenerated_updateByExampleSelective", parms);
- }
- executor.executeBatch();
- return null;
- }
-
- }
- @Override
- public List<SjlrGzda> selectpzjgByParam(Map<String, Object> paramMap) {
- @SuppressWarnings("unchecked")
- List<SjlrGzda> gzdaList = (List<SjlrGzda>)getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_SJLR_GZDAPZJG_BY_PARAM, paramMap);
- return gzdaList;
- }
- }
|