Browse Source

用户修改

wangyangyang 4 years ago
parent
commit
e3ffe35516

+ 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,@Param("ids")List<Long> ids);
+    List<UserEntity> findUserIdsForOrg(@Param("compayId")Integer compayId, @Param("deptId")Integer deptId,@Param("ids")List<Long> ids,@Param("compids")List<Long> comIds);
 
 
 

+ 11 - 3
user_center/src/main/java/com/huaxu/service/UserService.java

@@ -349,13 +349,21 @@ public class UserService extends ServiceImpl<UserMapper,UserEntity> {
 		String ids = "";
 		if (deptId != null)
 			ids = orgMapper.findParentOrgByChildId(deptId);
+		//查询公司
+		String comps = orgMapper.findParentOrgByChildId(compayId);
+		String[] compids = comps.split(",");
+		List<Long> compList = new ArrayList<>();
+		for (String item : compids) {
+			if (!item.equals(compayId.toString()))
+				compList.add(Long.valueOf(item));
+		}
+
 		List<Long> idList = new ArrayList<>();
 		String[] as = ids.split(",");
-		for(String item : as)
-		{
+		for (String item : as) {
 			idList.add(Long.valueOf(item));
 		}
-		List<UserEntity> list = userMapper.findUserIdsForOrg(compayId, deptId, idList);
+		List<UserEntity> list = userMapper.findUserIdsForOrg(compayId, deptId, idList,compList);
 		return list;
 	}
 	public List<Integer> findUserIdsByPermissonOrg(String tenantId,Integer companyOrgId,Integer deptOrgId){

+ 18 - 3
user_center/src/main/resources/mapper/UserMapper.xml

@@ -222,21 +222,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="sysAreaJoins"/>
         where a.status=1
         <if test="compayId != null and compayId != '' and deptId != null and deptId != ''">
-            and (
+            and ((
                a.COMPANY_ORG_ID = #{compayId}
                 <if test="deptId != null and deptId != ''">
-                   and a.DEPT_ORG_ID in
+                   and (a.DEPT_ORG_ID in
                     <foreach collection="ids" item="item" open="(" close=")" separator=",">
                         #{item}
-                    </foreach>
+                    </foreach> or a.DEPT_ORG_ID is null or a.DEPT_ORG_ID =0)
                 </if>
             )
+           or(
+                a.COMPANY_ORG_ID in
+                <foreach collection="compids" item="item" open="(" close=")" separator=",">
+                  #{item}
+                </foreach>
+            )
+            )
         </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)
             )
+            or(
+                a.COMPANY_ORG_ID in
+                    <foreach collection="compids" item="item" open="(" close=")" separator=",">
+                        #{item}
+                    </foreach>
+                )
+            )
         </if>
     </select>