package com.hnshituo.core.auth.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.hnshituo.core.auth.vo.Role;
import com.hnshituo.orm.GenericMapper;

public interface RoleMapper extends GenericMapper<Role, Integer> {

	public List<Role> findByName(@Param("name")String name);
	
	public boolean hasWholeDataPrg(@Param("userId")String userId);
	
	public void insertUserRole(@Param("userId")String userId, @Param("ids")int[] ids);
	
	public void insertUserRole2(@Param("userId")String userId, @Param("roles")List<Role> roles);
	
	public void delRelationByUserId(@Param("userId")String userId);
	
	public String[] getDataPrg(@Param("userId")String userId, @Param("url")String url);
	public void insertDataPrg(@Param("roleId")int roleId, @Param("url")String url, @Param("departmentIds")String[] departmentIds);
	public void deleteDataPrgByRoleId(@Param("roleId")int roleId);
	public void deleteDataPrgByRoleIdAndFuncId(@Param("roleId")int roleId, @Param("url")String url);
	//验证用户是否为管理员
	public int isAdmin(String userId);

	public int findMaxId();
	
}
