lyhzzz il y a 9 mois
Parent
commit
9ce9b25f68

+ 1 - 1
src/main/java/com/fdkankan/manage_jp/entity/UserPlatform.java

@@ -29,7 +29,7 @@ public class UserPlatform implements Serializable {
     private Integer id;
 
     @TableField("user_id")
-    private Integer userId;
+    private Long userId;
 
     @TableField("platform_key")
     private String platformKey;

+ 4 - 0
src/main/java/com/fdkankan/manage_jp/service/IUserPlatformService.java

@@ -4,6 +4,8 @@ import com.fdkankan.manage_jp.entity.UserPlatform;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.manage_jp.vo.request.GivePlatformAuthParam;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -15,4 +17,6 @@ import com.fdkankan.manage_jp.vo.request.GivePlatformAuthParam;
 public interface IUserPlatformService extends IService<UserPlatform> {
 
     void givePlatformAuth(GivePlatformAuthParam param);
+
+    List<UserPlatform> getByUserId(Long id);
 }

+ 5 - 3
src/main/java/com/fdkankan/manage_jp/service/impl/UserPlatformServiceImpl.java

@@ -47,7 +47,7 @@ public class UserPlatformServiceImpl extends ServiceImpl<IUserPlatformMapper, Us
 
     }
 
-    private void delByPlatformIds(Integer userId,List<Integer> delIds) {
+    private void delByPlatformIds(Long userId,List<Integer> delIds) {
         if(!delIds.isEmpty()){
             return;
         }
@@ -57,7 +57,7 @@ public class UserPlatformServiceImpl extends ServiceImpl<IUserPlatformMapper, Us
         this.remove(wrapper);
     }
 
-    private void saveByPlatformIds(Integer userId,List<Integer> addIds) {
+    private void saveByPlatformIds(Long userId,List<Integer> addIds) {
         if(!addIds.isEmpty()){
             return;
         }
@@ -73,7 +73,9 @@ public class UserPlatformServiceImpl extends ServiceImpl<IUserPlatformMapper, Us
         }
     }
 
-    private List<UserPlatform> getByUserId(Integer userId) {
+
+    @Override
+    public List<UserPlatform> getByUserId(Long userId) {
         LambdaQueryWrapper<UserPlatform> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(UserPlatform::getUserId,userId);
         return this.list(wrapper);

+ 7 - 8
src/main/java/com/fdkankan/manage_jp/service/impl/UserServiceImpl.java

@@ -10,16 +10,10 @@ import com.fdkankan.common.util.PasswordUtils;
 import com.fdkankan.common.util.SecurityUtil;
 import com.fdkankan.manage_jp.common.PageInfo;
 import com.fdkankan.manage_jp.common.ResultCode;
-import com.fdkankan.manage_jp.entity.Company;
-import com.fdkankan.manage_jp.entity.Role;
-import com.fdkankan.manage_jp.entity.User;
-import com.fdkankan.manage_jp.entity.UserRole;
+import com.fdkankan.manage_jp.entity.*;
 import com.fdkankan.manage_jp.exception.BusinessException;
 import com.fdkankan.manage_jp.mapper.IUserMapper;
-import com.fdkankan.manage_jp.service.ICompanyService;
-import com.fdkankan.manage_jp.service.IRoleService;
-import com.fdkankan.manage_jp.service.IUserRoleService;
-import com.fdkankan.manage_jp.service.IUserService;
+import com.fdkankan.manage_jp.service.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.manage_jp.util.PasswordUtil;
 import com.fdkankan.manage_jp.vo.request.LoginParam;
@@ -59,6 +53,8 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
     IUserRoleService userRoleService;
     @Autowired
     IRoleService roleService;
+    @Autowired
+    IUserPlatformService userPlatformService;
 
     @Override
     public User getByUserName(String managerPhone) {
@@ -179,6 +175,9 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
                 }
             }
             userVos.add(vo);
+
+            List<UserPlatform> userPlatforms = userPlatformService.getByUserId(record.getId());
+            vo.setPlatformIds(userPlatforms.stream().map(UserPlatform::getPlatformId).collect(Collectors.toList()));
         }
         Page<UserVo> pageVo = new Page<>(param.getPageNum(),param.getPageSize());
         pageVo.setTotal(page.getTotal());

+ 1 - 1
src/main/java/com/fdkankan/manage_jp/vo/request/GivePlatformAuthParam.java

@@ -7,6 +7,6 @@ import java.util.List;
 
 @Data
 public class GivePlatformAuthParam {
-    private Integer userId;
+    private Long userId;
     private List<Integer> platformIds = new ArrayList<>();
 }

+ 2 - 0
src/main/java/com/fdkankan/manage_jp/vo/response/UserVo.java

@@ -43,4 +43,6 @@ public class UserVo {
 
     private String companyName;
 
+    private List<Integer> platformIds;
+
 }