refactor: 个人中心个人信息完善
This commit is contained in:
@@ -43,7 +43,7 @@ public interface UserConverter {
|
||||
SysUser toEntity(UserImportDTO vo);
|
||||
|
||||
|
||||
UserProfileVO toProfileVO(SysUser entity);
|
||||
UserProfileVO toProfileVO(UserBO bo);
|
||||
|
||||
SysUser toEntity(UserProfileForm formData);
|
||||
}
|
||||
|
||||
@@ -56,4 +56,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
*/
|
||||
@DataPermission(deptAlias = "u")
|
||||
List<UserExportDTO> listExportUsers(UserPageQuery queryParams);
|
||||
|
||||
/**
|
||||
* 获取用户个人中心信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return
|
||||
*/
|
||||
UserBO getUserProfile(Long userId);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.youlai.system.model.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 个人中心用户信息
|
||||
*
|
||||
@@ -34,5 +37,14 @@ public class UserProfileVO {
|
||||
@Schema(description = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "角色名称")
|
||||
private String roleNames;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
*/
|
||||
@Override
|
||||
public UserProfileVO getUserProfile(Long userId) {
|
||||
SysUser entity = this.getById(userId);
|
||||
UserBO entity = this.baseMapper.getUserProfile(userId);
|
||||
return userConverter.toProfileVO(entity);
|
||||
}
|
||||
|
||||
|
||||
@@ -152,4 +152,26 @@
|
||||
GROUP BY u.id
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID获取用户详情 -->
|
||||
<select id="getUserProfile" resultType="com.youlai.system.model.bo.UserBO">
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.nickname,
|
||||
u.mobile,
|
||||
u.gender,
|
||||
u.avatar,
|
||||
u.STATUS,
|
||||
d.NAME AS deptName,
|
||||
GROUP_CONCAT(r.NAME) AS roleNames,
|
||||
u.create_time
|
||||
FROM
|
||||
sys_user u
|
||||
LEFT JOIN sys_dept d ON u.dept_id = d.id
|
||||
LEFT JOIN sys_user_role sur ON u.id = sur.user_id
|
||||
LEFT JOIN sys_role r ON sur.role_id = r.id
|
||||
WHERE
|
||||
u.id = #{userId} AND u.is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user