package com.xzx.log.entity; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.DateFormat; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType; import javax.validation.constraints.NotBlank; import java.util.Date; @Data @Document(indexName = "sysprogramlog") public class SysProgramLog { @Id private String id; @NotBlank(message = "消息内容不能为空") @Field(type = FieldType.Keyword) private String msg; @Field(type = FieldType.Date,format =DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern ="yyyy-MM-dd HH:mm:ss") private Date createTime; }