|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
4
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.yunzhi.shigongli.common.BaseController;
|
|
7
|
+import com.yunzhi.shigongli.common.Constants;
|
7
|
8
|
import com.yunzhi.shigongli.common.ResponseBean;
|
8
|
9
|
import io.swagger.annotations.Api;
|
9
|
10
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -53,14 +54,16 @@ public class TaExtendContentController extends BaseController {
|
53
|
54
|
public ResponseBean taExtendContentList(@ApiParam(value = "客户端", allowableValues = "wx,admin") @PathVariable String plat,
|
54
|
55
|
@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
55
|
56
|
@ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
|
|
57
|
+ @ApiParam("内容类型") @RequestParam(value ="contentType") String contentType,
|
56
|
58
|
HttpServletRequest request) throws Exception{
|
57
|
59
|
|
58
|
|
- IPage<TaExtendContent> pg = new Page<>(pageNum, pageSize);
|
59
|
|
- QueryWrapper<TaExtendContent> queryWrapper = new QueryWrapper<>();
|
60
|
|
- queryWrapper.orderByDesc("create_date");
|
|
60
|
+ IPage<TaExtendContent> pg = new Page<>(pageNum, pageSize);
|
|
61
|
+ QueryWrapper<TaExtendContent> queryWrapper = new QueryWrapper<>();
|
|
62
|
+ queryWrapper.eq("content_type", contentType);
|
|
63
|
+ queryWrapper.orderByAsc("sort");
|
61
|
64
|
|
62
|
|
- IPage<TaExtendContent> result = iTaExtendContentService.page(pg, queryWrapper);
|
63
|
|
- return ResponseBean.success(result);
|
|
65
|
+ IPage<TaExtendContent> result = iTaExtendContentService.page(pg, queryWrapper);
|
|
66
|
+ return ResponseBean.success(result);
|
64
|
67
|
}
|
65
|
68
|
|
66
|
69
|
/**
|
|
@@ -72,6 +75,9 @@ public class TaExtendContentController extends BaseController {
|
72
|
75
|
@ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
73
|
76
|
public ResponseBean taExtendContentAdd(@ApiParam("保存内容") @RequestBody TaExtendContent taExtendContent) throws Exception{
|
74
|
77
|
|
|
78
|
+ int max = iTaExtendContentService.getMaxSort(taExtendContent.getContentType());
|
|
79
|
+ taExtendContent.setSort(max + 1);
|
|
80
|
+
|
75
|
81
|
if (iTaExtendContentService.save(taExtendContent)){
|
76
|
82
|
return ResponseBean.success(taExtendContent);
|
77
|
83
|
}else {
|
|
@@ -86,7 +92,7 @@ public class TaExtendContentController extends BaseController {
|
86
|
92
|
@RequestMapping(value="/admin/taExtendContent/{id}", method= RequestMethod.DELETE)
|
87
|
93
|
@ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
88
|
94
|
public ResponseBean taExtendContentDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
89
|
|
- if(iTaExtendContentService.removeLogicById(id)){
|
|
95
|
+ if(iTaExtendContentService.removeById(id)){
|
90
|
96
|
return ResponseBean.success("success");
|
91
|
97
|
}else {
|
92
|
98
|
return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|