package com.test.musichouduan.entity;

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

import java.time.LocalDateTime;

/**
 * 播放历史实体类
 */
@Data
@Entity
@Table(name = "play_history")
public class PlayHistory {

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

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

    /**
     * 音乐
     */
    @ManyToOne
    @JoinColumn(name = "music_id", nullable = false)
    private Music music;

    /**
     * 播放时间
     */
    @CreationTimestamp
    @Column(nullable = false)
    private LocalDateTime playTime;
}
