package com.huimv.sj.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.busi.xt.utils.DynamicDataSourceHolder; import com.huimv.sj.dataobject.SjHkyq; import com.huimv.sj.dataobject.SjHkyqExample; import com.ibatis.sqlmap.client.SqlMapExecutor; public class SjHkyqDAOImpl extends SqlMapClientDaoSupport implements SjHkyqDAO { /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public SjHkyqDAOImpl() { super(); } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int countByExample(SjHkyqExample example) { Integer count = (Integer) getSqlMapClientTemplate().queryForObject("sj_hk_yq.ibatorgenerated_countByExample", example); return count; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int deleteByExample(SjHkyqExample example) { int rows = getSqlMapClientTemplate().delete("sj_hk_yq.ibatorgenerated_deleteByExample", example); return rows; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int deleteByPrimaryKey(Integer id) { SjHkyq key = new SjHkyq(); key.setId(id); int rows = getSqlMapClientTemplate().delete("sj_hk_yq.ibatorgenerated_deleteByPrimaryKey", key); return rows; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public void insert(SjHkyq record) { getSqlMapClientTemplate().insert("sj_hk_yq.ibatorgenerated_insert", record); } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public void insertSelective(SjHkyq record) { getSqlMapClientTemplate().insert("sj_hk_yq.ibatorgenerated_insertSelective", record); } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ @SuppressWarnings("unchecked") public List selectByExample(SjHkyqExample example) { List list = getSqlMapClientTemplate().queryForList("sj_hk_yq.ibatorgenerated_selectByExample", example); return list; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public SjHkyq selectByPrimaryKey(Integer id) { SjHkyq key = new SjHkyq(); key.setId(id); SjHkyq record = (SjHkyq) getSqlMapClientTemplate().queryForObject("sj_hk_yq.ibatorgenerated_selectByPrimaryKey", key); return record; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int updateByExampleSelective(SjHkyq record, SjHkyqExample example) { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update("sj_hk_yq.ibatorgenerated_updateByExampleSelective", parms); return rows; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int updateByExample(SjHkyq record, SjHkyqExample example) { UpdateByExampleParms parms = new UpdateByExampleParms(record, example); int rows = getSqlMapClientTemplate().update("sj_hk_yq.ibatorgenerated_updateByExample", parms); return rows; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int updateByPrimaryKeySelective(SjHkyq record) { int rows = getSqlMapClientTemplate().update("sj_hk_yq.ibatorgenerated_updateByPrimaryKeySelective", record); return rows; } /** * This method was generated by Apache iBATIS ibator. * This method corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ public int updateByPrimaryKey(SjHkyq record) { int rows = getSqlMapClientTemplate().update("sj_hk_yq.ibatorgenerated_updateByPrimaryKey", record); return rows; } /** * This class was generated by Apache iBATIS ibator. * This class corresponds to the database table sj_hk_yq * * @ibatorgenerated Wed Sep 20 15:18:07 CST 2017 */ private static class UpdateByExampleParms extends SjHkyqExample { private Object record; public UpdateByExampleParms(Object record, SjHkyqExample example) { super(example); this.record = record; } public Object getRecord() { return record; } } /** * 插入环控氧气 */ public void insertHkyqByParam(List paramMapList) { SjHkyqSqlMapClientCallback sjHkyqSqlMapClientCallback = new SjHkyqSqlMapClientCallback(); sjHkyqSqlMapClientCallback.setParamMapList(paramMapList); getSqlMapClientTemplate().execute(sjHkyqSqlMapClientCallback); } /** * 插入数据的回调类 */ private class SjHkyqSqlMapClientCallback implements SqlMapClientCallback { private List paramMapList; public void setParamMapList(List paramMapList) { this.paramMapList = paramMapList; } @Override public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException { executor.startBatch(); for (SjHkyq sjHkyq : paramMapList) { executor.insert("sj_hk_yq.ibatorgenerated_insertSelective", sjHkyq); } executor.executeBatch(); return null; } } @SuppressWarnings("unchecked") public List selectQcyqByParam(Map searchParam) { DynamicDataSourceHolder.setRouteKey(""); List list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_QCHKYQ_BY_PARAM, searchParam); DynamicDataSourceHolder.removeRouteKey(); return list; } @SuppressWarnings("unchecked") public List selectDqyqByParam(Map searchParam) { DynamicDataSourceHolder.setRouteKey(""); List list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_DQHKYQ_BY_PARAM, searchParam); DynamicDataSourceHolder.removeRouteKey(); return list; } @SuppressWarnings("unchecked") public List selectHkyqCgqidByParam(Map searchParam) { DynamicDataSourceHolder.setRouteKey(""); List list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_HKYQ_CGQID_BY_PARAM, searchParam); DynamicDataSourceHolder.removeRouteKey(); return list; } public String countSnhjButtonByLqid(int lqid) { String list = (String) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_SNHJBUTTON_BY_LQID, lqid); return list; } }