From 201a24155ebbbbdb256c4573cd23402012659867 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Wed, 19 Jul 2023 11:16:05 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.0=E3=80=91=E3=80=90sys=E3=80=91?= =?UTF-8?q?=E6=9B=B4=E6=96=B0user=E6=8E=A5=E5=8F=A3=EF=BC=8C=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=94=A8=E6=88=B7=E7=9A=84=E6=89=80=E6=9C=89=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kernel/sys/api/SysUserServiceApi.java | 9 ++ .../sys/api/pojo/user/UserInfoDetailDTO.java | 128 ++++++++++++++++++ .../user/service/impl/SysUserServiceImpl.java | 29 +++- 3 files changed, 162 insertions(+), 4 deletions(-) create mode 100644 kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/pojo/user/UserInfoDetailDTO.java diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SysUserServiceApi.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SysUserServiceApi.java index 91ac24567..27548c919 100644 --- a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SysUserServiceApi.java +++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/SysUserServiceApi.java @@ -26,6 +26,7 @@ package cn.stylefeng.roses.kernel.sys.api; import cn.stylefeng.roses.kernel.sys.api.pojo.user.OnlineUserItem; import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO; +import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserInfoDetailDTO; import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserValidateDTO; import java.util.List; @@ -117,4 +118,12 @@ public interface SysUserServiceApi { */ List getUserNameAccountInfoListByCondition(List onlineUserItems, String searchText); + /** + * 获取用户基本信息通过用户id + * + * @author fengshuonan + * @since 2023/7/19 11:08 + */ + UserInfoDetailDTO getUserDetail(Long userId); + } diff --git a/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/pojo/user/UserInfoDetailDTO.java b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/pojo/user/UserInfoDetailDTO.java new file mode 100644 index 000000000..7140d454c --- /dev/null +++ b/kernel-s-system/system-api/src/main/java/cn/stylefeng/roses/kernel/sys/api/pojo/user/UserInfoDetailDTO.java @@ -0,0 +1,128 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.sys.api.pojo.user; + +import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 较为全面的用户基本信息 + * + * @author fengshuonan + * @since 2023/7/19 11:06 + */ +@Data +public class UserInfoDetailDTO { + + /** + * 主键 + */ + @TableId(value = "user_id", type = IdType.ASSIGN_ID) + @ChineseDescription("主键") + private Long userId; + + /** + * 姓名 + */ + @TableField("real_name") + @ChineseDescription("姓名") + private String realName; + + /** + * 昵称 + */ + @TableField("nick_name") + @ChineseDescription("昵称") + private String nickName; + + /** + * 账号 + */ + @TableField("account") + @ChineseDescription("账号") + private String account; + + /** + * 生日 + */ + @TableField("birthday") + @ChineseDescription("生日") + private Date birthday; + + /** + * 性别:M-男,F-女 + */ + @ChineseDescription("性别:M-男,F-女") + private String sex; + + /** + * 邮箱 + */ + @ChineseDescription("邮箱") + private String email; + + /** + * 手机 + */ + @ChineseDescription("手机") + private String phone; + + /** + * 电话 + */ + @ChineseDescription("电话") + private String tel; + + /** + * 是否是超级管理员:Y-是,N-否 + */ + @ChineseDescription("是否是超级管理员:Y-是,N-否") + private String superAdminFlag; + + /** + * 状态:1-正常,2-冻结 + */ + @ChineseDescription("状态:1-正常,2-冻结") + private Integer statusFlag; + + /** + * 用户的排序 + */ + @ChineseDescription("用户的排序") + private BigDecimal userSort; + + /** + * 对接外部主数据的用户id + */ + @ChineseDescription("对接外部主数据的用户id") + private String masterUserId; + +} diff --git a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java index 3cab7bb43..5afaf1515 100644 --- a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java +++ b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java @@ -22,10 +22,7 @@ import cn.stylefeng.roses.kernel.sys.api.context.DataScopeContext; import cn.stylefeng.roses.kernel.sys.api.enums.user.UserStatusEnum; import cn.stylefeng.roses.kernel.sys.api.exception.enums.UserExceptionEnum; import cn.stylefeng.roses.kernel.sys.api.expander.SysConfigExpander; -import cn.stylefeng.roses.kernel.sys.api.pojo.user.OnlineUserItem; -import cn.stylefeng.roses.kernel.sys.api.pojo.user.SimpleUserDTO; -import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserOrgDTO; -import cn.stylefeng.roses.kernel.sys.api.pojo.user.UserValidateDTO; +import cn.stylefeng.roses.kernel.sys.api.pojo.user.*; import cn.stylefeng.roses.kernel.sys.modular.user.entity.SysUser; import cn.stylefeng.roses.kernel.sys.modular.user.enums.SysUserExceptionEnum; import cn.stylefeng.roses.kernel.sys.modular.user.factory.SysUserCreateFactory; @@ -492,6 +489,30 @@ public class SysUserServiceImpl extends ServiceImpl impl return resultList; } + @Override + public UserInfoDetailDTO getUserDetail(Long userId) { + + UserInfoDetailDTO result = new UserInfoDetailDTO(); + + if (ObjectUtil.isEmpty(userId)) { + return result; + } + + LambdaQueryWrapper sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); + sysUserLambdaQueryWrapper.eq(SysUser::getUserId, userId); + sysUserLambdaQueryWrapper.select(SysUser::getUserId, SysUser::getRealName, SysUser::getNickName, SysUser::getAccount, + SysUser::getBirthday, SysUser::getSex, SysUser::getPhone, SysUser::getTel, SysUser::getSuperAdminFlag, + SysUser::getStatusFlag, SysUser::getUserSort, SysUser::getMasterUserId); + SysUser userInfo = this.getOne(sysUserLambdaQueryWrapper); + + if (userInfo != null) { + BeanUtil.copyProperties(userInfo, result); + return result; + } + + return result; + } + /** * 获取信息 *