package cn.im.trafficplan.dao;

import java.sql.SQLException;
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;

@Repository("trafficplanmanageDao")
public class TrafficplanmanageDao  extends SqlMapClientDaoSupport{

	@Autowired 
    private SqlMapClient sqlMapClient;  
      
	@PostConstruct          
    public  void initSqlMapClient(){  
    	super.setSqlMapClient(sqlMapClient);      
    }
	public List<Map> getLinkageDeviceCommandfromHis(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("getLinkageDeviceCommandfromHis",map);
	}
	public Map gethisStateLast(Map map) throws SQLException{
		return (Map) this.getSqlMapClientTemplate().queryForObject("gethisStateLast",map);
	}
	
	public List<Map> query_alarmDevice(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_alarmDevice",map);
	}
	
	public List<Map> query_alarmDevice_Origin(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_alarmDevice_Origin",map);
	}
	
    public List<Map> query_TrafficLedDevice() throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_TrafficLedDevice");
	}
    
	public List<Map> query_TrafficLightDevice() throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_TrafficLightDevice");
	}

	/**
	 * 增加记录
	 */
	public void insert_Trafficplanmanage(Map map) throws SQLException{
		this.getSqlMapClientTemplate().insert("insert_Trafficplanmanage",map);
	}

	/**
	 * 修改记录
	 */
	public Integer update_Trafficplanmanage(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().update("update_Trafficplanmanage",map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Trafficplanmanage(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().delete("delete_Trafficplanmanage",map);
	}
	
	/**
	 * 根据planID删除记录
	 */
	public Integer delete_TrafficplanmanageByplanID(String str) throws SQLException{
		return this.getSqlMapClientTemplate().delete("delete_TrafficplanmanageByplanID",str);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Trafficplanmanage(Map map) throws SQLException{
		return (Integer)this.getSqlMapClientTemplate().queryForObject("count_Trafficplanmanage",map);
	}
	
	/**
	 * 查询列表记录
	 */
	public List<Map> query_Trafficplanmanage(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_Trafficplanmanage",map);
	}
	
	/**
	 * 查询列表记录
	 */
	public List<Map> query_Trafficplanmanage_sjgl(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_Trafficplanmanage_sjgl",map);
	}
	public List<Map> query_Trafficplanmanage_choose(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_Trafficplanmanage_choose",map);
	}
	
	public Integer count_Trafficplanmanage_choose(Map map) throws SQLException{
		return (Integer)this.getSqlMapClientTemplate().queryForObject("count_Trafficplanmanage_choose",map);
	}
	
	/**
	 * AMQ查询默认预案信息
	 */
	public List<Map> query_AmqTrafficplanmanage(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_AmqTrafficplanmanage",map);
	}
	/**
	 * AMQ查询结束预案关联信息
	 */
	public List<Map> query_AmqTrafficplanEnd(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_AmqTrafficplanEnd",map);
	}
}
