package com.gci.boot.modules.system.service;

import com.gci.boot.constant.CacheConstant;
import com.gci.boot.modules.system.entity.SysPermission;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gci.boot.exception.GciBootException;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * <p>
 * 菜单权限表 服务类
 * </p>
 *
 * @author chenzhiwei
 * @since 2023-08-18
 */
public interface ISysPermissionService extends IService<SysPermission> {

    List<SysPermission> queryByUser(String username);

    void addPermission(SysPermission sysPermission) throws GciBootException;

    @CacheEvict(value = CacheConstant.SYS_DATA_PERMISSIONS_CACHE,allEntries=true)
    void editPermission(SysPermission sysPermission) throws GciBootException;

    @Transactional
    void deletePermission(String id) throws GciBootException;

    Set<String> getPermCodeSetByroleIds(Collection<String> roleIds);
}
