| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.article.controller.management.dto.MgtSensitiveWordsDTO; |
| | | import com.ruoyi.article.controller.management.dto.MgtSensitiveWordsQuery; |
| | | import com.ruoyi.article.controller.management.vo.MgtSensitiveWordsVO; |
| | | import com.ruoyi.article.domain.SensitiveWords; |
| | | import com.ruoyi.article.mapper.SensitiveWordsMapper; |
| | | import com.ruoyi.article.service.ISensitiveWordsService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.page.BeanUtils; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.system.api.domain.dto.judgeSensitiveWordsDTO; |
| | | import com.ruoyi.system.api.domain.vo.judgeSensitiveWordsVO; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.regex.Pattern; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | return SensitiveWordsVO; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取敏感词列表的分页数据 |
| | | * |
| | | * @param query 管理后台-敏感词查询对象 |
| | | * @return PageDTO<MgtSensitiveWordsVO> |
| | | */ |
| | | @Override |
| | | public PageDTO<MgtSensitiveWordsVO> getSensitiveWordsPage(MgtSensitiveWordsQuery query) { |
| | | PageDTO<MgtSensitiveWordsVO> pageVO; |
| | | Page<SensitiveWords> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(query.getWord()), SensitiveWords::getWord, |
| | | query.getWord()).orderByDesc(SensitiveWords::getCreateTime) |
| | | .page(new Page<>(query.getPageCurr(), query.getPageSize())); |
| | | if (StringUtils.isEmpty(page.getRecords())) { |
| | | pageVO = PageDTO.empty(page); |
| | | } else { |
| | | pageVO = PageDTO.of(page, MgtSensitiveWordsVO.class); |
| | | } |
| | | return pageVO; |
| | | } |
| | | |
| | | /** |
| | | * 添加敏感词 |
| | | * |
| | | * @param dto 敏感词数据传输对象 |
| | | */ |
| | | @Override |
| | | public void saveSensitiveWords(MgtSensitiveWordsDTO dto) { |
| | | this.save(BeanUtils.copyBean(dto, SensitiveWords.class)); |
| | | } |
| | | } |