package com.ruoyi.sensitive.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.sensitive.cache.LastUpdateTimeCache;
import com.ruoyi.sensitive.domain.Word;
import com.ruoyi.sensitive.mapper.WordMapper;
import com.ruoyi.sensitive.service.WordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 敏感词Service业务层处理
 *
 * @author 77
 * @date 2024-02-19
 */
@Service
public class WordServiceImpl extends ServiceImpl<WordMapper,Word> implements WordService {

    @Autowired
    private LastUpdateTimeCache lastUpdateTimeCache;

    @Override
    public boolean removeWordBatchByIds(List<Integer> asList) {
        boolean re = this.removeBatchByIds(asList);
        lastUpdateTimeCache.setUpdateTime();
        return re;
    }

    @Override
    public boolean updateWordById(Word bo) {
        boolean re = this.updateById(bo);
        lastUpdateTimeCache.setUpdateTime();
        return re;
    }

    @Override
    public boolean saveWord(Word bo) {
        boolean re = this.save(bo);
        lastUpdateTimeCache.setUpdateTime();
        return re;
    }
}
