/*
 * Copyright 2002-2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.zuoxiaolong.niubi.job.persistent.entity;

import com.zuoxiaolong.niubi.job.core.helper.DateHelper;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author Xiaolong Zuo
 * @since 0.9.3
 */
@MappedSuperclass
public abstract class AbstractEntity implements Serializable {

	private static final long serialVersionUID = -3038921622628919854L;

	private String id;

	private Date createDate;

	private Date modifyDate;

	@Id
	@Column(length = 36, nullable = true)
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid2")
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(updatable = false)
	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getModifyDate() {
		return modifyDate;
	}

	public void setModifyDate(Date modifyDate) {
		this.modifyDate = modifyDate;
	}

    @Transient
    public String getModifyDateString() {
        return DateHelper.format(getModifyDate());
    }

    @Transient
    public String getCreateDateString() {
        return DateHelper.format(getCreateDate());
    }

	@Override
	public int hashCode() {
		return id == null ? System.identityHashCode(this) : id.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (getClass().getPackage() != obj.getClass().getPackage()) {
			return false;
		}
		final AbstractEntity other = (AbstractEntity) obj;
		if (id == null) {
			if (other.getId() != null) {
				return false;
			}
		} else if (!id.equals(other.getId())) {
			return false;
		}
		return true;
	}

}

@@ -863,16 +863,30 @@
 e;%0A%0A/**%0A
+ * %E5%AE%9E%E4%BD%93%E7%B1%BB%E7%9A%84%E7%88%B6%E7%B1%BB.%0A *%0A
  * @auth
@@ -1148,16 +1148,80 @@
 yDate;%0A%0A
+    /**%0A     * %E9%BB%98%E8%AE%A4%E4%BD%BF%E7%94%A836%E4%BD%8Duuid%E4%BD%9C%E4%B8%BA%E4%B8%BB%E9%94%AE%0A     *%0A     * @return id%0A     */%0A
 %09@Id%0A%09@C

删除不必要的类以及添加注释.