Browse Source

修改参数

DESKTOP-USV654P\pc 1 year ago
parent
commit
380a3ca4bc

+ 5 - 4
src/main/java/com/xjrsoft/module/oa/controller/NewsController.java

@@ -20,6 +20,7 @@ import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.authority.entity.DataAuth;
 import com.xjrsoft.module.oa.dto.AddNewsDto;
 import com.xjrsoft.module.oa.dto.NewsPageDto;
+import com.xjrsoft.module.oa.dto.NewsReplyDto;
 import com.xjrsoft.module.oa.dto.UpdateNewsDto;
 import com.xjrsoft.module.oa.entity.Message;
 import com.xjrsoft.module.oa.entity.News;
@@ -199,12 +200,12 @@ public class NewsController {
 
     @PutMapping("/reply")
     @ApiOperation(value = "新闻回复")
-    public R reply(@RequestBody String id, @RequestBody String replyContent) throws Exception {
+    public R reply(@RequestBody NewsReplyDto newsReplyDto) throws Exception {
         NewsRelation newsRelation = newsRelationService.getOne(
                 Wrappers.<NewsRelation>query().lambda()
-                        .eq(NewsRelation::getNewsId,id)
+                        .eq(NewsRelation::getNewsId,newsReplyDto.getId())
                         .eq(NewsRelation::getUserId,StpUtil.getLoginIdAsLong()));
-        if (replyContent == null || newsRelation == null) {
+        if (newsReplyDto.getReplyContent() == null || newsRelation == null) {
             throw new Exception("参数异常");
         }
 
@@ -212,7 +213,7 @@ public class NewsController {
             newsRelation.setReadMark(1);
             newsRelation.setReadDate(LocalDateTime.now());
         }
-        newsRelation.setReplyContent(replyContent);
+        newsRelation.setReplyContent(newsReplyDto.getReplyContent());
         return R.ok(newsRelationService.updateById(newsRelation));
     }
 }

+ 13 - 0
src/main/java/com/xjrsoft/module/oa/dto/NewsReplyDto.java

@@ -0,0 +1,13 @@
+package com.xjrsoft.module.oa.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class NewsReplyDto {
+
+    @ApiModelProperty("主键")
+    private Long id;
+    @ApiModelProperty("回复内容")
+    private String replyContent;
+}