package com.example.springdatajpa.entity;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* @author : [WangWei]
* @version : [v1.0]
* @className : BaseEntity
* @description : [基础类]
* @createTime : [2022/11/18 15:32]
* @updateUser : [WangWei]
* @updateTime : [2022/11/18 15:32]
* @updateRemark : [描述说明本次修改内容]
*/
@MappedSuperclass
public class BaseEntity {
@NotBlank(message="创建人无能为空")
@Column(name = "create_by",columnDefinition = "varchar(32) COMMENT '创建人'",nullable = false)
private String createdBy;
@NotNull(message="创建人id不能为空")
@Column(name = "created_id",columnDefinition = "varchar(32) COMMENT '创建人id'",nullable = false)
private Long createdId;
@NotNull(message="创建时间不能为空")
@Column(name = "create_time",nullable = false,columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@Column(name = "updated_by",columnDefinition = "varchar(32) COMMENT '更新人'")
private String updateBy;
@Column(name = "updated_id",columnDefinition = "varchar(32) COMMENT '更新人id'")
private Long updateId;
@Column(name = "update_time",columnDefinition = "DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间'")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
@Column(name = "is_delete",columnDefinition = "tinyint(1) COMMENT '是否删除(0/1 未删除/删除)'")
private int isDelete=0;
@Column(name = "remark",columnDefinition = "varchar(64) COMMENT '备注'")
private String remark;
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Long getCreatedId() {
return createdId;
}
public void setCreatedId(Long createdId) {
this.createdId = createdId;
}
public Long getUpdateId() {
return updateId;
}
public void setUpdateId(Long updateId) {
this.updateId = updateId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
demo为spring boot项目 环境: 目前的程序环境是spring boot项目,JDK8.0,MySQL Connector / J 8.0(8.0版本支持java8及其以上的版本,支持5.6、5.7、8.0版本的mysql数据库,支持4.2版本的jdbc)。 如何使用: 只需要在application.yml文件中修改连接数据库的地址和数据库名以及账号和密码就可以一键使用。
资源推荐
资源详情
资源评论
收起资源包目录
spring-data-jpa.zip (14个子文件)
spring-data-jpa
pom.xml 2KB
target
test-classes
com
example
springdatajpa
SpringDataJpaApplicationTests.class 576B
generated-test-sources
test-annotations
classes
application.yml 433B
com
example
springdatajpa
SpringDataJpaApplication.class 778B
entity
UserEntity.class 3KB
BaseEntity.class 3KB
ClassEntity.class 2KB
generated-sources
annotations
src
test
java
com
example
springdatajpa
SpringDataJpaApplicationTests.java 224B
main
resources
application.yml 426B
java
com
example
springdatajpa
SpringDataJpaApplication.java 405B
entity
UserEntity.java 3KB
BaseEntity.java 3KB
ClassEntity.java 2KB
.gitignore 395B
共 14 条
- 1
资源评论
王卫——David
- 粉丝: 1w+
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功