修改个人中心修改昵称,弹出用户名不能为空提示
This commit is contained in:
@ -19,6 +19,7 @@ import lombok.Data;
|
|||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +100,25 @@ public class User implements Serializable {
|
|||||||
/** 性别 */
|
/** 性别 */
|
||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
|
public @interface Update {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
User user = (User) o;
|
||||||
|
return Objects.equals(id, user.id) &&
|
||||||
|
Objects.equals(username, user.username);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(id, username);
|
||||||
|
}
|
||||||
public void copy(User source){
|
public void copy(User source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,7 +150,7 @@ public class SysUserController {
|
|||||||
@Log("修改用户:个人中心")
|
@Log("修改用户:个人中心")
|
||||||
@ApiOperation("修改用户:个人中心")
|
@ApiOperation("修改用户:个人中心")
|
||||||
@PutMapping(value = "center")
|
@PutMapping(value = "center")
|
||||||
public ResponseEntity<Object> center(@Validated @RequestBody User resources){
|
public ResponseEntity<Object> center(@Validated(User.Update.class) @RequestBody User resources){
|
||||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||||
UserDto userDto = userService.findByName(SecurityUtils.getUsername());
|
UserDto userDto = userService.findByName(SecurityUtils.getUsername());
|
||||||
if(!resources.getId().equals(userDto.getId())){
|
if(!resources.getId().equals(userDto.getId())){
|
||||||
|
|||||||
Reference in New Issue
Block a user