张延森 4 lat temu
rodzic
commit
f71c31e9bd

+ 6
- 10
src/main/java/com/yunzhi/demo/controller/TaPostController.java Wyświetl plik

@@ -134,8 +134,8 @@ public class TaPostController extends BaseController {
134 134
      */
135 135
     @RequestMapping(value="/admin/post/{id}",method= RequestMethod.PUT)
136 136
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
137
-    public ResponseBean taPostUpdate(@ApiParam("对象ID") @PathVariable Integer id,
138
-                                        @ApiParam("更新内容") @RequestBody TaPost taPost) throws Exception{
137
+    public ResponseBean taPostUpdate(@ApiParam("对象ID") @PathVariable String id,
138
+                                     @ApiParam("更新内容") @RequestBody TaPost taPost) throws Exception{
139 139
 
140 140
         TdPostType postType = iTdPostTypeService.getById(taPost.getTypeId());
141 141
         if (null != postType) {
@@ -158,8 +158,6 @@ public class TaPostController extends BaseController {
158 158
     public ResponseBean taPostGet(@ApiParam(value = "客户端", allowableValues = "admin,ma") @PathVariable String client,
159 159
                                   @ApiParam("文章ID") @PathVariable String id) throws Exception{
160 160
 
161
-        Map<String, Object> result = new HashMap<>();
162
-
163 161
         // 获取文章信息
164 162
         TaPost taPost = iTaPostService.getById(id);
165 163
         if (null == taPost || Constants.STATUS_DELETED.equals(taPost.getStatus())) {
@@ -168,6 +166,7 @@ public class TaPostController extends BaseController {
168 166
 
169 167
         // 获取统计信息
170 168
         TaPostData taPostData = iTaPostDataService.getById(id);
169
+        taPost.setPostData(taPostData);
171 170
 
172 171
 
173 172
         // 获取试题
@@ -178,7 +177,7 @@ public class TaPostController extends BaseController {
178 177
             // 当前人员是否收藏过
179 178
             TaPerson taPerson = getCurrentPerson();
180 179
             boolean saved = iTaPostSaveService.checkSaved(taPerson.getPersonId(), id);
181
-            result.put("saved", saved);
180
+            taPost.setIsSaved(saved);
182 181
 
183 182
             // 埋点数据
184 183
             iTaPostDataService.recordBy(id, taPerson);
@@ -192,11 +191,8 @@ public class TaPostController extends BaseController {
192 191
                 }
193 192
             }
194 193
         }
194
+        taPost.setPostTestList(postTestList);
195 195
 
196
-        result.put("post", taPost);
197
-        result.put("postData", taPostData);
198
-        result.put("postTest", postTestList);
199
-
200
-        return ResponseBean.success(result);
196
+        return ResponseBean.success(taPost);
201 197
     }
202 198
 }

+ 1
- 1
src/main/java/com/yunzhi/demo/controller/TaPostTestController.java Wyświetl plik

@@ -117,7 +117,7 @@ public class TaPostTestController extends BaseController {
117 117
      * @param taPostTest 实体对象
118 118
      * @return
119 119
      */
120
-    @RequestMapping(value="/taPostTest",method= RequestMethod.POST)
120
+    @RequestMapping(value="/admin/post-test",method= RequestMethod.POST)
121 121
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
122 122
     public ResponseBean taPostTestAdd(@ApiParam("保存内容") @RequestBody TaPostTest taPostTest) throws Exception{
123 123
 

+ 11
- 0
src/main/java/com/yunzhi/demo/entity/TaPost.java Wyświetl plik

@@ -91,4 +91,15 @@ public class TaPost implements Serializable {
91 91
     @ApiModelProperty(value = "更新时间")
92 92
     private LocalDateTime updateDate;
93 93
 
94
+    @ApiModelProperty(value = "统计数据")
95
+    @TableField(exist = false)
96
+    private TaPostData postData;
97
+
98
+    @ApiModelProperty(value = "题库")
99
+    @TableField(exist = false)
100
+    private List<TaPostTest> postTestList;
101
+
102
+    @ApiModelProperty(value = "是否被收藏")
103
+    @TableField(exist = false)
104
+    private Boolean isSaved;
94 105
 }

+ 3
- 0
src/main/java/com/yunzhi/demo/entity/TaPostTest.java Wyświetl plik

@@ -34,6 +34,9 @@ public class TaPostTest implements Serializable {
34 34
     @ApiModelProperty(value = "关联文章")
35 35
     private String postId;
36 36
 
37
+    @ApiModelProperty(value = "标题")
38
+    private String title;
39
+
37 40
     @ApiModelProperty(value = "试题")
38 41
     private String question;
39 42