123333
This commit is contained in:
@@ -88,6 +88,11 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-sensitive-word</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- skywalking 整合 logback -->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.skywalking</groupId>-->
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.ruoyi.web.controller.sensitive;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.sensitive.domain.Word;
|
||||
import com.ruoyi.sensitive.service.WordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 敏感词
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-02-19
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/sensitive/word")
|
||||
public class WordController extends BaseController {
|
||||
|
||||
private final WordService wordService;
|
||||
|
||||
/**
|
||||
* 查询敏感词列表
|
||||
*/
|
||||
@SaCheckPermission("sensitive:word:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<Word> list(Word bo, PageQuery pageQuery) {
|
||||
Page<Word> page = wordService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||
return TableDataInfo.build(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出敏感词列表
|
||||
*/
|
||||
@SaCheckPermission("sensitive:word:export")
|
||||
@Log(title = "敏感词", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(Word bo, HttpServletResponse response) {
|
||||
List<Word> list = wordService.list(Wrappers.lambdaQuery(bo));
|
||||
ExcelUtil.exportExcel(list, "敏感词", Word.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取敏感词详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("sensitive:word:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<Word> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Integer id) {
|
||||
return R.ok(wordService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增敏感词
|
||||
*/
|
||||
@SaCheckPermission("sensitive:word:add")
|
||||
@Log(title = "敏感词", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody Word bo) {
|
||||
return toAjax(wordService.saveWord(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改敏感词
|
||||
*/
|
||||
@SaCheckPermission("sensitive:word:edit")
|
||||
@Log(title = "敏感词", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody Word bo) {
|
||||
return toAjax(wordService.updateWordById(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除敏感词
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("sensitive:word:remove")
|
||||
@Log(title = "敏感词", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Integer[] ids) {
|
||||
return toAjax(wordService.removeWordBatchByIds(Arrays.asList(ids)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user