|
@@ -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
|
}
|