|
|
@@ -12,18 +12,15 @@ import com.sckw.message.service.MessageService;
|
|
|
import jakarta.validation.Valid;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.http.MediaType;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
+ * @param
|
|
|
* @desc: 消息相关接口
|
|
|
* @author: yzc
|
|
|
* @date: 2023-06-09 15:13
|
|
|
- * @param
|
|
|
* @return
|
|
|
*/
|
|
|
@RestController
|
|
|
@@ -34,62 +31,76 @@ public class MessageController {
|
|
|
private final MessageService messageService;
|
|
|
|
|
|
/**
|
|
|
- * @desc: 查找消息集合
|
|
|
+ * @param id
|
|
|
+ * @return com.sckw.core.web.response.HttpResult
|
|
|
+ * @desc: 获取消息详情
|
|
|
* @author: yzc
|
|
|
- * @date: 2023-06-09 15:12
|
|
|
- * @param findMessagesReqVO
|
|
|
+ * @date: 2023-06-13 16:17
|
|
|
+ */
|
|
|
+ @GetMapping("/detail")
|
|
|
+ public HttpResult detail(@RequestParam Long id) {
|
|
|
+ KwmMessage message = messageService.detail(id);
|
|
|
+ return HttpResult.ok(message);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param params
|
|
|
* @return com.sckw.core.web.response.HttpResult
|
|
|
+ * @desc: 分页查询消息
|
|
|
+ * @author: yzc
|
|
|
+ * @date: 2023-06-09 15:12
|
|
|
*/
|
|
|
- @PostMapping(value = "/findList", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public HttpResult findList(@RequestBody @Valid FindMessagesReqVO findMessagesReqVO) {
|
|
|
- return HttpResult.ok(messageService.selectMessages(findMessagesReqVO));
|
|
|
+ @PostMapping(value = "/select", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public HttpResult select(@RequestBody @Valid SelectMessagesReqVO params) {
|
|
|
+ PageHelper.startPage(params.getPageNum(), params.getPageSize());
|
|
|
+ List<KwmMessage> list = messageService.select(params);
|
|
|
+ PageInfo<KwmMessage> page = new PageInfo<>(list);
|
|
|
+ PageResult result = PageHelperUtil.build(params, page.getTotal(), list);
|
|
|
+ return HttpResult.ok(result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param readMessagesReqVO
|
|
|
+ * @return com.sckw.core.web.response.HttpResult
|
|
|
* @desc: 消息已读
|
|
|
* @author: yzc
|
|
|
* @date: 2023-06-09 14:21
|
|
|
- * @param readMessagesReqVO
|
|
|
- * @return com.sckw.core.web.response.HttpResult
|
|
|
*/
|
|
|
@PostMapping(value = "/read", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public HttpResult read(@RequestBody @Valid ReadMessagesReqVO readMessagesReqVO) {
|
|
|
+ public HttpResult read(@RequestBody ReadMessagesReqVO readMessagesReqVO) {
|
|
|
messageService.read(readMessagesReqVO);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param deleteMessagesReqVO
|
|
|
+ * @return com.sckw.core.web.response.HttpResult
|
|
|
* @desc: 删除消息
|
|
|
* @author: yzc
|
|
|
* @date: 2023-06-09 14:21
|
|
|
- * @param deleteMessagesReqVO
|
|
|
- * @return com.sckw.core.web.response.HttpResult
|
|
|
*/
|
|
|
@PostMapping(value = "/delete", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public HttpResult delete(@RequestBody @Valid DeleteMessagesReqVO deleteMessagesReqVO) {
|
|
|
+ public HttpResult delete(@RequestBody DeleteMessagesReqVO deleteMessagesReqVO) {
|
|
|
messageService.delete(deleteMessagesReqVO);
|
|
|
return HttpResult.ok();
|
|
|
}
|
|
|
|
|
|
+ @GetMapping(value = "/statistics")
|
|
|
+ public HttpResult statistics(@RequestParam(required = false) String category) {
|
|
|
+ List<MessagesStatisticsResVO> result = messageService.statistics(category);
|
|
|
+ return HttpResult.ok(result);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
+ * @param findMessagesReqVO
|
|
|
+ * @return com.sckw.core.web.response.HttpResult
|
|
|
* @desc: 查找消息集合
|
|
|
* @author: yzc
|
|
|
* @date: 2023-06-09 15:12
|
|
|
- * @param params
|
|
|
- * @return com.sckw.core.web.response.HttpResult
|
|
|
*/
|
|
|
- @PostMapping(value = "/select", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public HttpResult select(@RequestBody @Valid SelectMessagesReqVO params) {
|
|
|
- PageHelper.startPage(params.getPageNum(),params.getPageSize());
|
|
|
- List<KwmMessage> list = messageService.select(params);
|
|
|
- PageResult result = PageHelperUtil.getPageResult(new PageInfo<>(list));
|
|
|
- return HttpResult.ok(result);
|
|
|
- }
|
|
|
-
|
|
|
- @PostMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public HttpResult statistics(@RequestBody MessagesStatisticsReqVO params) {
|
|
|
- MessagesStatisticsResVO result = messageService.statistics(params.getCategory());
|
|
|
- return HttpResult.ok(result);
|
|
|
+ @PostMapping(value = "/findList", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public HttpResult findList(@RequestBody FindMessagesReqVO findMessagesReqVO) {
|
|
|
+ return HttpResult.ok(messageService.selectMessages(findMessagesReqVO));
|
|
|
}
|
|
|
|
|
|
}
|