feat(music): 添加点赞功能并优化音乐解析
- 在 MusicPlayer 组件中添加点赞功能,使用 Check 和 Pointer 图标表示点赞状态 - 引入 toggleLikeMusic API 接口 - 优化歌词解析逻辑,提高代码可读性和性能 - 修改 UserLikeMusic 实体类,使用复合主键设计
This commit is contained in:
@@ -1,31 +1,28 @@
|
||||
package com.test.musichouduan.entity;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import org.hibernate.annotations.CreationTimestamp;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
/**
|
||||
* 用户点赞音乐实体类
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "user_like_music", uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = {"userId", "musicId"})
|
||||
})
|
||||
public class UserLikeMusic {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name = "user_like_music")
|
||||
@IdClass(UserLikeMusic.class)
|
||||
public class UserLikeMusic implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Id
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Id
|
||||
@Column(name = "music_id")
|
||||
private Long musicId;
|
||||
|
||||
@CreationTimestamp
|
||||
@Column(nullable = false, updatable = false)
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user