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.YwmachinecpuDao;

@Service("ywmachinecpuService")
public class YwmachinecpuService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwmachinecpuService.class);
	
	@Autowired
	private YwmachinecpuDao ywmachinecpuDao;
	
	/**
	 * 保存记录
	 */
	
	public void insert_Ywmachinecpu(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywmachinecpuDao.insert_Ywmachinecpu(map);
	}
	

	
	/**
	 * 修改记录
	 */
	
	public Integer update_Ywmachinecpu(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, false);
		return ywmachinecpuDao.update_Ywmachinecpu(map);
	}
	
	
	/**
	 * 删除记录
	 */
	
	public Integer delete_Ywmachinecpu(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywmachinecpuDao.delete_Ywmachinecpu(map);
	}
	
	
	/**
	 * 批处理删除记录
	 */
	
	public Integer batch_delete_Ywmachinecpu(Map map) throws SQLException{
		return ywmachinecpuDao.batch_delete_Ywmachinecpu(map);
	}
	
	
	/**
	 * 查询总数
	 */
	
	public Integer count_Ywmachinecpu(Map map) throws SQLException{
		return ywmachinecpuDao.count_Ywmachinecpu(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	
	public List<Map> query_Ywmachinecpu(Map map) throws SQLException{
		return ywmachinecpuDao.query_Ywmachinecpu(map);
	}
	
	
	/**
	 * 查询一条
	 */
	 
	
	public Map get_Ywmachinecpu(Map map) throws SQLException{
		return ywmachinecpuDao.get_Ywmachinecpu(map);
	}
	
	
	/**
	 * 导出EXCEL
	 */
	 
	/*
	public Map exportYwmachinecpu(Map map) throws SQLException{
		return this.listYwmachinecpuByPage(map);
	}
	*/
	
	/**
	 * Ywmachinecpu 分页
	 */
	
	public Map listYwmachinecpuByPage(Map map) throws SQLException {
		List<Map> list = ywmachinecpuDao.query_Ywmachinecpu(map);
		Integer totalCount = ywmachinecpuDao.count_Ywmachinecpu(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	
	
	// 更新
	public Integer edit_Ywmachinecpu(Map map) throws SQLException{
		return ywmachinecpuDao.edit_Ywmachinecpu(map);
	}
}
