|
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.shigongli.common.BaseController;
|
7
|
7
|
import com.shigongli.common.ResponseBean;
|
8
|
8
|
import com.shigongli.constants.StatusConstant;
|
|
9
|
+import com.shigongli.entity.TaPerson;
|
|
10
|
+import com.shigongli.service.ITaPersonService;
|
9
|
11
|
import io.swagger.annotations.Api;
|
10
|
12
|
import io.swagger.annotations.ApiOperation;
|
11
|
13
|
import io.swagger.annotations.ApiParam;
|
|
@@ -40,6 +42,9 @@ public class TaShopKeeperController extends BaseController {
|
40
|
42
|
@Autowired
|
41
|
43
|
public ITaShopKeeperService iTaShopKeeperService;
|
42
|
44
|
|
|
45
|
+ @Autowired
|
|
46
|
+ public ITaPersonService iTaPersonService;
|
|
47
|
+
|
43
|
48
|
|
44
|
49
|
/**
|
45
|
50
|
* 分页查询列表
|
|
@@ -72,6 +77,11 @@ public class TaShopKeeperController extends BaseController {
|
72
|
77
|
@ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
73
|
78
|
public ResponseBean taShopKeeperAdd(@ApiParam("保存内容") @RequestBody TaShopKeeper taShopKeeper) throws Exception{
|
74
|
79
|
|
|
80
|
+ TaPerson taPerson = iTaPersonService.getByPhone(taShopKeeper.getPhone());
|
|
81
|
+ if (null != taPerson) {
|
|
82
|
+ taShopKeeper.setPersonId(taPerson.getPersonId());
|
|
83
|
+ }
|
|
84
|
+
|
75
|
85
|
if (iTaShopKeeperService.save(taShopKeeper)){
|
76
|
86
|
return ResponseBean.success(taShopKeeper);
|
77
|
87
|
}else {
|
|
@@ -106,6 +116,11 @@ public class TaShopKeeperController extends BaseController {
|
106
|
116
|
public ResponseBean taShopKeeperUpdate(@ApiParam("对象ID") @PathVariable String id,
|
107
|
117
|
@ApiParam("更新内容") @RequestBody TaShopKeeper taShopKeeper) throws Exception{
|
108
|
118
|
|
|
119
|
+ TaPerson taPerson = iTaPersonService.getByPhone(taShopKeeper.getPhone());
|
|
120
|
+ if (null != taPerson) {
|
|
121
|
+ taShopKeeper.setPersonId(taPerson.getPersonId());
|
|
122
|
+ }
|
|
123
|
+
|
109
|
124
|
if (iTaShopKeeperService.updateById(taShopKeeper)){
|
110
|
125
|
return ResponseBean.success(iTaShopKeeperService.getById(id));
|
111
|
126
|
}else {
|