package cn.yw.xhd.service;

import cn.base.bean.BaseService;
import cn.base.util.CommUtils;
import cn.yw.xhd.dao.NhywledydpxjbDao;
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("nhywledydpxjbService")
public class NhywledydpxjbService extends BaseService {

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

	@Autowired
	private NhywledydpxjbDao NhywledydpxjbDao;

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


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

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

	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Nhywledydpxjb(List l) throws SQLException{
		return NhywledydpxjbDao.batch_delete_Nhywledydpxjb(l);
	}
	public Integer batch_update_Nhywledydpxjb(Map m) throws SQLException{
		return NhywledydpxjbDao.batch_update_Nhywledydpxjb(m);
	}

	/**
	 * 查询总数
	 */
	public Integer count_Nhywledydpxjb(Map map) throws SQLException{
		return NhywledydpxjbDao.count_Nhywledydpxjb(map);
	}

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

	/**
	 * 查询一条
	 */

	public Map get_Nhywledydpxjb(Map map) throws SQLException{
		return NhywledydpxjbDao.get_Nhywledydpxjb(map);
	}

	/**
	 * 导出EXCEL
	 */

	/*
	public Map exportNhywledydpxjb(Map map) throws SQLException{
		return this.listNhywledydpxjbByPage(map);
	}
	*/

	public List<Map> getApproveUser(Map map) throws SQLException{
		return NhywledydpxjbDao.getApproveUser(map);
	}

	/**
	 * Nhywledydpxjb 分页
	 */
	public Map listNhywledydpxjbByPage(Map map) throws SQLException {
		List<Map> list = NhywledydpxjbDao.query_Nhywledydpxjb(map);
		Integer totalCount = NhywledydpxjbDao.count_Nhywledydpxjb(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listNhywledydpxjbtaskByPage(Map map) throws SQLException {
		List<Map> list = NhywledydpxjbDao.query_NhywledydpxjbtaskByPage(map);
		Integer totalCount = NhywledydpxjbDao.count_Nhywledydpxjb(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listNhywledydpxjbNotaskByPage(Map map) throws SQLException {
		List<Map> list = NhywledydpxjbDao.query_NhywledydpxjbNotaskByPage(map);
		Integer totalCount = NhywledydpxjbDao.count_NhywledydpxjbNotask(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public Map listNhywxlydptaskByPage(Map map) throws SQLException {
		List<Map> list = NhywledydpxjbDao.query_NhywxlydptaskByPage(map);
		Integer totalCount = NhywledydpxjbDao.count_Nhywxlydptask(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	/**
	 * 删除记录
	 */
	public Integer delete_Nhywxlydp(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return NhywledydpxjbDao.delete_Nhywxlydp(map);
	}
	public Integer batchdelete_Nhywxlydp(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return NhywledydpxjbDao.batchdelete_Nhywxlydp(map);
	}
	public void batchinsert_Nhywxlydp(List map) throws SQLException{
		 NhywledydpxjbDao.batchinsert_Nhywxlydp(map);
	}


	// 更新
	public Integer edit_Nhywledydpxjb(Map map) throws SQLException{
		return NhywledydpxjbDao.edit_Nhywledydpxjb(map);
	}

}
