package cn.nhyw.khpj.service;

import cn.base.bean.BaseService;
import cn.base.util.CommUtils;
import cn.nhyw.khpj.dao.YwglbmkhDao;
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 java.sql.SQLException;
import java.util.List;
import java.util.Map;

@Service("ywglbmkhService")
public class YwglbmkhService extends BaseService {

	private static Log log = LogFactory.getLog(YwglbmkhService.class);

	@Autowired
	private YwglbmkhDao YwglbmkhDao;

	/**
	 * 保存记录
	 */
	public void insert_Ywglbmkh(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		YwglbmkhDao.insert_Ywglbmkh(map);
	}



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


	/**
	 * 删除记录
	 */
	public Integer delete_Ywglbmkh(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return YwglbmkhDao.delete_Ywglbmkh(map);
	}


	/**
	 * 批处理删除记录
	 */
	/*
	public Integer batch_delete_Ywglbmkh(Map map) throws SQLException{
		return YwglbmkhDao.batch_delete_Ywglbmkh(map);
	}
	*/

	/**
	 * 查询总数
	 */
	public Integer count_Ywglbmkh(Map map) throws SQLException{
		return YwglbmkhDao.countYwglbmkh(map);
	}


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


	/**
	 * 导出EXCEL
	 */

	/*
	public Map exportYwglbmkh(Map map) throws SQLException{
		return this.listYwglbmkhByPage(map);
	}
	*/

	/**
	 * Ywglbmkh 分页
	 */
	public Map listYwglbmkhByPage(Map map) throws SQLException {
		List<Map> list = YwglbmkhDao.queryYwglbmkh(map);
		Integer totalCount = YwglbmkhDao.countYwglbmkh(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}

}
