完善论坛贴接口

master
panqihua 5 years ago
parent 16c39125bd
commit 11d94ccd1a
  1. 1
      src/main/java/com/community/pocket/api/web/WebForumController.java
  2. 2
      src/main/java/com/community/pocket/repository/android/ForumDao.java
  3. 5
      src/test/java/com/community/pocket/DemoApplicationTests.java

@ -64,6 +64,7 @@ public class WebForumController {
}
}
//帖子审核接口
@PostMapping("/api/forum/posts/check")
public ForumCheckResponse check(@RequestBody ForumCheck forumCheck) {
if (forumDao.check(forumCheck)) {

@ -105,7 +105,7 @@ public class ForumDao extends BaseDao<Forum> {
try {
Criteria criteria = new Criteria();
if (!StringUtils.isEmpty(forumQuery.getStatus())) {
Criteria.where("status").is(forumQuery.getStatus());
criteria = Criteria.where("status").is(forumQuery.getStatus());
}
if (!StringUtils.isEmpty(forumQuery.getUsername())) {
criteria = criteria.and("username").is(forumQuery.getUsername());

@ -1,5 +1,6 @@
package com.community.pocket;
import com.community.pocket.entity.po.Forum;
import com.community.pocket.entity.po.android.Garbage;
import com.community.pocket.entity.po.android.GarbageWastePrice;
import com.community.pocket.entity.vo.android.GarbageCateGory;
@ -143,14 +144,16 @@ class DemoApplicationTests {
).andDo(MockMvcResultHandlers.print()).andReturn();
}
//测试查询帖子
@Test
void queryForum() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/api/forum/posts")
.param("status", Forum.ForumStatus.ok.name())
.param("currentPage", "1")
).andDo(MockMvcResultHandlers.print()).andReturn();
}
//测试登陆
@Test
void login() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.post("/login")

Loading…
Cancel
Save