package cn.nhyw.khpj.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.nhyw.khpj.dao.NhywsbcsglDao;

@Service("nhywsbcsglService")
public class NhywsbcsglService extends BaseService {
	
	private static Log log = LogFactory.getLog(NhywsbcsglService.class);
	
	@Autowired
	private NhywsbcsglDao nhywsbcsglDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Nhywsbcsgl(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		nhywsbcsglDao.insert_Nhywsbcsgl(map);
	}
	

	
	/**
	 * 修改记录
	 */
	public Integer update_Nhywsbcsgl(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return nhywsbcsglDao.update_Nhywsbcsgl(map);
	}
	
	
	/**
	 * 删除记录
	 */
	public Integer delete_Nhywsbcsgl(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return nhywsbcsglDao.delete_Nhywsbcsgl(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	/*
	public Integer batch_delete_Nhywsbcsgl(Map map) throws SQLException{
		return nhywsbcsglDao.batch_delete_Nhywsbcsgl(map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	public Integer count_Nhywsbcsgl(Map map) throws SQLException{
		return nhywsbcsglDao.count_Nhywsbcsgl(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Nhywsbcsgl(Map map) throws SQLException{
		return nhywsbcsglDao.query_Nhywsbcsgl(map);
	}
	
	
	/**
	 * 查询一条
	 */
	public Map get_Nhywsbcsgl(Map map) throws SQLException{
		return nhywsbcsglDao.get_Nhywsbcsgl(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportNhywsbcsgl(Map map) throws SQLException{
		return this.listNhywsbcsglByPage(map);
	}
	*/
	
	/**
	 * Nhywsbcsgl 分页
	 */
	public Map listNhywsbcsglByPage(Map map) throws SQLException {
		List<Map> list = nhywsbcsglDao.query_Nhywsbcsgl(map);
		Integer totalCount = nhywsbcsglDao.count_Nhywsbcsgl(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
}
