package cn.yw.nhyw.sbxx.service;

 import cn.base.bean.BaseService;
import cn.base.util.CommUtils;
import cn.yw.nhyw.sbxx.dao.SbxxDao;
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("sbxxService")
public class SbxxService extends BaseService {
	
	private static Log log = LogFactory.getLog(SbxxService.class);
	
	@Autowired
	private SbxxDao sbxxDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Sbxx(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		sbxxDao.insert_Sbxx(map);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Sbxx(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return sbxxDao.update_Sbxx(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Sbxx(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return sbxxDao.delete_Sbxx(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Sbxx(Map map) throws SQLException{
		return sbxxDao.batch_delete_Sbxx(map);
	}
	
	/**
	 * 查询总数
	 */
	/*
	public Integer count_Sbxx(Map map) throws SQLException{
		return sbxxDao.count_Sbxx(map);
	}
	*/
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Sbxx(Map map) throws SQLException{
		return sbxxDao.query_Sbxx(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	/*
	public Map get_Sbxx(Map map) throws SQLException{
		return sbxxDao.get_Sbxx(map);
	}
	*/
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportSbxx(Map map) throws SQLException{
		return this.listSbxxByPage(map);
	}
	*/
	
	/**
	 * Sbxx 分页
	 */
	public Map listSbxxByPage(Map map) throws SQLException {
		List<Map> list = sbxxDao.query_Sbxx(map);
		Integer totalCount = sbxxDao.count_Sbxx(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}


	public Map list_TaskSbxxByPage(Map map) throws SQLException {
		List<Map> list = sbxxDao.query_TaskSbxxByPage(map);
		Integer totalCount = sbxxDao.count_TaskSbxxByPage(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
}
