feat(user): 新增性别字段并补充Swagger注解
在注册DTO中加入gender字段,对应服务层同步设置该属性,同时为原有字段增加@Schema描述,方便前后端联调及接口文档生成。
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.yolo.keyborad.model.dto.user;
|
package com.yolo.keyborad.model.dto.user;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -9,9 +10,15 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class UserRegisterDTO {
|
public class UserRegisterDTO {
|
||||||
|
|
||||||
|
@Schema(description = "邮箱地址")
|
||||||
private String mailAddress;
|
private String mailAddress;
|
||||||
|
|
||||||
|
@Schema(description = "密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
|
||||||
|
@Schema(description = "确认密码")
|
||||||
private String passwordConfirm;
|
private String passwordConfirm;
|
||||||
|
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private Integer gender;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ public class UserServiceImpl extends ServiceImpl<KeyboardUserMapper, KeyboardUse
|
|||||||
keyboardUser.setNickName("User_" + RandomUtil.randomString(6));
|
keyboardUser.setNickName("User_" + RandomUtil.randomString(6));
|
||||||
keyboardUser.setPassword(passwordEncoder.encode(userRegisterDTO.getPassword()));
|
keyboardUser.setPassword(passwordEncoder.encode(userRegisterDTO.getPassword()));
|
||||||
keyboardUser.setEmail(userRegisterDTO.getMailAddress());
|
keyboardUser.setEmail(userRegisterDTO.getMailAddress());
|
||||||
|
keyboardUser.setGender(userRegisterDTO.getGender());
|
||||||
log.info(keyboardUser.toString());
|
log.info(keyboardUser.toString());
|
||||||
int code = RandomUtil.randomInt(100000, 999999);
|
int code = RandomUtil.randomInt(100000, 999999);
|
||||||
redisUtil.setEx("user:"+userRegisterDTO.getMailAddress(), String.valueOf(code),600, TimeUnit.SECONDS);
|
redisUtil.setEx("user:"+userRegisterDTO.getMailAddress(), String.valueOf(code),600, TimeUnit.SECONDS);
|
||||||
|
|||||||
Reference in New Issue
Block a user