From b589d1c923f3fa2242bfa949506928e5a8b9e1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=9B=AA=E5=B0=94?= Date: Mon, 22 Dec 2025 10:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20src/main/java/com/vibevaul?= =?UTF-8?q?t/dto/SongDTO.java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/vibevault/dto/SongDTO.java | 45 +++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/vibevault/dto/SongDTO.java b/src/main/java/com/vibevault/dto/SongDTO.java index 4ae5296..fd8ffeb 100644 --- a/src/main/java/com/vibevault/dto/SongDTO.java +++ b/src/main/java/com/vibevault/dto/SongDTO.java @@ -1,9 +1,40 @@ package com.vibevault.dto; -public record SongDTO( - Long id, - String title, - String artist, - int durationInSeconds -) { -} +public class SongDTO { + // 1. 补全字段定义(之前截图里字段没写全) + private String title; + private String artist; + private Integer durationInSeconds; + + + public SongDTO(Long id, String title2, String artist2, int durationInSeconds2) { + //TODO Auto-generated constructor stub + } + + // 2. 补全getter方法(语法要完整) + public String getTitle() { + return title; + } + + public String getArtist() { + return artist; + } + + public Integer getDurationInSeconds() { + return durationInSeconds; + } + + + // 3. 补全setter方法(如果需要接收前端参数,必须写setter) + public void setTitle(String title) { + this.title = title; + } + + public void setArtist(String artist) { + this.artist = artist; + } + + public void setDurationInSeconds(Integer durationInSeconds) { + this.durationInSeconds = durationInSeconds; + } +} \ No newline at end of file