package cn.im.trafficdevice.service;

 import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.base.bean.BaseService;
import cn.base.util.CommUtils;
import cn.base.util.DateUtil;
import cn.base.util.Struts2Utils;
import cn.bsystem.ptuserrole.model.PtyhBean;
import cn.im.trafficdevice.dao.TrafficroadgridinfoDao;

@Service("trafficroadgridinfoService")
public class TrafficroadgridinfoService extends BaseService {
	
	private static Log log = LogFactory.getLog(TrafficroadgridinfoService.class);
	
	@Autowired
	private TrafficroadgridinfoDao trafficroadgridinfoDao;
	
	/**
	 * 保存记录
	 */
	
	public void insert_Trafficroadgridinfo(Map map) throws SQLException{
		
		String username = ((PtyhBean)Struts2Utils.getSession().getAttribute("userInfo")).getYhmc();
		
		map.put("createAccount", username);
		map.put("createTime", DateUtil.currentDateTime());
		map.put("modifyAccount", username);
		map.put("modifyTime", DateUtil.currentDateTime());
		trafficroadgridinfoDao.insert_Trafficroadgridinfo(map);
	}
	

	
	/**
	 * 修改记录
	 */
	/*
	public Integer update_Trafficroadgridinfo(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return trafficroadgridinfoDao.update_Trafficroadgridinfo(map);
	}
	*/
	
	/**
	 * 删除记录
	 */
	
	public Integer delete_Trafficroadgridinfo(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return trafficroadgridinfoDao.delete_Trafficroadgridinfo(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	/*
	public Integer batch_delete_Trafficroadgridinfo(Map map) throws SQLException{
		return trafficroadgridinfoDao.batch_delete_Trafficroadgridinfo(map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	
	public Integer count_Trafficroadgridinfo(Map map) throws SQLException{
		return trafficroadgridinfoDao.count_Trafficroadgridinfo(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	
	public List<Map> query_Trafficroadgridinfo(Map map) throws SQLException{
		return trafficroadgridinfoDao.query_Trafficroadgridinfo(map);
	}
	
	/*public List<Map> getPreRoad(Map map) throws SQLException{
		return trafficroadgridinfoDao.getPreRoad(map);
	}*/
	/**
	 * 查询一条
	 */
	 
	/*
	public Map get_Trafficroadgridinfo(Map map) throws SQLException{
		return trafficroadgridinfoDao.get_Trafficroadgridinfo(map);
	}
	*/
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportTrafficroadgridinfo(Map map) throws SQLException{
		return this.listTrafficroadgridinfoByPage(map);
	}
	*/
	
	/**
	 * Trafficroadgridinfo 分页
	 */
	
	public Map listTrafficroadgridinfoByPage(Map map) throws SQLException {
		List<Map> list = trafficroadgridinfoDao.query_Trafficroadgridinfo(map);
		Integer totalCount = trafficroadgridinfoDao.count_Trafficroadgridinfo(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	public Map get_TrafficroadgridinfoById(Map map) throws SQLException{
		return trafficroadgridinfoDao.get_TrafficroadgridinfoById(map);
	}
}
