提交 355e2908 编写于 作者: M MaxKey

readme update

上级 812f24ba
......@@ -17,3 +17,4 @@ jdk/*
*/.classpath
*.xml.versionsBackup
*/*.xml.versionsBackup
.vscode/settings.json
......@@ -12,13 +12,16 @@
## 1、JPA 3注释
## 1.1、注释
仅支持6个注释
支持9个注释
> * @Entity
> * @Table
> * @Column
> * @Id
> * @GeneratedValue
> * @Transient
> * @Temporal
> * @ColumnDefault
> * @PartitionKey
## 1.2、主键策略
......@@ -40,13 +43,16 @@ public class Students extends JpaBaseEntity implements Serializable{
@Id
@Column
@GeneratedValue(strategy=GenerationType.AUTO,generator="snowflakeid")
@GeneratedValue
//@GeneratedValue(strategy=GenerationType.AUTO,generator="snowflakeid")
//@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SEQ_MYBATIS_STUD")
private String id;
@Column
private String stdNo;
@Column
private String stdName;
@Column
@ColumnDefault("'M'")
private String stdGender;
@Column
private int stdAge;
......@@ -56,7 +62,10 @@ public class Students extends JpaBaseEntity implements Serializable{
private String stdClass;
@Column
private byte[] images;
@Column(insertable = false)
@GeneratedValue
@Temporal(TemporalType.TIMESTAMP)
private LocalDateTime modifyDate;
//getter setter
}
```
......
package org.dromara.mybatis.jpa.annotations;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target({ FIELD, METHOD, ANNOTATION_TYPE })
public @interface CurrentTimestamp {
}
\ No newline at end of file
......@@ -17,6 +17,7 @@
package org.dromara.mybatis.jpa.test.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
import org.dromara.mybatis.jpa.annotations.ColumnDefault;
......@@ -73,11 +74,10 @@ public class Students extends JpaEntity implements Serializable {
private String stdClass;
@Column
private byte[] images;
@Column(insertable = false)
@GeneratedValue
@Temporal(TemporalType.TIMESTAMP)
private Date modifyDate;
private LocalDateTime modifyDate;
public Students() {
super();
......@@ -151,11 +151,11 @@ public class Students extends JpaEntity implements Serializable {
this.images = images;
}
public Date getModifyDate() {
public LocalDateTime getModifyDate() {
return modifyDate;
}
public void setModifyDate(Date modifyDate) {
public void setModifyDate(LocalDateTime modifyDate) {
this.modifyDate = modifyDate;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册