InformationController.java
3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.server.web.controller;
import com.server.web.common.model.TKzyUser;
import com.server.web.common.service.InformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* Created by weiwenfu@163.com on 2020/3/12 下午 4:53.
*/
@RestController
@RequestMapping(value = BaseController.WX_NAMESPACE + "/information", produces = "application/json")
public class InformationController extends BaseController {
@Autowired
private InformationService informationService;
/**
* 二级分类
*
* @return
*/
@ResponseBody
@RequestMapping(value = "/secondClassList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map<String, Object> secondClassList(HttpServletRequest request, @RequestParam(value = "firstId") Long firstId) {
return informationService.secondClassList(firstId);
}
/**
* 二级分类详情
*
* @return
*/
@ResponseBody
@RequestMapping(value = "/secondClassDetail", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map<String, Object> secondClassDetail(HttpServletRequest request, @RequestParam(value = "secondId") Long secondId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
return informationService.secondClassDetail(secondId, pageNo, pageSize);
}
/**
* 资讯详情
*
* @param request
* @param informationId
* @return
*/
@ResponseBody
@RequestMapping(value = "/informationDetail", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map<String, Object> informationDetail(HttpServletRequest request, @RequestParam(value = "informationId") Long informationId) {
return informationService.informationDetail(informationId);
}
/**
* 资讯评论列表
*
* @param request
* @param informationId
* @param pageNo
* @param pageSize
* @return
*/
@ResponseBody
@RequestMapping(value = "/informationCommentList", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map<String, Object> informationCommentList(HttpServletRequest request, @RequestParam(value = "informationId") Long informationId,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize") Integer pageSize) {
return informationService.informationCommentList(informationId, pageNo, pageSize);
}
/**
* 资讯提交评论
*
* @param informationId
* @param comment
* @return
*/
@ResponseBody
@RequestMapping(value = "/informationComment", method = {RequestMethod.POST, RequestMethod.GET}, produces = "application/json")
public Map<String, Object> informationComment(HttpServletRequest request, @RequestParam(value = "informationId") Long informationId, @RequestParam(value = "comment") String comment) {
TKzyUser tKzyUser = getLoginUser(request);
Long userId = null;
if (tKzyUser != null) {
userId = tKzyUser.getId();
}
return informationService.informationComment(informationId, userId, comment);
}
}