Bladeren bron

添加获取用户信息

DESKTOP-USV654P\pc 10 maanden geleden
bovenliggende
commit
48141e01c7

+ 18 - 11
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -62,17 +62,7 @@ import com.xjrsoft.module.organization.service.IUserRoleRelationService;
 import com.xjrsoft.module.organization.service.IUserService;
 import com.xjrsoft.module.organization.service.IUserStudentService;
 import com.xjrsoft.module.organization.utils.OrganizationUtil;
-import com.xjrsoft.module.organization.vo.PendingCountDto;
-import com.xjrsoft.module.organization.vo.ResetUserPageVo;
-import com.xjrsoft.module.organization.vo.ResetUserRoleVo;
-import com.xjrsoft.module.organization.vo.UserDeptVo;
-import com.xjrsoft.module.organization.vo.UserInfoVo;
-import com.xjrsoft.module.organization.vo.UserListVo;
-import com.xjrsoft.module.organization.vo.UserPageVo;
-import com.xjrsoft.module.organization.vo.UserPostVo;
-import com.xjrsoft.module.organization.vo.UserRoleVo;
-import com.xjrsoft.module.organization.vo.UserStudentVo;
-import com.xjrsoft.module.organization.vo.UserVo;
+import com.xjrsoft.module.organization.vo.*;
 import com.xjrsoft.module.oss.factory.OssFactory;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.system.entity.File;
@@ -281,6 +271,23 @@ public class UserController {
         return R.ok(userVo);
     }
 
+    @GetMapping(value = "/detail")
+    @ApiOperation(value = "根据id查询用户信息")
+    public RT<UserDetailVo> detail(@RequestParam Long id) {
+        User user = userService.getById(id);
+        if (user == null) {
+            R.error("找不到此用户!");
+        }
+        UserDetailVo userVo = BeanUtil.toBean(user, UserDetailVo.class);
+        List<Long> deptIds = userDeptRelationService.list(Wrappers.lambdaQuery(UserDeptRelation.class)
+                        .eq(UserDeptRelation::getUserId, user.getId()))
+                .stream().map(UserDeptRelation::getDeptId).collect(Collectors.toList());
+        String allDeptIdStr = StrUtil.join(StringPool.COMMA, deptIds);
+        userVo.setDepartmentIds(allDeptIdStr);
+
+        return RT.ok(userVo);
+    }
+
     @PostMapping
     @ApiOperation(value = "新增用户")
     public R add(@Valid @RequestBody AddUserDto dto) {

+ 53 - 0
src/main/java/com/xjrsoft/module/organization/vo/UserDetailVo.java

@@ -0,0 +1,53 @@
+package com.xjrsoft.module.organization.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class UserDetailVo {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @ApiModelProperty("主键")
+    private String id;
+    /**
+     * 账户
+     */
+    @ApiModelProperty("账户")
+    private String userName;
+    /**
+     * 姓名
+     */
+    @ApiModelProperty("姓名")
+    private String name;
+    /**
+     * 性别
+     */
+    @ApiModelProperty("性别")
+    private String gender;
+    /**
+     * 手机号
+     */
+    @ApiModelProperty("手机号")
+    private String mobile;
+    /**
+     * 邮箱
+     */
+    @ApiModelProperty("邮箱")
+    private String email;
+    /**
+     * 部门
+     */
+    @ApiModelProperty("部门")
+    private String departmentIds;
+    /**
+     * 身份证
+     */
+    @ApiModelProperty("身份证")
+    private String credentialNumber;
+}

+ 1 - 1
src/main/java/com/xjrsoft/module/personnel/controller/CarMessageApplyController.java

@@ -75,7 +75,7 @@ public class CarMessageApplyController {
                         .eq(ObjectUtil.isNotNull(dto.getStatus())&&dto.getStatus()!=0, CarMessageApply::getStatus,dto.getStatus())
                         .select(CarMessageApply.class,x -> VoToColumnUtil.fieldsToColumns(CarMessageApplyPageVo.class).contains(x.getProperty()))
                         .select(CarMessageApply::getId)
-                        .leftJoin(XjrUser.class,XjrUser::getId,CarMessageApply::getCreateUserId, ext->ext.selectAs(XjrUser::getUserName, CarMessageApplyPageVo::getUserName))
+                        .leftJoin(XjrUser.class,XjrUser::getId,CarMessageApply::getCreateUserId, ext->ext.selectAs(XjrUser::getUserName, CarMessageApplyPageVo::getUserName).select(XjrUser::getMobile))
                         .leftJoin(DictionaryDetail.class,DictionaryDetail::getCode,CarMessageApply::getGender, ext->ext.selectAs(DictionaryDetail::getName, CarMessageApplyPageVo::getGender))
                 );
         PageOutput<CarMessageApplyPageVo> pageOutput = ConventPage.getPageOutput(page, CarMessageApplyPageVo.class);

+ 5 - 0
src/main/java/com/xjrsoft/module/personnel/vo/CarMessageApplyPageVo.java

@@ -116,5 +116,10 @@ public class CarMessageApplyPageVo {
      */
     @ApiModelProperty("账户")
     private String userName;
+    /**
+     * 手机
+     */
+    @ApiModelProperty("手机")
+    private  String mobile;
 
 }