package cn.yw.machinemanage.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.machinemanage.dao.YwmachinememoryDao;

@Service("ywmachinememoryService")
public class YwmachinememoryService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwmachinememoryService.class);
	
	@Autowired
	private YwmachinememoryDao ywmachinememoryDao;
	
	/**
	 * 保存记录
	 */
	
	public void insert_Ywmachinememory(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywmachinememoryDao.insert_Ywmachinememory(map);
	}
	

	
	/**
	 * 修改记录
	 */
	
	public Integer update_Ywmachinememory(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, false);
		return ywmachinememoryDao.update_Ywmachinememory(map);
	}
	
	
	/**
	 * 删除记录
	 */
	
	public Integer delete_Ywmachinememory(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywmachinememoryDao.delete_Ywmachinememory(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	
	public Integer batch_delete_Ywmachinememory(Map map) throws SQLException{
		return ywmachinememoryDao.batch_delete_Ywmachinememory(map);
	}
	
	
	/**
	 * 查询总数
	 */
	
	public Integer count_Ywmachinememory(Map map) throws SQLException{
		return ywmachinememoryDao.count_Ywmachinememory(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	
	public List<Map> query_Ywmachinememory(Map map) throws SQLException{
		return ywmachinememoryDao.query_Ywmachinememory(map);
	}
	
	
	/**
	 * 查询一条
	 */
	 
	
	public Map get_Ywmachinememory(Map map) throws SQLException{
		return ywmachinememoryDao.get_Ywmachinememory(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwmachinememory(Map map) throws SQLException{
		return this.listYwmachinememoryByPage(map);
	}
	*/
	
	/**
	 * Ywmachinememory 分页
	 */
	
	public Map listYwmachinememoryByPage(Map map) throws SQLException {
		List<Map> list = ywmachinememoryDao.query_Ywmachinememory(map);
		Integer totalCount = ywmachinememoryDao.count_Ywmachinememory(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	// 更新
	public Integer edit_Ywmachinememory(Map map) throws SQLException{
		return ywmachinememoryDao.edit_Ywmachinememory(map);
	}
}
