package cn.im.trafficalarm.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("trafficaccidentstateDao")
public class TrafficaccidentstateDao  extends SqlMapClientDaoSupport{

	@Autowired 
    private SqlMapClient sqlMapClient;  
      
	@PostConstruct          
    public  void initSqlMapClient(){  
    	super.setSqlMapClient(sqlMapClient);      
    }
	
	
	/**
	 * 增加记录
	 */
	/*
	public void insert_Trafficaccidentstate(Map map) throws SQLException{
		this.getSqlMapClientTemplate().insert("insert_Trafficaccidentstate",map);
	}
	*/
	
	/**
	 * 批处理增加记录
	 */
	/*
	public void batch_insert_Trafficaccidentstate(List batch) throws SQLException{
		this.getSqlMapClientTemplate().insert("batch_insert_Trafficaccidentstate",batch);
	}
	*/
	 
	/**
	 * 修改记录
	 */
	/*
	public Integer update_Trafficaccidentstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().update("update_Trafficaccidentstate",map);
	}
	*/
	
	/* AMQ联动接口获取设置执行状态后，修改 交通事故执行状态信息 表 中联动设置执行状态 */
	public Integer update_AmqAccidentstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().update("update_AmqAccidentstate",map);
	}
	
	/* AMQ 查询 交通事故执行状态信息 表中所有联动设备的执行状态 */
	public List<Map> query_AmqForAccidentCount(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_AmqForAccidentCount",map);
	}
	
	/* AMQ联动接口获取设置执行状态后，更新交通事故检测信息表：TrafficAccidentInfo 为 执行完成 */
	public Integer update_AmqAccidentInfostate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().update("update_AmqAccidentInfostate",map);
	}
	/**
	 * 删除记录
	 */
	/*
	public Integer delete_Trafficaccidentstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().delete("delete_Trafficaccidentstate",map);
	}
	*/
	public Integer delete_trafficaccidentstateByAPId(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().delete("delete_trafficaccidentstateByAPId",map);
	}
	
	/**
	 * 批处理删除记录
	 */
	
	/*
	public Integer batch_delete_Trafficaccidentstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().delete("batch_delete_Trafficaccidentstate",map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	/*
	public Integer count_Trafficaccidentstate(Map map) throws SQLException{
		return (Integer)this.getSqlMapClientTemplate().queryForObject("count_Trafficaccidentstate",map);
	}
	*/
	
	/**
	 * 查询列表记录
	 */
	
	/*
	public List<Map> query_Trafficaccidentstate(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_Trafficaccidentstate",map);
	}
	*/
	
	/**
	 * 查询列表记录
	 */
	public List get_Trafficaccidentstate(Map map) throws SQLException{
		return (List) this.getSqlMapClientTemplate().queryForList("query_Trafficaccidentstate",map);
	}
	
	/**
	 * 根据预案插入
	 * @param map
	 * @throws SQLException
	 */
	public void insert_Trafficaccidentstate_plan(Map map) throws SQLException{
		this.getSqlMapClientTemplate().insert("insert_Trafficaccidentstate_plan",map);
	}
	public void insert_Trafficaccidentstate_planExec(Map map) throws SQLException{
		this.getSqlMapClientTemplate().insert("insert_Trafficaccidentstate_planExec",map);
	}
	

	public List<Map> query_Trafficaccidentstate_plan(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("query_Trafficaccidentstate_plan",map);
	}
	public List<Map> getTrafficaccidentstateByAccidentId(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("getTrafficaccidentstateByAccidentId",map);
	}
	public List<Map> getStateInfosByAccidentId(Map map) throws SQLException{
		return this.getSqlMapClientTemplate().queryForList("getStateInfosByAccidentId",map);
	}
	public Map getPlanInfosByAccidentId(Map map) throws SQLException{
		return (Map)this.getSqlMapClientTemplate().queryForObject("getPlanInfosByAccidentId",map);
	}
	public Map getExecStatePlanEnd(Map map) throws SQLException{
		return (Map)this.getSqlMapClientTemplate().queryForObject("getExecStatePlanEnd",map);
	}
	
}
