张延森 4 years ago
parent
commit
a69ee08ee6

+ 14
- 12
src/main/java/com/shigongli/controller/TaMateTagController.java View File

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.shigongli.common.BaseController;
6
 import com.shigongli.common.BaseController;
7
 import com.shigongli.common.ResponseBean;
7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.constants.StatusConstant;
8
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
11
 import io.swagger.annotations.ApiParam;
46
      * @param pageSize
47
      * @param pageSize
47
      * @return
48
      * @return
48
      */
49
      */
49
-    @RequestMapping(value="/taMateTag",method= RequestMethod.GET)
50
+    @RequestMapping(value="/mp/taMateTag",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     public ResponseBean taMateTagList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
     public ResponseBean taMateTagList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
 									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
 									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
64
      * @param taMateTag 实体对象
65
      * @param taMateTag 实体对象
65
      * @return
66
      * @return
66
      */
67
      */
67
-    @RequestMapping(value="/taMateTag",method= RequestMethod.POST)
68
+    @RequestMapping(value="/mp/taMateTag",method= RequestMethod.POST)
68
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
     public ResponseBean taMateTagAdd(@ApiParam("保存内容") @RequestBody TaMateTag taMateTag) throws Exception{
70
     public ResponseBean taMateTagAdd(@ApiParam("保存内容") @RequestBody TaMateTag taMateTag) throws Exception{
70
 
71
 
79
      * 根据id删除对象
80
      * 根据id删除对象
80
      * @param id  实体ID
81
      * @param id  实体ID
81
      */
82
      */
82
-    @RequestMapping(value="/taMateTag/{id}", method= RequestMethod.DELETE)
83
+    @RequestMapping(value="/mp/taMateTag/{id}", method= RequestMethod.DELETE)
83
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taMateTagDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaMateTagService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
85
+    public ResponseBean taMateTagDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
86
+        TaMateTag taMateTag = iTaMateTagService.getById(id);
87
+        if (null == taMateTag || taMateTag.getStatus().equals(StatusConstant.DELETE)) {
88
+            return ResponseBean.success("ok");
89
         }
89
         }
90
+        taMateTag.setStatus(StatusConstant.DELETE);
91
+        return taMateTagUpdate(id, taMateTag);
90
     }
92
     }
91
 
93
 
92
     /**
94
     /**
95
      * @param taMateTag 实体对象
97
      * @param taMateTag 实体对象
96
      * @return
98
      * @return
97
      */
99
      */
98
-    @RequestMapping(value="/taMateTag/{id}",method= RequestMethod.PUT)
100
+    @RequestMapping(value="/mp/taMateTag/{id}",method= RequestMethod.PUT)
99
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
101
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taMateTagUpdate(@ApiParam("对象ID") @PathVariable Integer id,
102
+    public ResponseBean taMateTagUpdate(@ApiParam("对象ID") @PathVariable String id,
101
                                         @ApiParam("更新内容") @RequestBody TaMateTag taMateTag) throws Exception{
103
                                         @ApiParam("更新内容") @RequestBody TaMateTag taMateTag) throws Exception{
102
 
104
 
103
         if (iTaMateTagService.updateById(taMateTag)){
105
         if (iTaMateTagService.updateById(taMateTag)){
111
      * 根据id查询对象
113
      * 根据id查询对象
112
      * @param id  实体ID
114
      * @param id  实体ID
113
      */
115
      */
114
-    @RequestMapping(value="/taMateTag/{id}",method= RequestMethod.GET)
116
+    @RequestMapping(value="/mp/taMateTag/{id}",method= RequestMethod.GET)
115
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
117
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taMateTagGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
118
+    public ResponseBean taMateTagGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
117
         return ResponseBean.success(iTaMateTagService.getById(id));
119
         return ResponseBean.success(iTaMateTagService.getById(id));
118
     }
120
     }
119
 }
121
 }

+ 21
- 17
src/main/java/com/shigongli/controller/TaMateTagGroupController.java View File

5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6
 import com.shigongli.common.BaseController;
6
 import com.shigongli.common.BaseController;
7
 import com.shigongli.common.ResponseBean;
7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.constants.StatusConstant;
8
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.Api;
9
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiOperation;
10
 import io.swagger.annotations.ApiParam;
11
 import io.swagger.annotations.ApiParam;
46
      * @param pageSize
47
      * @param pageSize
47
      * @return
48
      * @return
48
      */
49
      */
