123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301 |
- package com.huimv.sj.dao;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- import java.util.Map;
- import org.springframework.orm.ibatis.SqlMapClientCallback;
- import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
- import org.springframework.util.StringUtils;
- import com.huimv.busi.base.dto.ResponseBean;
- import com.huimv.busi.da.dto.DaSlxxDTO;
- import com.huimv.busi.xt.constant.XtSqlMapConstant;
- import com.huimv.busi.xt.utils.DynamicDataSourceHolder;
- import com.huimv.sj.dataobject.SjSscssj;
- import com.huimv.sj.dataobject.SjSscssjExample;
- import com.huimv.web.base.PageBean;
- import com.ibatis.sqlmap.client.SqlMapExecutor;
- public class SjSscssjDAOImpl extends SqlMapClientDaoSupport implements SjSscssjDAO {
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public SjSscssjDAOImpl() {
- super();
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int countByExample(SjSscssjExample example) {
- Integer count = (Integer) getSqlMapClientTemplate().queryForObject("sj_sscssj.ibatorgenerated_countByExample", example);
- return count;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int deleteByExample(SjSscssjExample example) {
- int rows = getSqlMapClientTemplate().delete("sj_sscssj.ibatorgenerated_deleteByExample", example);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int deleteByPrimaryKey(Integer id) {
- SjSscssj key = new SjSscssj();
- key.setId(id);
- int rows = getSqlMapClientTemplate().delete("sj_sscssj.ibatorgenerated_deleteByPrimaryKey", key);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public void insert(SjSscssj record) {
- getSqlMapClientTemplate().insert("sj_sscssj.ibatorgenerated_insert", record);
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public void insertSelective(SjSscssj record) {
- getSqlMapClientTemplate().insert("sj_sscssj.ibatorgenerated_insertSelective", record);
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- @SuppressWarnings("unchecked")
- public List<SjSscssj> selectByExample(SjSscssjExample example) {
- List<SjSscssj> list = getSqlMapClientTemplate().queryForList("sj_sscssj.ibatorgenerated_selectByExample", example);
- return list;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public SjSscssj selectByPrimaryKey(Integer id) {
- SjSscssj key = new SjSscssj();
- key.setId(id);
- SjSscssj record = (SjSscssj) getSqlMapClientTemplate().queryForObject("sj_sscssj.ibatorgenerated_selectByPrimaryKey", key);
- return record;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int updateByExampleSelective(SjSscssj record, SjSscssjExample example) {
- UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
- int rows = getSqlMapClientTemplate().update("sj_sscssj.ibatorgenerated_updateByExampleSelective", parms);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int updateByExample(SjSscssj record, SjSscssjExample example) {
- UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
- int rows = getSqlMapClientTemplate().update("sj_sscssj.ibatorgenerated_updateByExample", parms);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int updateByPrimaryKeySelective(SjSscssj record) {
- int rows = getSqlMapClientTemplate().update("sj_sscssj.ibatorgenerated_updateByPrimaryKeySelective", record);
- return rows;
- }
- /**
- * This method was generated by Apache iBATIS ibator.
- * This method corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- public int updateByPrimaryKey(SjSscssj record) {
- int rows = getSqlMapClientTemplate().update("sj_sscssj.ibatorgenerated_updateByPrimaryKey", record);
- return rows;
- }
- /**
- * This class was generated by Apache iBATIS ibator.
- * This class corresponds to the database table sj_sscssj
- *
- * @ibatorgenerated Thu Jun 19 15:59:45 CST 2014
- */
- private static class UpdateByExampleParms extends SjSscssjExample {
- private Object record;
- public UpdateByExampleParms(Object record, SjSscssjExample example) {
- super(example);
- this.record = record;
- }
- @SuppressWarnings("unused")
- public Object getRecord() {
- return record;
- }
- }
-
- /**
- * 得到指定条件采食记录的最大时间
- */
- public Date selectMaxSscssjTimeByParam(Map<String, Object> searchParam) {
- Date date = (Date) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_SELECT_MAX_SSCSSJ_TIME_BY_PARAM, searchParam);
- return date;
- }
-
- /**
- * 插入动物访问记录
- */
- public void insertSscssjByParam(List<Map<String, Object>> paramMapList) {
- SscssjSqlMapClientCallback sscssjSqlMapClientCallback = new SscssjSqlMapClientCallback();
- sscssjSqlMapClientCallback.setParamMapList(paramMapList);
- getSqlMapClientTemplate().execute(sscssjSqlMapClientCallback);
- }
-
- /**
- * 插入数据的回调类
- */
- private class SscssjSqlMapClientCallback implements SqlMapClientCallback {
- private List<Map<String, Object>> paramMapList;
-
- public void setParamMapList(List<Map<String, Object>> paramMapList) {
- this.paramMapList = paramMapList;
- }
- @Override
- public Object doInSqlMapClient(SqlMapExecutor executor) throws SQLException {
- executor.startBatch();
- String dqlq = "";
- String jqid = "";
- for (Map<String, Object> paramMap : paramMapList) {
- jqid = (String) paramMap.get("jqid");
- dqlq = (String) executor.queryForObject(XtSqlMapConstant.SQLMAP_SELECT_DQLQ_FROM_ZSDA_AND_JQDA_BY_JQID, jqid);
- if (StringUtils.hasText(dqlq)) {
- paramMap.put("dqlq", dqlq);
- executor.insert(XtSqlMapConstant.SQLMAP_INSERT_SSCSSJ_BY_PARAM, paramMap);
- }
- }
- executor.executeBatch();
- return null;
- }
- }
-
- /**
- * 上料维护
- * @param example
- * @return
- */
- public int countSlwhByExample(SjSscssjExample example) {
- Integer count = (Integer) getSqlMapClientTemplate().queryForObject("sj_sscssj.ibatorgenerated_countSlwhByExample", example);
- return count;
- }
-
- /**
- * 上料维护信息查询
- * @param example
- * @return
- */
- @SuppressWarnings("unchecked")
- public List<SjSscssj> selectSlwhByExample(SjSscssjExample example) {
- List<SjSscssj> list = getSqlMapClientTemplate().queryForList("sj_sscssj.ibatorgenerated_selectSlwhByExample", example);
- return list;
- }
-
- /**
- * 上料信息参数查询
- */
- @SuppressWarnings("unchecked")
- public ResponseBean selectDaSlxxByParam(Map<String, Object> paramMap, PageBean pageBean) throws Exception {
- ResponseBean rb = new ResponseBean();
- List<DaSlxxDTO> daSlxxDTOs = new ArrayList<DaSlxxDTO>();
- int count = (Integer) getSqlMapClientTemplate().queryForObject(XtSqlMapConstant.SQLMAP_COUNT_SLXX_BY_PARAM, paramMap);
-
- if(null != pageBean) {
- int startRecord = pageBean.getCurrentPageFirstRecord();
- int endRecord = pageBean.getPageSize();
- paramMap.put("startRecord", startRecord);
- paramMap.put("endRecord", endRecord);
- pageBean.setRecordCount(count);
- } else {
- paramMap.put("startRecord", 0);
- paramMap.put("endRecord", count);
- }
-
- daSlxxDTOs = (List<DaSlxxDTO>) getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_SLXX_BY_PARAM, paramMap);
- rb.setResult(daSlxxDTOs);
- rb.setReturnCode(count);
- return rb;
- }
- @Override
- public void callPrcSlxx(Map<String, Object> searchParam) {
- // TODO Auto-generated method stub
- getSqlMapClientTemplate().update(XtSqlMapConstant.SQLMAP_PRC_SLXX, searchParam);
- }
- @SuppressWarnings("unchecked")
- public List<SjSscssj> selectHkcsCgqidByParam(Map<String, Object> searchParam) {
- DynamicDataSourceHolder.setRouteKey("");
- List<SjSscssj> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_HKCS_CGQID_BY_PARAM, searchParam);
- return list;
- }
-
- @SuppressWarnings("unchecked")
- public List<SjSscssj> selectQccsByParam(Map<String, Object> searchParam) {
- DynamicDataSourceHolder.setRouteKey("");
- List<SjSscssj> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_QCHKCS_BY_PARAM, searchParam);
- DynamicDataSourceHolder.removeRouteKey();
- return list;
- }
-
- @SuppressWarnings("unchecked")
- public List<SjSscssj> selectDqcsByParam(Map<String, Object> searchParam) {
- DynamicDataSourceHolder.setRouteKey("");
- List<SjSscssj> list = getSqlMapClientTemplate().queryForList(XtSqlMapConstant.SQLMAP_SELECT_DQHKCS_BY_PARAM, searchParam);
- DynamicDataSourceHolder.removeRouteKey();
- return list;
- }
-
- }
|