package com.CUST.brain.dao.mapper;

import com.CUST.brain.dao.domain.system.SysRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 系统角色Mapper接口
 */
public interface SysRoleMapper extends BaseMapper<SysRole> {
    
    /**
     * 根据用户ID查询角色列表
     *
     * @param userId 用户ID
     * @return 角色列表
     */
    List<SysRole> selectRolesByUserId(@Param("userId") String userId);

    @Update("UPDATE sys_role SET status = 0 WHERE id = #{roleId} AND status = 1")
    int disableRole(@Param("roleId") String roleId);

    @Update("UPDATE sys_role SET status = 1 WHERE id = #{roleId} AND status = 0")
    int restoreRole(@Param("roleId") String roleId);
} 