mirror of https://github.com/halo-dev/halo
Refactor some entities
parent
ed8d86f2bd
commit
c45185dd6f
22
pom.xml
22
pom.xml
|
@ -235,17 +235,17 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>/**/application-dev.yaml</exclude>
|
||||
<exclude>/**/application-test.yaml</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--<plugin>-->
|
||||
<!--<groupId>org.apache.maven.plugins</groupId>-->
|
||||
<!--<artifactId>maven-jar-plugin</artifactId>-->
|
||||
<!--<version>3.0.2</version>-->
|
||||
<!--<configuration>-->
|
||||
<!--<excludes>-->
|
||||
<!--<exclude>/**/application-dev.yaml</exclude>-->
|
||||
<!--<exclude>/**/application-test.yaml</exclude>-->
|
||||
<!--</excludes>-->
|
||||
<!--</configuration>-->
|
||||
<!--</plugin>-->
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -5,6 +5,8 @@ import cc.ryanc.halo.model.enums.PostStatus;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
@ -15,7 +17,9 @@ import java.util.Date;
|
|||
* @author johnniang
|
||||
*/
|
||||
@Entity(name = "base_post")
|
||||
@Table(name = "posts")
|
||||
@Table(name = "posts", indexes = @Index(columnList = "url"))
|
||||
@SQLDelete(sql = "update posts set deleted = true where id = ?")
|
||||
@Where(clause = "deleted = false")
|
||||
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.INTEGER, columnDefinition = "int default 0")
|
||||
@Data
|
||||
@ToString
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package cc.ryanc.halo.model.entity;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
@ -13,8 +10,6 @@ import javax.persistence.Entity;
|
|||
* @date 3/22/19
|
||||
*/
|
||||
@Entity(name = "Journal")
|
||||
@Where(clause = "deleted = false")
|
||||
@SQLDelete(sql = "update posts set deleted = true where id = ?")
|
||||
@DiscriminatorValue("2")
|
||||
public class Journal extends BasePost {
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package cc.ryanc.halo.model.entity;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
@ -13,8 +10,6 @@ import javax.persistence.Entity;
|
|||
* @date 3/22/19
|
||||
*/
|
||||
@Entity(name = "Page")
|
||||
@Where(clause = "deleted = false")
|
||||
@SQLDelete(sql = "update posts set deleted = true where id = ?")
|
||||
@DiscriminatorValue("1")
|
||||
public class Page extends BasePost {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package cc.ryanc.halo.model.entity;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
|
||||
|
@ -12,8 +9,6 @@ import javax.persistence.Entity;
|
|||
* @author johnniang
|
||||
*/
|
||||
@Entity(name = "Post")
|
||||
@SQLDelete(sql = "update posts set deleted = true where id = ?")
|
||||
@Where(clause = "deleted = false")
|
||||
@DiscriminatorValue(value = "0")
|
||||
public class Post extends BasePost {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import javax.persistence.*;
|
|||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "tags")
|
||||
@Table(name = "tags", indexes = @Index(columnList = "slug_name"))
|
||||
@SQLDelete(sql = "update tags set deleted = true where id = ?")
|
||||
@Where(clause = "deleted = false")
|
||||
@ToString
|
||||
|
|
Loading…
Reference in New Issue