mirror of https://github.com/halo-dev/halo
Add priority column in Post domain
parent
562da7b04b
commit
b461e7f651
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.model.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
|
@ -17,6 +18,7 @@ import java.util.Date;
|
|||
* @date : 2018/1/10
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_attachment")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
|
|
|
@ -2,6 +2,7 @@ package cc.ryanc.halo.model.domain;
|
|||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
@ -18,6 +19,7 @@ import java.util.List;
|
|||
* @date : 2017/11/30
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_category")
|
||||
public class Category implements Serializable {
|
||||
|
|
|
@ -3,6 +3,7 @@ package cc.ryanc.halo.model.domain;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
|
@ -22,6 +23,7 @@ import java.util.List;
|
|||
* @date : 2018/1/22
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_comment")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.model.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -17,6 +18,7 @@ import java.io.Serializable;
|
|||
* @date : 2018/2/26
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_gallery")
|
||||
public class Gallery implements Serializable {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.model.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -18,6 +19,7 @@ import java.io.Serializable;
|
|||
* @date : 2017/11/14
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_link")
|
||||
public class Link implements Serializable {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.model.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
|
@ -17,6 +18,7 @@ import java.util.Date;
|
|||
* @date : 2018/1/19
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_logs")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.model.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
|
@ -19,6 +20,7 @@ import java.io.Serializable;
|
|||
* @date : 2018/1/24
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_menu")
|
||||
public class Menu implements Serializable {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cc.ryanc.halo.model.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
@ -14,6 +15,7 @@ import java.io.Serializable;
|
|||
* @date : 2017/11/14
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@Entity
|
||||
@Table(name = "halo_options")
|
||||
public class Options implements Serializable {
|
||||
|
|
|
@ -5,7 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.hibernate.annotations.ColumnDefault;
|
||||
import org.springframework.data.annotation.LastModifiedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
|
@ -148,6 +148,12 @@ public class Post implements Serializable {
|
|||
*/
|
||||
private String customTpl;
|
||||
|
||||
/**
|
||||
* Post priority (default is 0)
|
||||
*/
|
||||
@ColumnDefault("0")
|
||||
private Integer priority;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
public Date getPostDate() {
|
||||
return postDate;
|
||||
|
@ -161,6 +167,7 @@ public class Post implements Serializable {
|
|||
@PrePersist
|
||||
public void prePersist() {
|
||||
DateTime now = DateUtil.date();
|
||||
|
||||
if (postDate == null) {
|
||||
postDate = now;
|
||||
}
|
||||
|
@ -168,6 +175,11 @@ public class Post implements Serializable {
|
|||
if (postUpdate == null) {
|
||||
postUpdate = now;
|
||||
}
|
||||
|
||||
if (priority == null) {
|
||||
priority = 0;
|
||||
}
|
||||
|
||||
postId = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ public class CommonController implements ErrorController {
|
|||
Throwable throwable = (Throwable) request.getAttribute("javax.servlet.error.exception");
|
||||
|
||||
if (throwable != null && StringUtils.startsWithIgnoreCase(throwable.getMessage(), "Could not resolve view with name '")) {
|
||||
log.error("Captured an exception", throwable);
|
||||
// TODO May cause unreasoned problem
|
||||
// if Ftl was not found then redirect to /404
|
||||
return "redirect:/404";
|
||||
|
|
|
@ -62,5 +62,4 @@ logging:
|
|||
level:
|
||||
cc.ryanc.halo: DEBUG
|
||||
org.hibernate: ERROR
|
||||
web: DEBUG
|
||||
file: ./logs/log.log
|
||||
|
|
Loading…
Reference in New Issue