package lingtao.net.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import lingtao.net.bean.SysRole;

public interface SysRoleMapper {

	int insertSelective(SysRole role);

	List<SysRole> getRoles(SysRole role);

	int updateByPrimaryKeySelective(SysRole role);

	int changeRoleStatus(@Param("roleId") String roleId);

	// 根据角色编号查询对应的权限编号集合
	public List<Integer> getPerIdsByRoleId(@Param("roleId") Integer roleId);

	public void deleteRolePermissions(Integer roleId);

	public void addRolePermissions(@Param("roleId") Integer roleId, @Param("perIds") String[] perIds);

	List<SysRole> getAllRoleName(@Param("isRegist") String isRegist);

	// 查询出用户所拥有的且允许被创建的角色
	List<SysRole> getRolesByUserId(@Param("userId") Integer userId);

	@Select("select roleId from tbl_sys_role where isRegist = '0'")
	List<Integer> getRoleIdsWhenIsNotRegist();

	@Select("select roleId from tbl_sys_role where isSelf = '0'")
	List<Integer> getRoleIdsWhenIsNotLingTao();
}