49
-    @RequestMapping(value="/taMateTagGroup",method= RequestMethod.GET)
50
+    @RequestMapping(value="/mp/taMateTagGroup",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
     public ResponseBean taMateTagGroupList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
     public ResponseBean taMateTagGroupList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
 									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
 									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
53
 
54
 
54
-		    IPage<TaMateTagGroup> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaMateTagGroup> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
55
+        IPage<TaMateTagGroup> pg = new Page<>(pageNum, pageSize);
56
+        QueryWrapper<TaMateTagGroup> queryWrapper = new QueryWrapper<>();
57
+        queryWrapper.eq("status", StatusConstant.NORMAL);
58
+        queryWrapper.orderByDesc("create_date");
57
 
59
 
58
-            IPage<TaMateTagGroup> result = iTaMateTagGroupService.page(pg, queryWrapper);
59
-            return ResponseBean.success(result);
60
+        IPage<TaMateTagGroup> result = iTaMateTagGroupService.page(pg, queryWrapper);
61
+        return ResponseBean.success(result);
60
     }
62
     }
61
 
63
 
62
     /**
64
     /**
64
      * @param taMateTagGroup 实体对象
66
      * @param taMateTagGroup 实体对象
65
      * @return
67
      * @return
66
      */
68
      */
67
-    @RequestMapping(value="/taMateTagGroup",method= RequestMethod.POST)
69
+    @RequestMapping(value="/mp/taMateTagGroup",method= RequestMethod.POST)
68
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
70
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69
     public ResponseBean taMateTagGroupAdd(@ApiParam("保存内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
71
     public ResponseBean taMateTagGroupAdd(@ApiParam("保存内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
70
 
72
 
79
      * 根据id删除对象
81
      * 根据id删除对象
80
      * @param id  实体ID
82
      * @param id  实体ID
81
      */
83
      */
82
-    @RequestMapping(value="/taMateTagGroup/{id}", method= RequestMethod.DELETE)
84
+    @RequestMapping(value="/mp/taMateTagGroup/{id}", method= RequestMethod.DELETE)
83
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
85
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taMateTagGroupDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaMateTagGroupService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
86
+    public ResponseBean taMateTagGroupDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
87
+        TaMateTagGroup taMateTagGroup = iTaMateTagGroupService.getById(id);
88
+        if (null == taMateTagGroup || taMateTagGroup.getStatus().equals(StatusConstant.DELETE)) {
89
+            return ResponseBean.success("ok");
89
         }
90
         }
91
+
92
+        taMateTagGroup.setStatus(StatusConstant.DELETE);
93
+        return taMateTagGroupUpdate(id, taMateTagGroup);
90
     }
94
     }
91
 
95
 
92
     /**
96
     /**
95
      * @param taMateTagGroup 实体对象
99
      * @param taMateTagGroup 实体对象
96
      * @return
100
      * @return
97
      */
101
      */
98
-    @RequestMapping(value="/taMateTagGroup/{id}",method= RequestMethod.PUT)
102
+    @RequestMapping(value="/mp/taMateTagGroup/{id}",method= RequestMethod.PUT)
99
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
103
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taMateTagGroupUpdate(@ApiParam("对象ID") @PathVariable Integer id,
104
+    public ResponseBean taMateTagGroupUpdate(@ApiParam("对象ID") @PathVariable String id,
101
                                         @ApiParam("更新内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
105
                                         @ApiParam("更新内容") @RequestBody TaMateTagGroup taMateTagGroup) throws Exception{
102
 
106
 
103
         if (iTaMateTagGroupService.updateById(taMateTagGroup)){
107
         if (iTaMateTagGroupService.updateById(taMateTagGroup)){
111
      * 根据id查询对象
115
      * 根据id查询对象
112
      * @param id  实体ID
116
      * @param id  实体ID
113
      */
117
      */
114
-    @RequestMapping(value="/taMateTagGroup/{id}",method= RequestMethod.GET)
118
+    @RequestMapping(value="/mp/taMateTagGroup/{id}",method= RequestMethod.GET)
115
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
119
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taMateTagGroupGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
120
+    public ResponseBean taMateTagGroupGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
117
         return ResponseBean.success(iTaMateTagGroupService.getById(id));
121
         return ResponseBean.success(iTaMateTagGroupService.getById(id));
118
     }
122
     }
119
 }
123
 }

+ 1
- 1
src/main/java/com/shigongli/entity/TaMateTagGroup.java View File

27
     private static final long serialVersionUID = 1L;
27
     private static final long serialVersionUID = 1L;
28
 
28
 
29
     @ApiModelProperty(value = "ID")
29
     @ApiModelProperty(value = "ID")
30
-    @TableId(value = "group_id", type = IdType.INPUT)
30
+    @TableId(value = "group_id", type = IdType.UUID)
31
     private String groupId;
31
     private String groupId;
32
 
32
 
33
     @ApiModelProperty(value = "标签组")
33
     @ApiModelProperty(value = "标签组")