package cn.yw.repairmanage.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.yw.repairmanage.dao.YwrepairjobinfoDao;

@Service("ywrepairjobinfoService")
public class YwrepairjobinfoService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwrepairjobinfoService.class);
	
	@Autowired
	private YwrepairjobinfoDao ywrepairjobinfoDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywrepairjobinfo(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywrepairjobinfoDao.insert_Ywrepairjobinfo(map);
	}

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywrepairjobinfo(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywrepairjobinfoDao.update_Ywrepairjobinfo(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywrepairjobinfo(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywrepairjobinfoDao.delete_Ywrepairjobinfo(map);
	}
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Ywrepairjobinfo(Map map) throws SQLException{
		return ywrepairjobinfoDao.batch_delete_Ywrepairjobinfo(map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywrepairjobinfo(Map map) throws SQLException{
		return ywrepairjobinfoDao.count_Ywrepairjobinfo(map);
	}
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywrepairjobinfo(Map map) throws SQLException{
		return ywrepairjobinfoDao.query_Ywrepairjobinfo(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	public Map get_Ywrepairjobinfo(Map map) throws SQLException{
		return ywrepairjobinfoDao.get_Ywrepairjobinfo(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwrepairjobinfo(Map map) throws SQLException{
		return this.listYwrepairjobinfoByPage(map);
	}
	*/
	
	/**
	 * Ywrepairjobinfo 分页
	 */
	public Map listYwrepairjobinfoByPage(Map map) throws SQLException {
		List<Map> list = ywrepairjobinfoDao.query_Ywrepairjobinfo(map);
		Integer totalCount = ywrepairjobinfoDao.count_Ywrepairjobinfo(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	//获取用户信息
	public Map getUserInfo(Map map) throws SQLException{
		return ywrepairjobinfoDao.getUserInfo(map);
	}
	// 有权限审批工单的人所在的部门
	public List getReportBm(Map map) throws SQLException{
		return ywrepairjobinfoDao.getReportBm(map);
	}
	// 有权限审批工单的人
	public List getReportUser(Map map) throws SQLException{
		return ywrepairjobinfoDao.getReportUser(map);
	}
}
