alter
Change-Id: I20903adffc9a8d8ccd6070402137584f8fb2e5e5
This commit is contained in:
parent
b3070bc993
commit
3609e5b154
44
src/main/java/org/chobit/wp/enums/PostOrderBy.java
Normal file
44
src/main/java/org/chobit/wp/enums/PostOrderBy.java
Normal file
@ -0,0 +1,44 @@
|
||||
package org.chobit.wp.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum PostOrderBy {
|
||||
|
||||
/**
|
||||
* 按发布日期排序
|
||||
*/
|
||||
DATE("date"),
|
||||
/**
|
||||
* 按修改时间排序
|
||||
*/
|
||||
MODIFIED("modified"),
|
||||
/**
|
||||
* 按文章ID排序
|
||||
*/
|
||||
ID("ID "),
|
||||
/**
|
||||
* 按评论最多排序
|
||||
*/
|
||||
COMMENT_COUNT("comment_count "),
|
||||
/**
|
||||
* 按标题排序
|
||||
*/
|
||||
TITLE("title "),
|
||||
/**
|
||||
* 随机排序
|
||||
*/
|
||||
RAND("rand"),
|
||||
|
||||
;
|
||||
|
||||
public final String value;
|
||||
|
||||
PostOrderBy(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
13
src/main/java/org/chobit/wp/enums/SortOrder.java
Normal file
13
src/main/java/org/chobit/wp/enums/SortOrder.java
Normal file
@ -0,0 +1,13 @@
|
||||
package org.chobit.wp.enums;
|
||||
|
||||
public enum SortOrder {
|
||||
/**
|
||||
* 升序
|
||||
*/
|
||||
ASC,
|
||||
/**
|
||||
* 降序
|
||||
*/
|
||||
DESC,
|
||||
;
|
||||
}
|
@ -2,6 +2,9 @@ package org.chobit.wp.model.request;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.chobit.wp.enums.PostOrderBy;
|
||||
import org.chobit.wp.enums.PostStatus;
|
||||
import org.chobit.wp.enums.SortOrder;
|
||||
|
||||
/**
|
||||
* @author robin
|
||||
@ -12,15 +15,15 @@ public class PostFilter extends Request {
|
||||
private String postType;
|
||||
|
||||
@JsonProperty("post_status")
|
||||
private String postStatus;
|
||||
private PostStatus postStatus;
|
||||
|
||||
private int number;
|
||||
|
||||
private int offset;
|
||||
|
||||
private String orderBy;
|
||||
private PostOrderBy orderBy;
|
||||
|
||||
private String order;
|
||||
private SortOrder order;
|
||||
|
||||
|
||||
public String getPostType() {
|
||||
@ -31,11 +34,11 @@ public class PostFilter extends Request {
|
||||
this.postType = postType;
|
||||
}
|
||||
|
||||
public String getPostStatus() {
|
||||
public PostStatus getPostStatus() {
|
||||
return postStatus;
|
||||
}
|
||||
|
||||
public void setPostStatus(String postStatus) {
|
||||
public void setPostStatus(PostStatus postStatus) {
|
||||
this.postStatus = postStatus;
|
||||
}
|
||||
|
||||
@ -55,19 +58,19 @@ public class PostFilter extends Request {
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public String getOrderBy() {
|
||||
public PostOrderBy getOrderBy() {
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
public void setOrderBy(String orderBy) {
|
||||
public void setOrderBy(PostOrderBy orderBy) {
|
||||
this.orderBy = orderBy;
|
||||
}
|
||||
|
||||
public String getOrder() {
|
||||
public SortOrder getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(String order) {
|
||||
public void setOrder(SortOrder order) {
|
||||
this.order = order;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user