WeixinMessageTemplate.java 1.68 KB
package com.topdraw.weixin.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
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 java.io.Serializable;
import java.sql.Timestamp;

/**
 * @author pengmengqing
 * @date 2021-01-28
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@Accessors(chain = true)
@Table(name="uc_weixin_message_template")
public class WeixinMessageTemplate implements Serializable {

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

    // 标识 order-下单成功通知,cancellation-核销成功通知
    @Column(name = "code", nullable = false)
    private String code;

    // 微信appid
    @Column(name = "appid", nullable = false)
    private String appid;

    // 微信模板id
    @Column(name = "template_id", nullable = false)
    private String templateId;

    // 状态:0-无效,1-有效
    @Column(name = "status", nullable = false)
    private Integer status;

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

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

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

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