|
@@ -1,6 +1,7 @@
|
1
|
1
|
package com.yunzhi.marketing.controller;
|
2
|
2
|
|
3
|
3
|
|
|
4
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
4
|
5
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
5
|
6
|
import com.yunzhi.marketing.base.BaseController;
|
6
|
7
|
import com.yunzhi.marketing.base.ResponseBean;
|
|
@@ -469,10 +470,17 @@ public class TaBuildingController extends BaseController {
|
469
|
470
|
|
470
|
471
|
boolean state = taPersonBuildingService.removeById(id);
|
471
|
472
|
if (state) {
|
472
|
|
- TaPerson taPerson = iTaPersonService.getById(taPersonBuilding.getPersonId());
|
473
|
|
- // 成为驻场顾问并绑定楼盘
|
474
|
|
- taPerson.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
|
475
|
|
- iTaPersonService.updateById(taPerson);
|
|
473
|
+ // 查询下是否还有其他的楼盘驻场
|
|
474
|
+ LambdaQueryWrapper<TaPersonBuilding> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
475
|
+ lambdaQueryWrapper.eq(TaPersonBuilding::getPersonId,taPersonBuilding.getPersonId());
|
|
476
|
+ List<TaPersonBuilding> list = taPersonBuildingService.list(lambdaQueryWrapper);
|
|
477
|
+ if (list.size() < 1) {
|
|
478
|
+ TaPerson taPerson = iTaPersonService.getById(taPersonBuilding.getPersonId());
|
|
479
|
+ // 成为驻场顾问并绑定楼盘
|
|
480
|
+ taPerson.setPersonType(CommConstant.PERSON_ESTATE_CUSTOMER);
|
|
481
|
+ iTaPersonService.updateById(taPerson);
|
|
482
|
+ }
|
|
483
|
+
|
476
|
484
|
responseBean.addSuccess("解绑成功");
|
477
|
485
|
}else {
|
478
|
486
|
responseBean.addError("请检查是否存在驻场人员");
|