张延森 4 vuotta sitten
vanhempi
commit
f71c31e9bd

+ 6
- 10
src/main/java/com/yunzhi/demo/controller/TaPostController.java Näytä tiedosto

134
      */
134
      */
135
     @RequestMapping(value="/admin/post/{id}",method= RequestMethod.PUT)
135
     @RequestMapping(value="/admin/post/{id}",method= RequestMethod.PUT)
136
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
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
         TdPostType postType = iTdPostTypeService.getById(taPost.getTypeId());
140
         TdPostType postType = iTdPostTypeService.getById(taPost.getTypeId());
141
         if (null != postType) {
141
         if (null != postType) {
158
     public ResponseBean taPostGet(@ApiParam(value = "客户端", allowableValues = "admin,ma") @PathVariable String client,
158
     public ResponseBean taPostGet(@ApiParam(value = "客户端", allowableValues = "admin,ma") @PathVariable String client,
159
                                   @ApiParam("文章ID") @PathVariable String id) throws Exception{
159
                                   @ApiParam("文章ID") @PathVariable String id) throws Exception{
160
 
160
 
161
-        Map<String, Object> result = new HashMap<>();
162
-
163
         // 获取文章信息
161
         // 获取文章信息
164
         TaPost taPost = iTaPostService.getById(id);
162
         TaPost taPost = iTaPostService.getById(id);
165
         if (null == taPost || Constants.STATUS_DELETED.equals(taPost.getStatus())) {
163
         if (null == taPost || Constants.STATUS_DELETED.equals(taPost.getStatus())) {
168
 
166
 
169
         // 获取统计信息
167
         // 获取统计信息
170
         TaPostData taPostData = iTaPostDataService.getById(id);
168
         TaPostData taPostData = iTaPostDataService.getById(id);
169
+        taPost.setPostData(taPostData);
171
 
170
 
172
 
171
 
173
         // 获取试题
172
         // 获取试题
178
             // 当前人员是否收藏过
177
             // 当前人员是否收藏过
179
             TaPerson taPerson = getCurrentPerson();
178
             TaPerson taPerson = getCurrentPerson();
180
             boolean saved = iTaPostSaveService.checkSaved(taPerson.getPersonId(), id);
179
             boolean saved = iTaPostSaveService.checkSaved(taPerson.getPersonId(), id);
181
-            result.put("saved", saved);
180
+            taPost.setIsSaved(saved);
182
 
181
 
183
             // 埋点数据
182
             // 埋点数据
184
             iTaPostDataService.recordBy(id, taPerson);
183
             iTaPostDataService.recordBy(id, taPerson);
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 Näytä tiedosto

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

+ 11
- 0
src/main/java/com/yunzhi/demo/entity/TaPost.java Näytä tiedosto

91
     @ApiModelProperty(value = "更新时间")
91
     @ApiModelProperty(value = "更新时间")
92
     private LocalDateTime updateDate;
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 Näytä tiedosto

34
     @ApiModelProperty(value = "关联文章")
34
     @ApiModelProperty(value = "关联文章")
35
     private String postId;
35
     private String postId;
36
 
36
 
37
+    @ApiModelProperty(value = "标题")
38
+    private String title;
39
+
37
     @ApiModelProperty(value = "试题")
40
     @ApiModelProperty(value = "试题")
38
     private String question;
41
     private String question;
39
 
42