Member.java 3.65 KB
package com.topdraw.business.module.member.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.topdraw.business.module.common.validated.UpdateGroup;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author XiangHan
 * @date 2021-10-22
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_member")
public class Member implements Serializable {

    /** 运营商平台账号 */
    @Transient
    private String platformAccount;

    /** 会员过期时间 */
    @Column(name = "vip_expire_time", nullable = false)
    private LocalDateTime vipExpireTime;

    /** 主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    @Column(name = "id")
    @NotNull(message = "id can't be null!!",groups = {UpdateGroup.class})
    private Long id;

    /** 标识 */
    @Column(name = "code", nullable = false)
    private String code;

    /** 类型 1:大屏;2:小屏 */
    @Column(name = "`type`", nullable = false)
    private Integer type;

    /** 状态 0:不可用;1:可用 */
    @Column(name = "`status`", nullable = false)
    private Integer status;

    /** 昵称 base64 */
    @Column(name = "nickname")
    private String nickname;

    /** 描述 */
    @Column(name = "description")
    private String description;

    /** 性别 0:女;1:男;-1:未知 */
    @Column(name = "gender", nullable = false)
    private Integer gender;

    /** 生日 */
    @Column(name = "birthday")
    private String birthday;

    /** 头像 */
    @Column(name = "avatar_url")
    private String avatarUrl;

    /** 分组信息 */
    @Column(name = "`groups`")
    private String groups;

    /** 标签 */
    @Column(name = "tags")
    private String tags;

    /** 是否会员 0:非会员;1:会员 */
    @Column(name = "vip", nullable = false)
    private Integer vip;

    /** 会员等级(对应level表的level字段,非id) */
    @Column(name = "`level`", nullable = false)
    private Integer level;

    /** 成长值 */
    @Column(name = "`exp`")
    private Long exp;

    /** 当前积分 */
    @Column(name = "`points`")
    private Long points;

    /** 即将到期积分(一个月内) */
    @Column(name = "due_points")
    private Long duePoints;

    /** 优惠券数量 */
    @Column(name = "coupon_amount")
    private Long couponAmount;

    /** 即将过期优惠券数量 */
    @Column(name = "due_coupon_amount")
    private Long dueCouponAmount;

    /** iptv账号id */
    @Column(name = "user_iptv_id")
    private Long userIptvId;

    /** 绑定IPTV平台 0:未知;1:电信;2:移动;3:联通 */
    @Column(name = "bind_iptv_platform_type")
    private Integer bindIptvPlatformType;

    /** iptv账号绑定时间 */
    @Column(name = "bind_iptv_time")
    private LocalDateTime bindIptvTime;

    /** 创建时间 */
    @CreatedDate
    @Column(name = "create_time")
    private LocalDateTime createTime;

    /** 更新时间 */
    @LastModifiedDate
    @Column(name = "update_time")
    private LocalDateTime updateTime;

    /** 是否在黑名单 1:是;0否 */
    @Column(name = "black_status")
    private Long blackStatus;

    public void copy(Member source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(false));
    }
}