123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- package com.huimv.da.dao;
- import java.sql.SQLException;
- import java.util.ArrayList;
- 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.base.dto.ResponseBean;
- import com.huimv.busi.da.dto.DaZsdaDTO;
- import com.huimv.busi.xt.constant.XtSqlMapConstant;
- import com.huimv.da.dataobject.DaZsda;
- import com.huimv.da.dataobject.DaZsdaExample;
- import com.huimv.web.base.PageBean;
- import com.ibatis.sqlmap.client.SqlMapExecutor;
- public class DaZsdaDAOImpl extends SqlMapClientDaoSupport implements DaZsdaDAO {
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public DaZsdaDAOImpl() {
- super();
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int countByExample(DaZsdaExample example) {
- Integer count = (Integer) getSqlMapClientTemplate().queryForObject("da_zsda.ibatorgenerated_countByExample",
- example);
- return count;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int deleteByExample(DaZsdaExample example) {
- int rows = getSqlMapClientTemplate().delete("da_zsda.ibatorgenerated_deleteByExample", example);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int deleteByPrimaryKey(Integer id) {
- DaZsda key = new DaZsda();
- key.setId(id);
- int rows = getSqlMapClientTemplate().delete("da_zsda.ibatorgenerated_deleteByPrimaryKey", key);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public void insert(DaZsda record) {
- getSqlMapClientTemplate().insert("da_zsda.ibatorgenerated_insert", record);
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public void insertSelective(DaZsda record) {
- getSqlMapClientTemplate().insert("da_zsda.ibatorgenerated_insertSelective", record);
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- @SuppressWarnings("unchecked")
- public List<DaZsda> selectByExample(DaZsdaExample example) {
- List<DaZsda> list = getSqlMapClientTemplate().queryForList("da_zsda.ibatorgenerated_selectByExample", example);
- return list;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public DaZsda selectByPrimaryKey(Integer id) {
- DaZsda key = new DaZsda();
- key.setId(id);
- DaZsda record = (DaZsda) getSqlMapClientTemplate().queryForObject("da_zsda.ibatorgenerated_selectByPrimaryKey",
- key);
- return record;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int updateByExampleSelective(DaZsda record, DaZsdaExample example) {
- UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
- int rows = getSqlMapClientTemplate().update("da_zsda.ibatorgenerated_updateByExampleSelective", parms);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int updateByExample(DaZsda record, DaZsdaExample example) {
- UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
- int rows = getSqlMapClientTemplate().update("da_zsda.ibatorgenerated_updateByExample", parms);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int updateByPrimaryKeySelective(DaZsda record) {
- int rows = getSqlMapClientTemplate().update("da_zsda.ibatorgenerated_updateByPrimaryKeySelective", record);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator. This method
- * corresponds to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- public int updateByPrimaryKey(DaZsda record) {
- int rows = getSqlMapClientTemplate().update("da_zsda.ibatorgenerated_updateByPrimaryKey", record);
- return rows;
- }
- /**
- * This class was generated by Apache iBATIS ibator. This class corresponds
- * to the database table da_zsda
- *
- * @ibatorgenerated Fri May 23 16:56:30 CST 2014
- */
- private static class UpdateByExampleParms extends DaZsdaExample {
- private Object record;
- public UpdateByExampleParms(Object record, DaZsdaExample example) {
- super(example);
- this.record = record;
- }
- @SuppressWarnings("unused")
- public Object getRecord() {
- return record;
- }
- }
- public DaZsda selectZsdaByParam(DaZsda daZsda) {
- DaZsda record = (DaZsda) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_SELECT_ZSDA_BY_PARAM,
- daZsda);
- return record;
- }
- public int countZsdaByParam(DaZsda daZsda) {
- Integer count = (Integer) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_ZSDA_BY_PARAM,
- daZsda);
- return count;
- }
- /**
- * 根据参数获取猪舍档案
- *
- * @return
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- public ResponseBean getZsdaByParam(Map<String, Object> paramMap, PageBean pageBean) throws Exception {
- ResponseBean rb = new ResponseBean();
- List<DaZsda> zsdaList = new ArrayList<DaZsda>();
- int count = (Integer) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_ZSDA_BY_PARAM,
- paramMap);
- if (null != pageBean) {
- int startRecord = pageBean.getCurrentPageFirstRecord();
- int endRecord = pageBean.getPageSize();
- paramMap.put("startRecord", startRecord);
- paramMap.put("endRecord", endRecord);
- zsdaList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_ZSDA_BY_PARAM, paramMap);
- pageBean.setRecordCount(count);
- } else {
- paramMap.put("startRecord", 0);
- paramMap.put("endRecord", count);
- zsdaList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_ZSDA_BY_PARAM, paramMap);
- }
- rb.setResult(zsdaList);
- rb.setReturnCode(count);
- return rb;
- }
- @SuppressWarnings("unchecked")
- public List<DaZsda> selectZSMCdaByParam(Map<String, Object> paramMap, PageBean pageBean) {
- List<DaZsda> zsdaList = new ArrayList<DaZsda>();
- int count = (Integer) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_ZSDA_BY_PARAM,
- paramMap);
- if (null != pageBean) {
- int startRecord = pageBean.getCurrentPageFirstRecord();
- int endRecord = pageBean.getPageSize();
- paramMap.put("startRecord", startRecord);
- paramMap.put("endRecord", endRecord);
- zsdaList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_ZSMCDA_BY_PARAM, paramMap);
- pageBean.setRecordCount(count);
- } else {
- paramMap.put("startRecord", 0);
- paramMap.put("endRecord", count);
- zsdaList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_ZSMCDA_BY_PARAM, paramMap);
- }
- return zsdaList;
- }
- /**
- * 根据参数获取猪舍档案
- *
- * @return
- * @throws Exception
- */
- public DaZsda getZsdaById(Map<String, Object> paramMap) throws Exception {
- DaZsda zsdaList = new DaZsda();
- int count = (Integer) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_ZSDA_BY_PARAM,
- paramMap);
- paramMap.put("startRecord", 0);
- paramMap.put("endRecord", count);
- zsdaList = (DaZsda) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_SELECT_ZSDA_BY_PARAM,
- paramMap);
- return zsdaList;
- }
- /**
- * 根据参数获取猪舍档案
- *
- * @return
- * @throws Exception
- */
- public DaZsda getZsdaByJqid(Map<String, Object> paramMap) throws Exception {
- DaZsda zsda = (DaZsda) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_SELECT_ZSMCDA_BY_JQID,
- paramMap);
- return zsda;
- }
- @SuppressWarnings("unchecked")
- public List<DaZsda> getZsdaListByParam(Map<String, Object> paramMap) {
- List<DaZsda> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_MCLIST_BY_PARAM,
- paramMap);
- return list;
- }
- /**
- * 获取临时排序的猪舍列表
- */
- public String getZsidListByParam(Map<String, Object> paramMap) {
- String zsids = (String) getSqlMapClientTemplate()
- .queryForObject(XtSqlMapConstant.SQLMAP_SELECT_ZSLIST_ZSID_BY_PARAM, paramMap);
- return zsids;
- }
- /**
- * 获取猪舍列表
- */
- public List<DaZsda> getZsxxListByParam(Map<String, Object> paramMap) {
- @SuppressWarnings("unchecked")
- List<DaZsda> zsxxList = getSqlMapClientTemplate()
- .queryForList(XtSqlMapConstant.SQLMAP_SELECT_ZSLIST_ZSXX_BY_PARAM, paramMap);
- return zsxxList;
- }
- public List<DaZsdaDTO> getZsdtoByXlh(Map<String, Object> paramMap) {
- @SuppressWarnings("unchecked")
- List<DaZsdaDTO> zsxxList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_ZSDADTO_BY_XLH,
- paramMap);
- return zsxxList;
- }
- public int countZs(Map<String, Object> paramMap) {
- int count = (Integer) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_ZSID_FROM_DAZSDA,
- paramMap);
- return count;
- }
- /**
- * 获取临时排序的猪舍列表 只有普通舍和测定舍
- */
- public String getPtZsidListByParam(Map<String, Object> paramMap) {
- String zsids = (String) getSqlMapClientTemplate()
- .queryForObject(XtSqlMapConstant.SQLMAP_SELECT_PTZSLIST_ZSID_BY_PARAM, paramMap);
- return zsids;
- }
- /**
- * 批量更新猪舍区域
- *
- * @param paramMapList
- * @param zsdaExList
- */
- public void updateZsqyByParam(List<DaZsda> paramMapList) {
- HpDaZsdaSqlMapClientCallback hpDaZsdaSqlMapClientCallback = new HpDaZsdaSqlMapClientCallback();
- hpDaZsdaSqlMapClientCallback.setZsdaList(paramMapList);
- getSqlMapClientTemplate().execute(hpDaZsdaSqlMapClientCallback);// 。每次执行CRUD操作时,都会调用execute,该方法负责创建并关闭session。
- }
- // 回调
- public class HpDaZsdaSqlMapClientCallback implements SqlMapClientCallback {
- private List<DaZsda> zsdaList;
- public void setZsdaList(List<DaZsda> zsdaList) {
- this.zsdaList = zsdaList;
- }
- public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException { // 回调接口
- executor.startBatch(); // // 开始批处理
- for (int i = 0; i < zsdaList.size(); i++) {
- DaZsda zsda = new DaZsda();
- zsda = zsdaList.get(i);
- // 更新
- executor.update("da_zsda.ibatorgenerated_updateByPrimaryKeySelective", zsda);
- }
- executor.executeBatch(); /// 执行批处理
- return null;
- }
- }
- public String selectDqlqfromzsdaAndJqdaByJqid(String jqid) {
- String dqlq = (String) getSqlMapClientTemplate()
- .queryForObject(XtSqlMapConstant.SQLMAP_SELECT_DQLQ_FROM_ZSDA_AND_JQDA_BY_JQID, jqid);
- return dqlq;
- }
-
- public List<DaZsda> selectZsxxByDgds(Map<String, Object> paramMap) {
- List<DaZsda> zsxxList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_DSXX_BY_DGDS, paramMap);
- return zsxxList;
- }
-
- public List<DaZsda> selectZsxxByLxds(Map<String, Object> paramMap) {
- List<DaZsda> zsxxList = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_DSXX_BY_LXDS, paramMap);
- return zsxxList;
- }
- }
|