阅读背景:

使用AOP对公共字段进行保存(后台管理系统)

来源:互联网 

spring  hibernate

1、新建公共字段bean


@MappedSuperclass
public class BaseEntity {
	
	@Id
	@Column(name="id")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long id;
	
	@Column(name = "isdelete")
	private Integer isdelete;
	
	@Column(name = "createrId")
	private Long createrId;
	
	@Column(name = "createDate")
	private Date createDate;
	
	@Column(name = "updaterId")
	private Long updaterId;
	
	@Column(name = "updateDate")
	private Date updateDate;

	public Long getId() {
		return id;
	}

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

	public Integer getIsdelete() {
		return isdelete;
	}

	public void setIsdelete(Integer isdelete) {
		this.isdelete = isdelete;
	}

	public Long getCreaterId() {
		return createrId;
	}

	public void setCreaterId(Long createrId) {
		this.createrId = createrId;
	}

	@DateTimeFormat(pattern="yyyy-MM-dd")
	public Date getCreateDate() {
		return createDate;
	}

	@DateTimeFormat(pattern="yyyy-MM-dd")
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Long getUpdaterId() {
		return updaterId;
	}

	public void setUpdaterId(Long updaterId) {
		this.updaterId = updaterId;
	}

	@DateTimeFormat(pattern="yyyy-MM-dd")
	public Date getUpdateDate() {
		return updateDate;
	}
	
	@DateTimeFormat(pattern="yyyy-MM-dd")
	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}
}


@MappedSupercla




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: