package cn.qinys.platform.upms.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.qinys.platform.entity.upms.UpmsRoleDepartment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Description:
 *
 * @author tanlie
 * Date: 2024/6/3 10:02
 */
@Repository
@Mapper
public interface UpmsRoleDepartmentMapper extends BaseMapper<UpmsRoleDepartment> {

    /**
     * 授权支局
     *
     * @param roleId
     * @return
     */
    @Select("SELECT department_id FROM upms_role_department WHERE role_id = #{roleId}")
    List<Integer> selectCheckedDepartment(@Param("roleId") String roleId);


    /**
     * 删除权限
     *
     * @param roleId
     */
    @Delete("DELETE FROM upms_role_department WHERE role_id = #{roleId}")
    void deleteByRoleId(@Param("roleId") String roleId);

}
