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