自定义xss校验注解实现

This commit is contained in:
RuoYi
2021-12-15 10:44:40 +08:00
parent ae8f069cbc
commit 5587d39d42
7 changed files with 97 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@ -68,7 +69,7 @@ public class SysNoticeController extends BaseController
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(SysNotice notice)
public AjaxResult addSave(@Validated SysNotice notice)
{
notice.setCreateBy(getLoginName());
return toAjax(noticeService.insertNotice(notice));
@ -92,7 +93,7 @@ public class SysNoticeController extends BaseController
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(SysNotice notice)
public AjaxResult editSave(@Validated SysNotice notice)
{
notice.setUpdateBy(getLoginName());
return toAjax(noticeService.updateNotice(notice));