feat: 用户更改自己基本信息功能
This commit is contained in:
parent
74807cfa96
commit
8e2e54de3a
@ -7,10 +7,8 @@ import com.guaiguailang.harmony.domain.entity.MenuDataItem;
|
||||
import com.guaiguailang.harmony.domain.entity.SystemRole;
|
||||
import com.guaiguailang.harmony.domain.entity.SystemRoleMenu;
|
||||
import com.guaiguailang.harmony.domain.vo.ResponseResult;
|
||||
import com.guaiguailang.harmony.domain.vo.SystemRoleMenuVO;
|
||||
import com.guaiguailang.harmony.service.AuthService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
|
@ -122,4 +122,13 @@ public class UserController {
|
||||
public ResponseEntity deleteUserRealy(@RequestBody ParamUserAdd userAddParam){
|
||||
return ResponseEntity.ok(userService.deleteUserReay(userAddParam));
|
||||
}
|
||||
@Operation(
|
||||
summary = "用户 更新",
|
||||
description = "用户更新(不涉及密码)",
|
||||
tags = {"用户相关接口"}
|
||||
)
|
||||
@PostMapping("/self/update-base-info")
|
||||
public ResponseEntity selfUpdateUserInfo(@RequestBody ParamUserAdd userAddParam){
|
||||
return ResponseEntity.ok(userService.selfUpdateUserInfo(userAddParam));
|
||||
}
|
||||
}
|
||||
|
@ -42,4 +42,6 @@ public interface UserMapper extends BaseMapper<UserInfo> {
|
||||
SystemRole getRoleLevelByUserId(Long id);
|
||||
@Update("update user_info set deleted=1 where id=#{id}")
|
||||
Integer changeDelete(Long id);
|
||||
@Update("update user_info set name=#{name},email=#{email},telephone=#{telephone} where id=#{id}")
|
||||
Integer selfUpdateUserInfo(Long id, String name, String email, String telephone);
|
||||
}
|
||||
|
@ -23,4 +23,6 @@ public interface UserService {
|
||||
ResponseResult deleteUser(ParamUserAdd userAddParam);
|
||||
|
||||
ResponseResult deleteUserReay(ParamUserAdd userAddParam);
|
||||
|
||||
ResponseResult selfUpdateUserInfo(ParamUserAdd userAddParam);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.guaiguailang.harmony.mapper.UserMapper;
|
||||
import com.guaiguailang.harmony.service.UserService;
|
||||
import com.guaiguailang.harmony.utils.PasswordEncryptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -280,6 +281,19 @@ return ResponseResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseResult selfUpdateUserInfo(ParamUserAdd userAddParam) {
|
||||
if (StringUtils.isAnyBlank(userAddParam.getId().toString(),userAddParam.getName())) {
|
||||
return ResponseResult.error("请输入昵称");
|
||||
}
|
||||
Integer result = userMapper.selfUpdateUserInfo(userAddParam.getId(),userAddParam.getName(),userAddParam.getEmail(),userAddParam.getTelphone());
|
||||
if (result==1){
|
||||
return ResponseResult.success();
|
||||
}else {
|
||||
return ResponseResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 方法
|
||||
public UserInfo getUserByAccount(String username){
|
||||
return userMapper.getUserByAccount(username);
|
||||
|
Loading…
Reference in New Issue
Block a user