From d9f9ba31913bb9f5053ad78109e8a3c1c00f1e6a Mon Sep 17 00:00:00 2001 From: houzhongjian <houzhongyi@126.com> Date: 星期二, 23 七月 2024 09:58:30 +0800 Subject: [PATCH] update framework --- iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java index 02428bc..e951bd2 100644 --- a/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java +++ b/iailab-module-system/iailab-module-system-biz/src/main/java/com/iailab/module/system/api/user/AdminUserApiImpl.java @@ -4,10 +4,13 @@ import cn.hutool.core.util.ObjUtil; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.util.object.BeanUtils; +import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.system.api.user.dto.AdminUserRespDTO; +import com.iailab.module.system.controller.admin.user.vo.user.UserSaveReqVO; import com.iailab.module.system.dal.dataobject.dept.DeptDO; import com.iailab.module.system.dal.dataobject.user.AdminUserDO; import com.iailab.module.system.service.dept.DeptService; +import com.iailab.module.system.service.permission.PermissionService; import com.iailab.module.system.service.user.AdminUserService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.RestController; @@ -27,6 +30,8 @@ private AdminUserService userService; @Resource private DeptService deptService; + @Resource + private PermissionService permissionService; @Override public CommonResult<AdminUserRespDTO> getUser(Long id) { @@ -86,4 +91,18 @@ return success(true); } + @Override + public void saveOrUpdateUserInfo(AdminUserRespDTO userRespDTO) { + AdminUserDO entity = ConvertUtils.sourceToTarget(userRespDTO, AdminUserDO.class); + AdminUserDO dto = userService.getUserByUsername(entity.getUsername()); + UserSaveReqVO bean = BeanUtils.toBean(dto, UserSaveReqVO.class); + if (dto != null) { + bean.setId(dto.getId()); + userService.updateUser(bean); + } else { + userService.createUser(bean); + } + permissionService.assignUserRole(entity.getId(), userRespDTO.getRoleIdList()); + } + } -- Gitblit v1.9.3