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.NhywfwsglDao;

@Service("nhywfwsglService")
public class NhywfwsglService extends BaseService {
	
	private static Log log = LogFactory.getLog(NhywfwsglService.class);
	
	@Autowired
	private NhywfwsglDao nhywfwsglDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Nhywfwsgl(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		nhywfwsglDao.insert_Nhywfwsgl(map);
	}
	

	
	/**
	 * 修改记录
	 */
	public Integer update_Nhywfwsgl(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return nhywfwsglDao.update_Nhywfwsgl(map);
	}

	
	/**
	 * 删除记录
	 */
	public Integer delete_Nhywfwsgl(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return nhywfwsglDao.delete_Nhywfwsgl(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Nhywfwsgl(Map map) throws SQLException{
		return nhywfwsglDao.batch_delete_Nhywfwsgl(map);
	}
	
	
	/**
	 * 查询总数
	 */
	public Integer count_Nhywfwsgl(Map map) throws SQLException{
		return nhywfwsglDao.count_Nhywfwsgl(map);
	}

	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Nhywfwsgl(Map map) throws SQLException{
		return nhywfwsglDao.query_Nhywfwsgl(map);
	}

	
	/**
	 * 查询一条
	 */
	public Map get_Nhywfwsgl(Map map) throws SQLException{
		return nhywfwsglDao.get_Nhywfwsgl(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportNhywfwsgl(Map map) throws SQLException{
		return this.listNhywfwsglByPage(map);
	}
	*/
	
	/**
	 * Nhywfwsgl 分页
	 */
	public Map listNhywfwsglByPage(Map map) throws SQLException {
		List<Map> list = nhywfwsglDao.query_Nhywfwsgl(map);
		Integer totalCount = nhywfwsglDao.count_Nhywfwsgl(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
}
