【8.0】【sys】更新user接口,获取用户的所有基本信息

pull/57/head
fengshuonan 2023-07-19 11:16:05 +08:00
parent bed2599140
commit 201a24155e
3 changed files with 162 additions and 4 deletions

View File

@ -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<OnlineUserItem> getUserNameAccountInfoListByCondition(List<OnlineUserItem> onlineUserItems, String searchText);
/**
* id
*
* @author fengshuonan
* @since 2023/7/19 11:08
*/
UserInfoDetailDTO getUserDetail(Long userId);
}

View File

@ -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.
*
* GunsAPACHE 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;
}

View File

@ -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<SysUserMapper, SysUser> impl
return resultList;
}
@Override
public UserInfoDetailDTO getUserDetail(Long userId) {
UserInfoDetailDTO result = new UserInfoDetailDTO();
if (ObjectUtil.isEmpty(userId)) {
return result;
}
LambdaQueryWrapper<SysUser> 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;
}
/**
*
*