Forráskód Böngészése

用户隐私权限增加参数userId

fangqing 5 hónapja
szülő
commit
02ea50cd45

+ 7 - 2
ruoyi-generator/src/main/java/com/ruoyi/generator/controller/CommunitySettingsController.java

@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 社区设置管理
@@ -81,10 +82,14 @@ public class CommunitySettingsController {
     @ApiOperation("获取隐私权限")
     @GetMapping("/userPrivacy")
     //@Anonymous
-    public AjaxResult userPrivacy() {
+    public AjaxResult userPrivacy(@RequestParam(required = false) Long userId) {
+        if (Objects.isNull(userId)) {
+            userId = SecurityUtils.getLoginUser().getUserId();
+        }
+
         List<CommunityUserPrivacyVo> communityUserPrivacyVos = null;
         try {
-            communityUserPrivacyVos = communityPrivacyService.selectUserPrivacy(SecurityUtils.getLoginUser().getUserId());
+            communityUserPrivacyVos = communityPrivacyService.selectUserPrivacy(userId);
         } catch (Exception e) {
             throw new ProjectException();
         }