feat(user): 新增VIP字段及完善MyBatis-Plus映射

This commit is contained in:
2025-12-11 20:51:34 +08:00
parent 07ff9a5ff2
commit f391f9dfe1
6 changed files with 124 additions and 42 deletions

View File

@@ -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")