package cn.yw.nhyw.nhywjtxcrzgl.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.yw.nhyw.nhywjtxcrzgl.dao.NhywjtssxcsbDao;
import net.sf.json.JSONArray;

@Service("nhywjtssxcsbService")
public class NhywjtssxcsbService extends BaseService {
	
	private static Log log = LogFactory.getLog(NhywjtssxcsbService.class);
	
	@Autowired
	private NhywjtssxcsbDao nhywjtssxcsbDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Nhywjtssxcsb(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		nhywjtssxcsbDao.insert_Nhywjtssxcsb(map);
	}
	public void batch_add_Nhywjtssxcsb(String xcdh,String xcsblx,JSONArray json) throws SQLException{
		nhywjtssxcsbDao.batch_add_Nhywjtssxcsb(xcdh,xcsblx,json);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Nhywjtssxcsb(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return nhywjtssxcsbDao.update_Nhywjtssxcsb(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Nhywjtssxcsb(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return nhywjtssxcsbDao.delete_Nhywjtssxcsb(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Nhywjtssxcsb(Map map) throws SQLException{
		return nhywjtssxcsbDao.batch_delete_Nhywjtssxcsb(map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Nhywjtssxcsb(Map map) throws SQLException{
		return nhywjtssxcsbDao.count_Nhywjtssxcsb(map);
	}
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Nhywjtssxcsb(Map map) throws SQLException{
		return nhywjtssxcsbDao.query_Nhywjtssxcsb(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	public Map get_Nhywjtssxcsb(Map map) throws SQLException{
		return nhywjtssxcsbDao.get_Nhywjtssxcsb(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportNhywjtssxcsb(Map map) throws SQLException{
		return this.listNhywjtssxcsbByPage(map);
	}
	*/
	
	/**
	 * Nhywjtssxcsb 分页
	 */
	public Map listNhywjtssxcsbByPage(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.query_Nhywjtssxcsb(map);
		Integer totalCount = nhywjtssxcsbDao.count_Nhywjtssxcsb(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listJksbByFwsbh(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJksbByFwsbh(map);
		Integer totalCount = nhywjtssxcsbDao.countJksbByFwsbh(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	//交通设备 - start
	public Map listJtsbByFwsbh_bx(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_bx(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_bx(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listJtsbByFwsbh_bz(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_bz(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_bz(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listJtsbByFwsbh_hl(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_hl(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_hl(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listJtsbByFwsbh_xhd(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_xhd(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_xhd(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listJtsbByFwsbh_ydp(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_ydp(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_ydp(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	public Map listJtsbByFwsbh_dc(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_dc(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_dc(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	public Map listJtsbByFwsbh_wb(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_wb(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_wb(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

	public Map listJtsbByFwsbh_ld(Map map) throws SQLException {
		List<Map> list = nhywjtssxcsbDao.listJtsbByFwsbh_ld(map);
		Integer totalCount = nhywjtssxcsbDao.countJtsbByFwsbh_ld(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	//交通设备 - end
}
