From 848d609a35569b029bbdd5ab91c1df2a0f568819 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 09 一月 2026 09:04:03 +0800
Subject: [PATCH] 浪潮对接单点登录:租户数据隔离功能3

---
 src/main/java/com/ruoyi/project/system/service/impl/SysPostServiceImpl.java |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/system/service/impl/SysPostServiceImpl.java b/src/main/java/com/ruoyi/project/system/service/impl/SysPostServiceImpl.java
index b013cbb..4deddb1 100644
--- a/src/main/java/com/ruoyi/project/system/service/impl/SysPostServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/system/service/impl/SysPostServiceImpl.java
@@ -1,10 +1,13 @@
 package com.ruoyi.project.system.service.impl;
 
+import java.util.Collections;
 import java.util.List;
+
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.common.constant.UserConstants;
-import com.ruoyi.common.exception.CustomException;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.project.system.domain.SysPost;
 import com.ruoyi.project.system.mapper.SysPostMapper;
@@ -32,6 +35,7 @@
      * @return 宀椾綅淇℃伅闆嗗悎
      */
     @Override
+    @DataScope(tenantIdFelid = "p")
     public List<SysPost> selectPostList(SysPost post)
     {
         return postMapper.selectPostList(post);
@@ -67,7 +71,7 @@
      * @return 閫変腑宀椾綅ID鍒楄〃
      */
     @Override
-    public List<Integer> selectPostListByUserId(Long userId)
+    public List<Long> selectPostListByUserId(Long userId)
     {
         return postMapper.selectPostListByUserId(userId);
     }
@@ -79,7 +83,7 @@
      * @return 缁撴灉
      */
     @Override
-    public String checkPostNameUnique(SysPost post)
+    public boolean checkPostNameUnique(SysPost post)
     {
         Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
         SysPost info = postMapper.checkPostNameUnique(post.getPostName());
@@ -97,7 +101,7 @@
      * @return 缁撴灉
      */
     @Override
-    public String checkPostCodeUnique(SysPost post)
+    public boolean checkPostCodeUnique(SysPost post)
     {
         Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
         SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
@@ -137,7 +141,6 @@
      * 
      * @param postIds 闇�瑕佸垹闄ょ殑宀椾綅ID
      * @return 缁撴灉
-     * @throws Exception 寮傚父
      */
     @Override
     public int deletePostByIds(Long[] postIds)
@@ -147,7 +150,7 @@
             SysPost post = selectPostById(postId);
             if (countUserPostById(postId) > 0)
             {
-                throw new CustomException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", post.getPostName()));
+                throw new ServiceException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", post.getPostName()));
             }
         }
         return postMapper.deletePostByIds(postIds);
@@ -176,4 +179,10 @@
     {
         return postMapper.updatePost(post);
     }
+
+    @Override
+    @DataScope(tenantIdFelid = "p")
+    public List<SysPost> selectPostByTenantId(Long tenantId) {
+        return postMapper.selectPostByTenantId(tenantId);
+    }
 }

--
Gitblit v1.9.3