|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.yunzhi.demo.common.BaseController;
|
7
|
7
|
import com.yunzhi.demo.common.ResponseBean;
|
|
8
|
+import com.yunzhi.demo.vo.SortParams;
|
8
|
9
|
import io.swagger.annotations.Api;
|
9
|
10
|
import io.swagger.annotations.ApiOperation;
|
10
|
11
|
import io.swagger.annotations.ApiParam;
|
|
@@ -72,6 +73,7 @@ public class TaTopicController extends BaseController {
|
72
|
73
|
|
73
|
74
|
IPage<TaTopic> pg = new Page<>(pageNum, pageSize);
|
74
|
75
|
QueryWrapper<TaTopic> queryWrapper = new QueryWrapper<>();
|
|
76
|
+ queryWrapper.orderByAsc("sort_no");
|
75
|
77
|
queryWrapper.orderByDesc("create_date");
|
76
|
78
|
|
77
|
79
|
IPage<TaTopic> result = iTaTopicService.page(pg, queryWrapper);
|
|
@@ -193,4 +195,16 @@ public class TaTopicController extends BaseController {
|
193
|
195
|
public ResponseBean topicGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
194
|
196
|
return ResponseBean.success(iTaTopicService.getById(id));
|
195
|
197
|
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+ @RequestMapping(value="/admin/sort/topic",method= RequestMethod.PUT)
|
|
201
|
+ @ApiOperation(value="排序", notes = "排序", httpMethod = "PUT", response = ResponseBean.class)
|
|
202
|
+ public ResponseBean topicSort(@ApiParam("排序") @RequestBody SortParams sortParams) throws Exception {
|
|
203
|
+ if (null == sortParams.getFrom() || null == sortParams.getTo()) {
|
|
204
|
+ return ResponseBean.success("success");
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ iTaTopicService.reSort(sortParams);
|
|
208
|
+ return ResponseBean.success("success");
|
|
209
|
+ }
|
196
|
210
|
}
|