package cn.yw.archive.companymanage.service;

import cn.yw.archive.companymanage.dao.YwarchivecompanyDao;
import cn.yw.archive.companymanage.dao.YwarchivecompanypersonDao;

import java.sql.SQLException;
import java.util.HashMap;
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;

@Service("ywarchivecompanypersonService")
public class YwarchivecompanypersonService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwarchivecompanypersonService.class);
	
	@Autowired
	private YwarchivecompanypersonDao ywarchivecompanypersonDao;

	@Autowired
	private YwarchivecompanyDao ywarchivecompanyDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywarchivecompanyperson(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		/*Map company = new HashMap();
		company.put("companyid", map.get("companyid"));
		Map companyMap = ywarchivecompanyDao.get_Ywarchivecompany(company);
		map.put("companyname", companyMap.get("companyname"));*/
		ywarchivecompanypersonDao.insert_Ywarchivecompanyperson(map);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywarchivecompanyperson(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywarchivecompanypersonDao.update_Ywarchivecompanyperson(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywarchivecompanyperson(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywarchivecompanypersonDao.delete_Ywarchivecompanyperson(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	/*
	public Integer batch_delete_Ywarchivecompanyperson(Map map) throws SQLException{
		return ywarchivecompanypersonDao.batch_delete_Ywarchivecompanyperson(map);
	}
	*/
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywarchivecompanyperson(Map map) throws SQLException{
		return ywarchivecompanypersonDao.count_Ywarchivecompanyperson(map);
	}
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywarchivecompanyperson(Map map) throws SQLException{
		return ywarchivecompanypersonDao.query_Ywarchivecompanyperson(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	/*
	public Map get_Ywarchivecompanyperson(Map map) throws SQLException{
		return ywarchivecompanypersonDao.get_Ywarchivecompanyperson(map);
	}
	*/
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwarchivecompanyperson(Map map) throws SQLException{
		return this.listYwarchivecompanypersonByPage(map);
	}
	*/
	
	/**
	 * Ywarchivecompanyperson 分页
	 */
	public Map listYwarchivecompanypersonByPage(Map map) throws SQLException {
		List<Map> list = ywarchivecompanypersonDao.query_Ywarchivecompanyperson(map);
		Integer totalCount = ywarchivecompanypersonDao.count_Ywarchivecompanyperson(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
}
