Quellcode durchsuchen

【CHG】修改数据权限

ZhaoMn vor 3 Jahren
Ursprung
Commit
b66040946d

+ 1 - 1
railway-admin/src/main/java/com/railway/web/controller/business/safetool/SecExperimentController.java

@@ -52,7 +52,7 @@ public class SecExperimentController extends BaseController {
 
   @ApiOperation(value = "设置安全工具是否合格")
   @PostMapping("/setToolNQ")
-  public AjaxResult setToolNQ(@RequestBody @Valid SecExpNQParmVo p) {
+  public AjaxResult setToolNq(@RequestBody @Valid SecExpNQParmVo p) {
     return toAjax(secExperimentService.setToolTestState(p));
   }
 

+ 3 - 1
railway-business/src/main/java/com/railway/business/safetool/service/impl/SecExperimentServiceImpl.java

@@ -152,7 +152,9 @@ public class SecExperimentServiceImpl implements ISecExperimentService {
    */
   @Override
   public List<SecExpListVo> getList(SecExpListParmVo parm) {
-    parm.setDeptId(SecurityUtils.getLoginUser().getDeptId());
+    if(!SecurityUtils.isAdmin()) {
+      parm.setDeptId(SecurityUtils.getLoginUser().getDeptId());
+    }
     return secExperimentMapper.getList(parm);
   }
 }

+ 3 - 1
railway-business/src/main/java/com/railway/business/safetool/service/impl/SecScheduledServiceImpl.java

@@ -122,7 +122,9 @@ public class SecScheduledServiceImpl implements ISecScheduledService {
    */
   @Override
   public List<SecScheduledCountVo> getList(SecScheduledListParmVo secScheduled) {
-    secScheduled.setDeptId(SecurityUtils.getLoginUser().getDeptId());
+    if(!SecurityUtils.isAdmin()){
+      secScheduled.setDeptId(SecurityUtils.getDeptId());
+    }
     List<SecScheduledCountVo> r = secScheduledMapper.getList(secScheduled);
     if (!CollectionUtils.isEmpty(r) && r.size() == 1) {
       if ("0件".equals(r.get(0).getC())) {

+ 11 - 0
railway-common/src/main/java/com/railway/common/utils/SecurityUtils.java

@@ -97,4 +97,15 @@ public class SecurityUtils {
   public static boolean isAdmin(Long userId) {
     return userId != null && 1L == userId;
   }
+
+  /**
+   * 是否为管理员
+   *
+   * @return 结果
+   */
+  public static boolean isAdmin() {
+    Long userId = getUserId();
+    return userId != null && 1L == userId;
+  }
+
 }