package com.tourism.webadmin.utils;

import com.github.houbb.sensitive.word.api.IWordAllow;
import com.tourism.webadmin.back.model.TourImSensitiveWordAllow;
import com.tourism.webadmin.back.service.TourImSensitiveWordAllowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

/**
 * MyWordAllowUtils 类。
 * <p>
 * 描述：自定义敏感词 白名单
 *
 * @author huangwenwen
 * @date 2024/12/20
 */


@Component
public class MyWordAllow implements IWordAllow {
    @Autowired
    private TourImSensitiveWordAllowService tourImSensitiveWordAllowService;

    @Override
    public List<String> allow() {

        List<TourImSensitiveWordAllow> allList = tourImSensitiveWordAllowService.getAllList();
        return allList.stream().map(TourImSensitiveWordAllow::getWord).collect(Collectors.toList());
    }
}
