Răsfoiți Sursa

返回内容修改

Signed-off-by: hamjin <335908093@qq.com>
hamjin 2 ani în urmă
părinte
comite
1ed48d4b49

+ 6 - 4
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/PoNoticeController.java

@@ -57,7 +57,7 @@ public class PoNoticeController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{poNoticeId}")
     @ApiOperation("获取通知公告内容")
-    public AjaxResult getInfo(@PathVariable Long poNoticeId) {
+    public AjaxResult getInfo(@PathVariable("poNoticeId") Long poNoticeId) {
         return success(poNoticeService.selectPoNoticeById(poNoticeId));
     }
 
@@ -69,8 +69,10 @@ public class PoNoticeController extends BaseController {
     @ApiOperation("添加通知公告")
     @PostMapping
     public AjaxResult add(@Validated @RequestBody PoNotice poNotice) {
-        System.out.println(poNotice);
-        return toAjax(poNoticeService.insertPoNotice(poNotice));
+        List<PoNotice> poNoticeList = poNoticeService.selectPoNoticeList(poNotice);
+        if (poNoticeList == null || poNoticeList.isEmpty())
+            return toAjax(poNoticeService.insertPoNotice(poNotice));
+        return error("重复的公告");
     }
 
     /**
@@ -83,7 +85,7 @@ public class PoNoticeController extends BaseController {
     public AjaxResult edit(@Validated @RequestBody PoNotice poNotice) {
         List<PoNotice> poNotice1 = poNoticeService.selectPoNoticeList(poNotice);
         if (poNotice1 == null || poNotice1.isEmpty())
-            return toAjax(false);
+            return error("要修改的公告不存在");
         poNotice.setUpdateBy(getUsername());
         poNotice.setPublisherId(getUserId());
         return toAjax(poNoticeService.updatePoNotice(poNotice));