feat(user): 新增性别字段并补充Swagger注解

在注册DTO中加入gender字段,对应服务层同步设置该属性,同时为原有字段增加@Schema描述,方便前后端联调及接口文档生成。
This commit is contained in:
2025-12-04 16:56:00 +08:00
parent 155ed398a2
commit e1ffe3b3c5
2 changed files with 8 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package com.yolo.keyborad.model.dto.user;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/*
@@ -9,9 +10,15 @@ import lombok.Data;
@Data
public class UserRegisterDTO {
@Schema(description = "邮箱地址")
private String mailAddress;
@Schema(description = "密码")
private String password;
@Schema(description = "确认密码")
private String passwordConfirm;
@Schema(description = "性别")
private Integer gender;
}

View File

@@ -116,6 +116,7 @@ public class UserServiceImpl extends ServiceImpl<KeyboardUserMapper, KeyboardUse
keyboardUser.setNickName("User_" + RandomUtil.randomString(6));
keyboardUser.setPassword(passwordEncoder.encode(userRegisterDTO.getPassword()));
keyboardUser.setEmail(userRegisterDTO.getMailAddress());
keyboardUser.setGender(userRegisterDTO.getGender());
log.info(keyboardUser.toString());
int code = RandomUtil.randomInt(100000, 999999);
redisUtil.setEx("user:"+userRegisterDTO.getMailAddress(), String.valueOf(code),600, TimeUnit.SECONDS);