소스 검색

用户修改

wangyangyang 4 년 전
부모
커밋
8c6cafc020

+ 2 - 0
user_center/src/main/java/com/huaxu/dao/OrgMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.huaxu.dto.OrgTree;
 import com.huaxu.entity.Org;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -88,4 +89,5 @@ public interface OrgMapper {
 
     List<Org> findOrgByTenant(String tenantId);
 
+    String findParentOrgByChildId(@Param(value = "childId") Integer childId);
 }

+ 1 - 1
user_center/src/main/java/com/huaxu/dao/UserMapper.java

@@ -38,7 +38,7 @@ public interface UserMapper extends BaseMapper<UserEntity> {
 
     List<UserEntity> findUserList(@Param("user")UserEntity userEntity);
 
-    List<UserEntity> findUserIdsForOrg(@Param("compayId")Integer compayId, @Param("deptId")Integer deptId);
+    List<UserEntity> findUserIdsForOrg(@Param("compayId")Integer compayId, @Param("deptId")Integer deptId,@Param("ids")String ids);
 
 
 

+ 1 - 0
user_center/src/main/java/com/huaxu/service/OrgService.java

@@ -88,4 +88,5 @@ public interface OrgService {
     IPage<Org> selectPage(Org org, IPage<Org> page);
     List<OrgTree> getTrees(Org org);
     List<OrgTree>getUserTrees(Org org);
+    String findParentOrgByChildId(Integer childId);
 }

+ 5 - 1
user_center/src/main/java/com/huaxu/service/UserService.java

@@ -346,7 +346,11 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
 		LoginUser currentUser = UserUtil.getCurrentUser();
 		Integer compayId = currentUser.getCompanyId();
 		Integer deptId = currentUser.getDepartmentId();
-		List<UserEntity> list = userMapper.findUserIdsForOrg(compayId,deptId);
+		compayId = 262;
+		String ids = "";
+		if (deptId != null)
+			ids = orgMapper.findParentOrgByChildId(deptId);
+		List<UserEntity> list = userMapper.findUserIdsForOrg(compayId, deptId, ids);
 		return list;
 	}
 	public List<Integer> findUserIdsByPermissonOrg(String tenantId,Integer companyOrgId,Integer deptOrgId){

+ 5 - 1
user_center/src/main/java/com/huaxu/service/impl/OrgServiceImpl.java

@@ -11,6 +11,7 @@ import com.huaxu.util.ByteArrayUtils;
 import com.huaxu.util.RedisUtil;
 import com.huaxu.util.UserUtil;
 import io.swagger.models.auth.In;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -326,5 +327,8 @@ public class OrgServiceImpl implements OrgService {
             return null;
         }
     }
-
+   public String findParentOrgByChildId(Integer childId)
+   {
+      return  orgMapper.findParentOrgByChildId(childId);
+   }
 }

+ 3 - 0
user_center/src/main/resources/mapper/OrgMapper.xml

@@ -292,4 +292,7 @@
         from uims_org
         where `STATUS` = 1 and TENANT_ID= #{tenantId}
     </select>
+    <select id="findParentOrgByChildId" resultType="String">
+       select getParentList(#{childId})
+    </select>
 </mapper>

+ 8 - 2
user_center/src/main/resources/mapper/UserMapper.xml

@@ -219,14 +219,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM uims_user a
         <include refid="sysAreaJoins"/>
         where a.status=1
-        <if test="compayId != null and compayId != ''">
+        <if test="compayId != null and compayId != '' and deptId != null and deptId != ''">
             and (
                a.COMPANY_ORG_ID = #{compayId}
                 <if test="deptId != null and deptId != ''">
-                   or a.DEPT_ORG_ID = #{deptId}
+                   and a.DEPT_ORG_ID in (#{ids})
                 </if>
             )
         </if>
+        <if test="compayId != null and compayId != '' and (deptId == null or deptId ==0 )">
+            and (
+                a.COMPANY_ORG_ID = #{compayId}
+                and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
+            )
+        </if>
     </select>
 
     <select id="findUserIdsByPermissonOrg" resultType="java.lang.Integer">