package shop.alien.storeplatform.service.impl;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import shop.alien.mapper.StorePlatformRoleMapper;
import shop.alien.storeplatform.service.StorePlatformRoleQueryService;

/**
 * 角色查询服务实现（SQL实现）
 */
@Service
@RequiredArgsConstructor
public class StorePlatformRoleQueryServiceImpl implements StorePlatformRoleQueryService {

    private final StorePlatformRoleMapper storePlatformRoleMapper;

    @Override
    public String getRoleNameById(Long roleId) {
        if (roleId == null) {
            return null;
        }
        String roleName = storePlatformRoleMapper.selectRoleNameById(roleId);
        return StringUtils.hasText(roleName) ? roleName : null;
    }
}
