Java tutorial
/** * Copyright © 2012-2013 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); */ package com.lcw.one.modules.sys.entity; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.lcw.one.common.persistence.BaseEntity; import com.lcw.one.common.utils.IdGen; import org.hibernate.annotations.Cache; import org.hibernate.annotations.*; import javax.persistence.Entity; import javax.persistence.*; import javax.persistence.Table; import java.util.Date; /** * Entity * @author ThinkGem * @version 2013-05-30 */ @Entity @Table(name = "sys_log") @DynamicInsert @DynamicUpdate @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class Log extends BaseEntity<Log> { private static final long serialVersionUID = 1L; private String id; // ? private String type; // 12 private User createBy; // private Date createDate; // private String remoteAddr; // ?IP? private String requestUri; // ?URI private String method; // ?? private String params; // ???? private String userAgent; // ??? private String exception; // ? public static final String TYPE_ACCESS = "1"; public static final String TYPE_EXCEPTION = "2"; public Log() { super(); } public Log(String id) { this(); this.id = id; } @PrePersist public void prePersist() { this.id = IdGen.uuid(); } @Id public String getId() { return id; } public void setId(String id) { this.id = id; } public String getType() { return type; } public void setType(String type) { this.type = type; } @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "create_by") @NotFound(action = NotFoundAction.IGNORE) public User getCreateBy() { return createBy; } public void setCreateBy(User createBy) { this.createBy = createBy; } @Temporal(TemporalType.TIMESTAMP) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public String getRemoteAddr() { return remoteAddr; } public void setRemoteAddr(String remoteAddr) { this.remoteAddr = remoteAddr; } public String getUserAgent() { return userAgent; } public void setUserAgent(String userAgent) { this.userAgent = userAgent; } public String getRequestUri() { return requestUri; } public void setRequestUri(String requestUri) { this.requestUri = requestUri; } public String getMethod() { return method; } public void setMethod(String method) { this.method = method; } public String getParams() { return params; } public void setParams(String params) { this.params = params; } public String getException() { return exception; } public void setException(String exception) { this.exception = exception; } }