feat(user): 新增VIP字段及完善MyBatis-Plus映射
This commit is contained in:
@@ -22,6 +22,8 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* 用户前端控制器
|
||||
*
|
||||
@@ -76,7 +78,17 @@ public class UserController {
|
||||
public BaseResponse<KeyboardUserInfoRespVO> detail() {
|
||||
long loginId = StpUtil.getLoginIdAsLong();
|
||||
KeyboardUser keyboardUser = userService.getById(loginId);
|
||||
return ResultUtils.success(BeanUtil.copyProperties(keyboardUser, KeyboardUserInfoRespVO.class));
|
||||
KeyboardUserInfoRespVO respVO = BeanUtil.copyProperties(keyboardUser, KeyboardUserInfoRespVO.class);
|
||||
|
||||
// 格式化VIP到期时间
|
||||
if (keyboardUser.getVipExpiry() != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
respVO.setVipExpiry(sdf.format(keyboardUser.getVipExpiry()));
|
||||
} else {
|
||||
respVO.setVipExpiry(null);
|
||||
}
|
||||
|
||||
return ResultUtils.success(respVO);
|
||||
}
|
||||
|
||||
@PostMapping("/register")
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.yolo.keyborad.mapper;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/2 18:10
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yolo.keyborad.model.entity.KeyboardUser;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/11 20:35
|
||||
*/
|
||||
|
||||
public interface KeyboardUserMapper extends BaseMapper<KeyboardUser> {
|
||||
Integer updateByuid(KeyboardUser keyboardUser);
|
||||
}
|
||||
@@ -1,83 +1,124 @@
|
||||
package com.yolo.keyborad.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/2 18:08
|
||||
* @date: 2025/12/11 20:35
|
||||
*/
|
||||
|
||||
@Schema
|
||||
@Data
|
||||
@Schema(description="用户信息")
|
||||
@TableName(value = "keyboard_user")
|
||||
public class KeyboardUser {
|
||||
|
||||
@Schema(description="主键ID")
|
||||
@TableId(type = IdType.AUTO)
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description="用户ID")
|
||||
/**
|
||||
* 用户 Id
|
||||
*/
|
||||
@TableField(value = "\"uid\"")
|
||||
@Schema(description = "用户 Id")
|
||||
private Long uid;
|
||||
|
||||
@Schema(description="用户昵称")
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@TableField(value = "nick_name")
|
||||
@Schema(description = "用户昵称")
|
||||
private String nickName;
|
||||
|
||||
@Schema(description="性别")
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
@TableField(value = "gender")
|
||||
@Schema(description = "性别")
|
||||
private Integer gender;
|
||||
|
||||
@Schema(description="头像URL")
|
||||
/**
|
||||
* 头像地址
|
||||
*/
|
||||
@TableField(value = "avatar_url")
|
||||
@Schema(description = "头像地址")
|
||||
private String avatarUrl;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description="创建时间")
|
||||
@TableField(value = "created_at")
|
||||
@Schema(description = "创建时间")
|
||||
private Date createdAt;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Schema(description="更新时间")
|
||||
@TableField(value = "updated_at")
|
||||
@Schema(description = "更新时间")
|
||||
private Date updatedAt;
|
||||
|
||||
/**
|
||||
* 是否删除(默认否)
|
||||
*/
|
||||
@Schema(description="是否删除(默认否)")
|
||||
@TableField(value = "deleted")
|
||||
@Schema(description = "是否删除(默认否)")
|
||||
private Boolean deleted;
|
||||
|
||||
/**
|
||||
* 邮箱地址
|
||||
*/
|
||||
@Schema(description="邮箱地址")
|
||||
@TableField(value = "email")
|
||||
@Schema(description = "邮箱地址")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 是否禁用
|
||||
*/
|
||||
@Schema(description="是否禁用")
|
||||
@TableField(value = "\"status\"")
|
||||
@Schema(description = "是否禁用")
|
||||
private Boolean status;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Schema(description="密码")
|
||||
@TableField(value = "\"password\"")
|
||||
@Schema(description = "密码")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* 苹果登录subjectId
|
||||
*/
|
||||
@Schema(description="苹果登录subjectId")
|
||||
@TableField(value = "subject_id")
|
||||
@Schema(description = "苹果登录subjectId")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 邮箱是否验证
|
||||
*/
|
||||
@Schema(description="邮箱是否验证")
|
||||
@TableField(value = "email_verified")
|
||||
@Schema(description = "邮箱是否验证")
|
||||
private Boolean emailVerified;
|
||||
|
||||
/**
|
||||
* 是否是 VIP
|
||||
*/
|
||||
@TableField(value = "is_vip")
|
||||
@Schema(description = "是否是 VIP")
|
||||
private Boolean isVip;
|
||||
|
||||
/**
|
||||
* VIP 过期时间
|
||||
*/
|
||||
@TableField(value = "vip_expiry")
|
||||
@Schema(description = "VIP 过期时间")
|
||||
private Date vipExpiry;
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.yolo.keyborad.model.vo.user;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* @author: ziin
|
||||
* @date: 2025/12/2 18:08
|
||||
@@ -38,4 +40,16 @@ public class KeyboardUserInfoRespVO {
|
||||
@Schema(description="邮箱是否验证")
|
||||
private Boolean emailVerified;
|
||||
|
||||
/**
|
||||
* 是否是 VIP
|
||||
*/
|
||||
@Schema(description = "是否是 VIP")
|
||||
private Boolean isVip;
|
||||
|
||||
/**
|
||||
* VIP 过期时间
|
||||
*/
|
||||
@Schema(description = "VIP 过期时间")
|
||||
private String vipExpiry;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.yolo.keyborad.model.vo.user;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -42,4 +43,16 @@ public class KeyboardUserRespVO {
|
||||
|
||||
@Schema(description = "token")
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 是否是 VIP
|
||||
*/
|
||||
@Schema(description = "是否是 VIP")
|
||||
private Boolean isVip;
|
||||
|
||||
/**
|
||||
* VIP 过期时间
|
||||
*/
|
||||
@Schema(description = "VIP 过期时间")
|
||||
private Date vipExpiry;
|
||||
}
|
||||
@@ -17,11 +17,13 @@
|
||||
<result column="password" jdbcType="VARCHAR" property="password" />
|
||||
<result column="subject_id" jdbcType="VARCHAR" property="subjectId" />
|
||||
<result column="email_verified" jdbcType="BOOLEAN" property="emailVerified" />
|
||||
<result column="is_vip" jdbcType="BOOLEAN" property="isVip" />
|
||||
<result column="vip_expiry" jdbcType="TIMESTAMP" property="vipExpiry" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, "uid", nick_name, gender, avatar_url, created_at, updated_at, deleted, email,
|
||||
"status", "password", subject_id, email_verified
|
||||
"status", "password", subject_id, email_verified, is_vip, vip_expiry
|
||||
</sql>
|
||||
|
||||
<update id="updateByuid">
|
||||
|
||||
Reference in New Issue
Block a user