张延森 4 years ago
parent
commit
d451a780dd

+ 17
- 12
src/main/java/com/shigongli/controller/TaShopController.java View File

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

+ 19
- 13
src/main/java/com/shigongli/controller/TaShopKeeperController.java View File

@@ -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.shigongli.common.BaseController;
7 7
 import com.shigongli.common.ResponseBean;
8
+import com.shigongli.constants.StatusConstant;
8 9
 import io.swagger.annotations.Api;
9 10
 import io.swagger.annotations.ApiOperation;
10 11
 import io.swagger.annotations.ApiParam;
@@ -46,13 +47,16 @@ public class TaShopKeeperController extends BaseController {
46 47
      * @param pageSize
47 48
      * @return
48 49
      */
49
-    @RequestMapping(value="/taShopKeeper",method= RequestMethod.GET)
50
+    @RequestMapping(value="/mp/taShopKeeper",method= RequestMethod.GET)
50 51
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51 52
     public ResponseBean taShopKeeperList(@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,
54
+                                         @ApiParam("店铺ID") @RequestParam("shopId") String shopId) throws Exception{
53 55
 
54 56
 		    IPage<TaShopKeeper> pg = new Page<>(pageNum, pageSize);
55 57
             QueryWrapper<TaShopKeeper> queryWrapper = new QueryWrapper<>();
58
+            queryWrapper.eq("shop_id", shopId);
59
+            queryWrapper.eq("status", StatusConstant.NORMAL);
56 60
             queryWrapper.orderByDesc("create_date");
57 61
 
58 62
             IPage<TaShopKeeper> result = iTaShopKeeperService.page(pg, queryWrapper);
@@ -64,7 +68,7 @@ public class TaShopKeeperController extends BaseController {
64 68
      * @param taShopKeeper 实体对象
65 69
      * @return
66 70
      */
67
-    @RequestMapping(value="/taShopKeeper",method= RequestMethod.POST)
71
+    @RequestMapping(value="/mp/taShopKeeper",method= RequestMethod.POST)
68 72
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
69 73
     public ResponseBean taShopKeeperAdd(@ApiParam("保存内容") @RequestBody TaShopKeeper taShopKeeper) throws Exception{
70 74
 
@@ -79,14 +83,16 @@ public class TaShopKeeperController extends BaseController {
79 83
      * 根据id删除对象
80 84
      * @param id  实体ID
81 85
      */
82
-    @RequestMapping(value="/taShopKeeper/{id}", method= RequestMethod.DELETE)
86
+    @RequestMapping(value="/mp/taShopKeeper/{id}", method= RequestMethod.DELETE)
83 87
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
84
-    public ResponseBean taShopKeeperDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
85
-        if(iTaShopKeeperService.removeById(id)){
86
-            return ResponseBean.success("success");
87
-        }else {
88
-            return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
88
+    public ResponseBean taShopKeeperDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
89
+        TaShopKeeper taShopKeeper = iTaShopKeeperService.getById(id);
90
+        if (null == taShopKeeper || taShopKeeper.getStatus().equals(StatusConstant.DELETE)) {
91
+            return ResponseBean.success("ok");
89 92
         }
93
+
94
+        taShopKeeper.setStatus(StatusConstant.DELETE);
95
+        return taShopKeeperUpdate(id, taShopKeeper);
90 96
     }
91 97
 
92 98
     /**
@@ -95,9 +101,9 @@ public class TaShopKeeperController extends BaseController {
95 101
      * @param taShopKeeper 实体对象
96 102
      * @return
97 103
      */
98
-    @RequestMapping(value="/taShopKeeper/{id}",method= RequestMethod.PUT)
104
+    @RequestMapping(value="/mp/taShopKeeper/{id}",method= RequestMethod.PUT)
99 105
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
100
-    public ResponseBean taShopKeeperUpdate(@ApiParam("对象ID") @PathVariable Integer id,
106
+    public ResponseBean taShopKeeperUpdate(@ApiParam("对象ID") @PathVariable String id,
101 107
                                         @ApiParam("更新内容") @RequestBody TaShopKeeper taShopKeeper) throws Exception{
102 108
 
103 109
         if (iTaShopKeeperService.updateById(taShopKeeper)){
@@ -111,9 +117,9 @@ public class TaShopKeeperController extends BaseController {
111 117
      * 根据id查询对象
112 118
      * @param id  实体ID
113 119
      */
114
-    @RequestMapping(value="/taShopKeeper/{id}",method= RequestMethod.GET)
120
+    @RequestMapping(value="/mp/taShopKeeper/{id}",method= RequestMethod.GET)
115 121
     @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
116
-    public ResponseBean taShopKeeperGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
122
+    public ResponseBean taShopKeeperGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
117 123
         return ResponseBean.success(iTaShopKeeperService.getById(id));
118 124
     }
119 125
 }

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

@@ -27,7 +27,7 @@ public class TaShop implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "店铺ID")
30
-    @TableId(value = "shop_id", type = IdType.INPUT)
30
+    @TableId(value = "shop_id", type = IdType.UUID)
31 31
     private String shopId;
32 32
 
33 33
     @ApiModelProperty(value = "店铺名称")

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

@@ -27,7 +27,7 @@ public class TaShopKeeper implements Serializable {
27 27
     private static final long serialVersionUID = 1L;
28 28
 
29 29
     @ApiModelProperty(value = "店主ID")
30
-    @TableId(value = "keeper_id", type = IdType.INPUT)
30
+    @TableId(value = "keeper_id", type = IdType.UUID)
31 31
     private String keeperId;
32 32
 
33 33
     @ApiModelProperty(value = "店主名称")