package cn.yw.sign.service;

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

	
	/**
	 * 修改记录
	 */
	public Integer update_Sign(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return SignDao.update_Sign(map);
	}
	
	/**
	 * 删除记录
	 */
	public Integer delete_Sign(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return SignDao.delete_Sign(map);

	}
	
	/**
	 * 批处理删除记录
	 */
	public Integer batch_delete_Sign(Map map) throws SQLException{
		return SignDao.batch_delete_Sign(map);
	}
	
	/**
	 * 查询总数
	 */
	public Integer count_Sign(Map map) throws SQLException{
		return SignDao.count_Sign(map);
	}
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Sign(Map map) throws SQLException{
		return SignDao.query_Sign(map);
	}
	
	/**
	 * 查询一条
	 */
	 
	public Map get_Sign(Map map) throws SQLException{
		return SignDao.get_Sign(map);
	}
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportSign(Map map) throws SQLException{
		return this.listSignByPage(map);
	}
	*/
	
	/**
	 * Sign 分页
	 */
	public Map listSignByPage(Map map) throws SQLException {
		List<Map> list = SignDao.query_Sign(map);
		Integer totalCount = SignDao.count_Sign(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}


}
