package cn.im.trafficlinkage.dao;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;
import com.ibatis.sqlmap.client.SqlMapClient;

import cn.im.trafficlinkage.model.TrafficdevicecurrstateBean;
import cn.im.trafficlinkage.model.TrafficdevicehisstateBean;

@Repository("trafficdevicecurrstateDao")
public class TrafficdevicecurrstateDao  extends SqlMapClientDaoSupport{

	@Autowired 
    private SqlMapClient sqlMapClient;  
      
	@PostConstruct          
    public  void initSqlMapClient(){  
    	super.setSqlMapClient(sqlMapClient);      
    }
	
	
	/**
	 * 增加记录
	 */
	public Map insert_Trafficdevicecurrstate(TrafficdevicecurrstateBean trafficBean) {
		Map map = new HashMap();
		try{			
			this.getSqlMapClientTemplate().insert("insert_Trafficdevicecurrstate",trafficBean);
			map.put("msg", "数据新增成功");
			map.put("success", new Boolean(true));			
		}catch(Exception e){
			e.printStackTrace();
		}
		return map;
		
	}
	/*
	public void insert_Trafficdevicecurrstate(Map map) throws SQLException{
		this.getSqlMapClientTemplate().insert("insert_Trafficdevicecurrstate",map);
	}
	*/
	
	/**
	 * 批处理增加记录
	 */
	/*
	public void batch_insert_Trafficdevicecurrstate(List batch) throws SQLException{
		this.getSqlMapClientTemplate().insert("batch_insert_Trafficdevicecurrstate",batch);
	}
	*/
	 
	/**
	 * AMQ-修改记录
	 */
	public Integer update_Trafficdevicecurrstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().update("update_Trafficdevicecurrstate",map);
	}
	public Integer update_Trafficdevicecurrstate(TrafficdevicecurrstateBean bean) throws SQLException{
		return this.getSqlMapClientTemplate().update("update_Trafficdevicecurrstate_state",bean);
	}
	
	/**
	 * 删除记录
	 */
	/*
	public Integer delete_Trafficdevicecurrstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().delete("delete_Trafficdevicecurrstate",map);
	}
	*/
	
	/**
	 * 批处理删除记录
	 */
	
	/*
	public Integer batch_delete_Trafficdevicecurrstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().delete("batch_delete_Trafficdevicecurrstate",map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	/*
	public Integer count_Trafficdevicecurrstate(Map map) throws SQLException{
		return (Integer)this.getSqlMapClientTemplate().queryForObject("count_Trafficdevicecurrstate",map);
	}
	*/
	
	/**
	 * 查询列表记录
	 */
	
	public List<Map> query_Trafficdevicecurrstate_All() throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_Trafficdevicecurrstate_All");
	}
	
	/**
	 * AMQ-查询列表记录
	 */
	public TrafficdevicehisstateBean get_Trafficdevicecurrstate_bean(TrafficdevicecurrstateBean b) throws SQLException{
		TrafficdevicehisstateBean bean = new TrafficdevicehisstateBean();
		try{
			bean = (TrafficdevicehisstateBean) this.getSqlMapClientTemplate().queryForObject("query_Trafficdevicecurrstate_bean",b);
		}catch(Exception e){
			return null;
		}
		return bean;
		
		//return (Map) this.getSqlMapClientTemplate().queryForObject("query_Trafficdevicecurrstate",map);
	}
	
	public TrafficdevicecurrstateBean get_Trafficdevicecurrstate(Map map) throws SQLException{
		TrafficdevicecurrstateBean bean = new TrafficdevicecurrstateBean();
		try{
			bean = (TrafficdevicecurrstateBean) this.getSqlMapClientTemplate().queryForObject("query_Trafficdevicecurrstate",map);
		}catch(Exception e){
			return null;
		}
		return bean;
		
		//return (Map) this.getSqlMapClientTemplate().queryForObject("query_Trafficdevicecurrstate",map);
	}
	/*
	  public Map get_Trafficdevicecurrstate(Map map) throws SQLException{
		return (Map) this.getSqlMapClientTemplate().queryForObject("query_Trafficdevicecurrstate",map);
	}
	* */
}
