package cn.yw.ywuserrolerelation.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.ywuserrolerelation.dao.YwuserrolerelationDao;

@Service("ywuserrolerelationService")
public class YwuserrolerelationService extends BaseService {
	
	private static Log log = LogFactory.getLog(YwuserrolerelationService.class);
	
	@Autowired
	private YwuserrolerelationDao ywuserrolerelationDao;
	
	/**
	 * 保存记录
	 */
	public void insert_Ywuserrolerelation(Map map) throws SQLException{
		CommUtils.addParams(map, false);
		ywuserrolerelationDao.insert_Ywuserrolerelation(map);
	}
	

	
	/**
	 * 修改记录
	 */
	public Integer update_Ywuserrolerelation(Map map) throws SQLException{
		CommUtils.validateUpdateParams(map);
		CommUtils.addParams(map, true);
		return ywuserrolerelationDao.update_Ywuserrolerelation(map);
	}
	
	
	/**
	 * 删除记录
	 */
	public Integer delete_Ywuserrolerelation(Map map) throws SQLException{
		CommUtils.validateDeleteParams(map);
		return ywuserrolerelationDao.delete_Ywuserrolerelation(map);
	}
	
	
	/**
	 * 查询总数
	 */
	public Integer count_Ywuserrolerelation(Map map) throws SQLException{
		return ywuserrolerelationDao.count_Ywuserrolerelation(map);
	}
	
	
	/**
	 * 查询列表记录SELECT
	 */
	public List<Map> query_Ywuserrolerelation(Map map) throws SQLException{
		return ywuserrolerelationDao.query_Ywuserrolerelation(map);
	}
	
	
	/**
	 * 查询一条
	 */
	public Map get_Ywuserrolerelation(Map map) throws SQLException{
		return ywuserrolerelationDao.get_Ywuserrolerelation(map);
	}
	
	/**
	 * Ywuserrolerelation 分页
	 */
	public Map listYwuserrolerelationByPage(Map map) throws SQLException {
		List<Map> list = ywuserrolerelationDao.query_Ywuserrolerelation(map);
		Integer totalCount = ywuserrolerelationDao.count_Ywuserrolerelation(map);
		map.clear();
		map.put("total", totalCount);
		map.put("rows", list);
		return map;
	}
	public List<Map> getALlUserByPower() throws SQLException {
		return ywuserrolerelationDao.getALlUserByPower();
	}
	
}
