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 selectByExample(SjlrGzdaExample example) { List 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 getGzdaListByParam(Map paramMap) { @SuppressWarnings("unchecked") List gzdaList = (List)getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_SJLR_GZDA_BY_PARAM, paramMap); return gzdaList; } // /** // * 批量更新公猪档案 // */ // public void updateGzdaByExample(List paramMapList) { // HpSjlrGzdaSqlMapClientCallback hpSjlrGzdaSqlMapClientCallback = new HpSjlrGzdaSqlMapClientCallback(); // hpSjlrGzdaSqlMapClientCallback.setParamMapList(paramMapList); // getSqlMapClientTemplate().execute(hpSjlrGzdaSqlMapClientCallback); // } // // /** // * 回调 // */ // private class HpSjlrGzdaSqlMapClientCallback implements SqlMapClientCallback { // private List paramMapList; // // public void setParamMapList(List 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 paramMapList,List gzdaExList) { HpSjlrGzdaSqlMapClientCallback hpSjlrGzdaSqlMapClientCallback = new HpSjlrGzdaSqlMapClientCallback(); hpSjlrGzdaSqlMapClientCallback.setgzdaList(paramMapList); hpSjlrGzdaSqlMapClientCallback.setgzdaExList(gzdaExList); getSqlMapClientTemplate().execute(hpSjlrGzdaSqlMapClientCallback); } //回调 public class HpSjlrGzdaSqlMapClientCallback implements SqlMapClientCallback { private List sjlrGzdaList ; private List gzdaExList ; public void setgzdaList(List sjlrGzdaList) { this.sjlrGzdaList=sjlrGzdaList; } public void setgzdaExList(List sjlrGzdaExList) { this.gzdaExList=sjlrGzdaExList; } public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException { executor.startBatch(); for (int i=0;i selectpzjgByParam(Map paramMap) { @SuppressWarnings("unchecked") List gzdaList = (List)getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_SJLR_GZDAPZJG_BY_PARAM, paramMap); return gzdaList; } }