lyhzzz пре 9 месеци
родитељ
комит
0d760be1d8

+ 25 - 4
src/main/java/com/fdkankan/manage/service/impl/JyUserPlatformServiceImpl.java

@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.manage.common.ExcelErrorUtil;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.common.ResultCode;
-import com.fdkankan.manage.entity.JyPlatform;
-import com.fdkankan.manage.entity.JyPlatformUserWait;
-import com.fdkankan.manage.entity.JyUser;
-import com.fdkankan.manage.entity.SysUser;
+import com.fdkankan.manage.entity.*;
 import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.vo.JyUserPlatform;
 import com.fdkankan.manage.exception.BusinessException;
@@ -21,6 +18,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.management.relation.Role;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -45,6 +43,8 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
     IJyUserService jyUserService;
     @Autowired
     ISysUserService sysUserService;
+    @Autowired
+    ISysRoleService sysRoleService;
 
 
     @Override
@@ -138,12 +138,33 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
             List<JyPlatform> jyPlatforms = platformService.listByIds(collect);
             jyPlatforms.forEach(e -> map.put(e.getId(),e));
         }
+        List<Integer> sysUserIds = jyUserPlatforms.stream().map(JyUserPlatform::getSysUserId).collect(Collectors.toList());
+        HashMap<Long,SysUser> sysUserMap = new HashMap<>();
+        HashMap<Long, SysRole> roleMap = new HashMap<>();
+        if(!sysUserIds.isEmpty()){
+            List<SysUser> sysUsers = sysUserService.listByIds(sysUserIds);
+            sysUsers.forEach(e -> sysUserMap.put(e.getId(),e));
+            List<Long> roleIds = sysUsers.stream().map(SysUser::getRoleId).collect(Collectors.toList());
+            if(!roleIds.isEmpty()){
+                List<SysRole> sysRoles = sysRoleService.listByIds(roleIds);
+                sysRoles.forEach(e -> roleMap.put(e.getId(),e));
+            }
+        }
         for (JyUserPlatform jyUserPlatform : jyUserPlatforms) {
             if(jyUserPlatform.getPlatformId()!=null){
                 JyPlatform jyPlatform =map.get(jyUserPlatform.getPlatformId());
                 if(jyPlatform != null){
                     jyUserPlatform.setPlatformName(jyPlatform.getPlatformName());
                 }
+                SysUser sysUser = sysUserMap.get(jyUserPlatform.getSysUserId());
+                if(sysUser != null){
+                    jyUserPlatform.setRoleId(sysUser.getRoleId());
+                }
+
+                SysRole sysRole = roleMap.get(jyUserPlatform.getRoleId());
+                if(sysRole != null){
+                    jyUserPlatform.setRoleName(sysRole.getRoleName());
+                }
             }
         }
         return jyUserPlatforms;

+ 4 - 0
src/main/java/com/fdkankan/manage/vo/JyUserPlatform.java

@@ -54,4 +54,8 @@ public class JyUserPlatform implements Serializable {
     private Date updateTime;
 
     private String platformName;
+
+    private Long sysUserId;
+    private Long roleId;
+    private String roleName;
 }

+ 1 - 1
src/main/resources/mapper/manage/JyUserPlatformMapper.xml

@@ -41,7 +41,7 @@
         order by  create_time desc,id desc
     </select>
     <select id="queryByKey" resultType="com.fdkankan.manage.vo.JyUserPlatform">
-        select  id,id_card,ry_nick_name as name ,phone,platform_id,status,create_time from  jy_user where rec_status = 'A' and status = 1
+        select  id,id_card,ry_nick_name as name ,phone,platform_id,status,create_time,sys_user_id from  jy_user where rec_status = 'A' and status = 1
         <if test="queryKey != null and queryKey !=''">
             and ( ry_nick_name = #{queryKey} or phone = #{queryKey} or id_card = #{queryKey}  )
         </if>