package com.test.musichouduan.entity;

import jakarta.persistence.*;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

import java.time.LocalDateTime;

/**
 * 用户歌单关联实体
 */
@Data
@Entity
@Table(name = "user_playlist")
public class UserPlaylist {

    /**
     * ID
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 用户
     */
    @ManyToOne
    @JoinColumn(name = "user_id")
    private User user;

    /**
     * 歌单
     */
    @ManyToOne
    @JoinColumn(name = "playlist_id")
    private Playlist playlist;

    /**
     * 收藏时间
     */
    @CreationTimestamp
    @Column(name = "collect_time", updatable = false)
    private LocalDateTime collectTime;
}
