Procházet zdrojové kódy

公示创建、修改人用昵称

lamphua před 1 dnem
rodič
revize
da57c692c5

+ 7
- 2
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java Zobrazit soubor

1
 package com.ruoyi.web.controller.system;
1
 package com.ruoyi.web.controller.system;
2
 
2
 
3
 import java.util.List;
3
 import java.util.List;
4
+
5
+import com.ruoyi.system.service.ISysUserService;
4
 import org.springframework.beans.factory.annotation.Autowired;
6
 import org.springframework.beans.factory.annotation.Autowired;
5
 //import org.springframework.security.access.prepost.PreAuthorize;
7
 //import org.springframework.security.access.prepost.PreAuthorize;
6
 import org.springframework.validation.annotation.Validated;
8
 import org.springframework.validation.annotation.Validated;
32
     @Autowired
34
     @Autowired
33
     private ISysNoticeService noticeService;
35
     private ISysNoticeService noticeService;
34
 
36
 
37
+    @Autowired
38
+    private ISysUserService userService;
39
+
35
     /**
40
     /**
36
      * 获取通知公告列表
41
      * 获取通知公告列表
37
      */
42
      */
62
     @PostMapping
67
     @PostMapping
63
     public AjaxResult add(@Validated @RequestBody SysNotice notice)
68
     public AjaxResult add(@Validated @RequestBody SysNotice notice)
64
     {
69
     {
65
-        notice.setCreateBy(getUsername());
70
+        notice.setCreateBy(userService.selectUserById(getLoginUser().getUserId()).getNickName());
66
         return toAjax(noticeService.insertNotice(notice));
71
         return toAjax(noticeService.insertNotice(notice));
67
     }
72
     }
68
 
73
 
74
     @PutMapping
79
     @PutMapping
75
     public AjaxResult edit(@Validated @RequestBody SysNotice notice)
80
     public AjaxResult edit(@Validated @RequestBody SysNotice notice)
76
     {
81
     {
77
-        notice.setUpdateBy(getUsername());
82
+        notice.setUpdateBy(userService.selectUserById(getLoginUser().getUserId()).getNickName());
78
         return toAjax(noticeService.updateNotice(notice));
83
         return toAjax(noticeService.updateNotice(notice));
79
     }
84
     }
80
 
85
 

Loading…
Zrušit
Uložit