From 21682b7b7d9056a7b0fd50ebfc9425eca2d5d7af Mon Sep 17 00:00:00 2001 From: x ronger Date: Mon, 2 Dec 2019 09:02:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=8F=82=E6=95=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/rymcu/vertical/entity/Topic.java | 3 +++ src/main/java/com/rymcu/vertical/entity/User.java | 5 +++++ .../vertical/web/api/common/CommonApiController.java | 4 ++-- .../com/rymcu/vertical/web/api/tag/TagController.java | 8 ++++---- .../com/rymcu/vertical/web/api/topic/TopicController.java | 8 ++++---- .../com/rymcu/vertical/web/api/user/UserController.java | 8 ++++---- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/entity/Topic.java b/src/main/java/com/rymcu/vertical/entity/Topic.java index 0e7561e..4cb6c72 100644 --- a/src/main/java/com/rymcu/vertical/entity/Topic.java +++ b/src/main/java/com/rymcu/vertical/entity/Topic.java @@ -8,6 +8,9 @@ import javax.persistence.Id; import javax.persistence.Table; import java.util.Date; +/** + * @author ronger + */ @Data @Table(name = "vertical_topic") public class Topic { diff --git a/src/main/java/com/rymcu/vertical/entity/User.java b/src/main/java/com/rymcu/vertical/entity/User.java index e89a3bd..ad78aa1 100644 --- a/src/main/java/com/rymcu/vertical/entity/User.java +++ b/src/main/java/com/rymcu/vertical/entity/User.java @@ -1,5 +1,6 @@ package com.rymcu.vertical.entity; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; import org.apache.ibatis.type.JdbcType; import tk.mybatis.mapper.annotation.ColumnType; @@ -29,6 +30,7 @@ public class User implements Serializable,Cloneable { * 密码 * */ @Column(name = "password") + @JSONField(serialize=false) private String password; /** @@ -92,17 +94,20 @@ public class User implements Serializable,Cloneable { * 最后登录时间 * */ @Column(name = "last_login_time") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") private Date lastLoginTime; /** * 创建时间 * */ @Column(name = "created_time") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") private Date createdTime; /** * 创建时间 * */ @Column(name = "updated_time") + @JSONField(format = "yyyy-MM-dd HH:mm:ss") private Date updatedTime; } \ No newline at end of file diff --git a/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java b/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java index 7fe7302..2d65ff2 100644 --- a/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java +++ b/src/main/java/com/rymcu/vertical/web/api/common/CommonApiController.java @@ -94,8 +94,8 @@ public class CommonApiController { Map map = new HashMap(2); map.put("articles", pageInfo.getList()); Map pagination = new HashMap(3); - pagination.put("paginationPageCount",pageInfo.getPages()); - pagination.put("paginationPageNums",pageInfo.getNavigatepageNums()); + pagination.put("pageSize",pageInfo.getPageSize()); + pagination.put("total",pageInfo.getTotal()); pagination.put("currentPage",pageInfo.getPageNum()); map.put("pagination", pagination); return GlobalResultGenerator.genSuccessResult(map); diff --git a/src/main/java/com/rymcu/vertical/web/api/tag/TagController.java b/src/main/java/com/rymcu/vertical/web/api/tag/TagController.java index b4f23c6..cdf128e 100644 --- a/src/main/java/com/rymcu/vertical/web/api/tag/TagController.java +++ b/src/main/java/com/rymcu/vertical/web/api/tag/TagController.java @@ -25,11 +25,11 @@ public class TagController { PageHelper.startPage(page, rows); List list = articleService.findArticlesByTagName(name); PageInfo pageInfo = new PageInfo(list); - Map map = new HashMap(); + Map map = new HashMap(2); map.put("articles", pageInfo.getList()); - Map pagination = new HashMap(); - pagination.put("paginationPageCount",pageInfo.getPages()); - pagination.put("paginationPageNums",pageInfo.getNavigatepageNums()); + Map pagination = new HashMap(3); + pagination.put("pageSize",pageInfo.getPageSize()); + pagination.put("total",pageInfo.getTotal()); pagination.put("currentPage",pageInfo.getPageNum()); map.put("pagination", pagination); return GlobalResultGenerator.genSuccessResult(map); diff --git a/src/main/java/com/rymcu/vertical/web/api/topic/TopicController.java b/src/main/java/com/rymcu/vertical/web/api/topic/TopicController.java index 6bad0c7..611e520 100644 --- a/src/main/java/com/rymcu/vertical/web/api/topic/TopicController.java +++ b/src/main/java/com/rymcu/vertical/web/api/topic/TopicController.java @@ -35,11 +35,11 @@ public class TopicController { PageHelper.startPage(page, rows); List list = articleService.findArticlesByTopicName(name); PageInfo pageInfo = new PageInfo(list); - Map map = new HashMap(); + Map map = new HashMap(2); map.put("articles", pageInfo.getList()); - Map pagination = new HashMap(); - pagination.put("paginationPageCount",pageInfo.getPages()); - pagination.put("paginationPageNums",pageInfo.getNavigatepageNums()); + Map pagination = new HashMap(3); + pagination.put("pageSize",pageInfo.getPageSize()); + pagination.put("total",pageInfo.getTotal()); pagination.put("currentPage",pageInfo.getPageNum()); map.put("pagination", pagination); return GlobalResultGenerator.genSuccessResult(map); diff --git a/src/main/java/com/rymcu/vertical/web/api/user/UserController.java b/src/main/java/com/rymcu/vertical/web/api/user/UserController.java index 5d834fa..32f051f 100644 --- a/src/main/java/com/rymcu/vertical/web/api/user/UserController.java +++ b/src/main/java/com/rymcu/vertical/web/api/user/UserController.java @@ -40,11 +40,11 @@ public class UserController { PageHelper.startPage(page, rows); List list = articleService.findUserArticlesByIdUser(userDTO.getIdUser()); PageInfo pageInfo = new PageInfo(list); - Map map = new HashMap(); + Map map = new HashMap(2); map.put("articles", pageInfo.getList()); - Map pagination = new HashMap(); - pagination.put("paginationPageCount",pageInfo.getPages()); - pagination.put("paginationPageNums",pageInfo.getNavigatepageNums()); + Map pagination = new HashMap(3); + pagination.put("pageSize",pageInfo.getPageSize()); + pagination.put("total",pageInfo.getTotal()); pagination.put("currentPage",pageInfo.getPageNum()); map.put("pagination", pagination); return GlobalResultGenerator.genSuccessResult(map);