diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java index a1ea8d1f..01c917c8 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerSelectionController.java @@ -129,10 +129,18 @@ public class CustomerSelectionController extends BaseController }else { workId = workList.get(0).getWorkerId(); } + // 判断是否有历史数据 - 有则删除 customerSelection.getDeptCategoryIds().forEach(selection->{ customerSelection.setWorkId(workId); customerSelection.setDeptCategoryId(selection); - customerSelectionService.insertCustomerSelection(customerSelection); + CustomerSelection param = new CustomerSelection(); + param.setDeptCategoryId(selection); + param.setSelectionType(customerSelection.getSelectionType()); + param.setCustomerId(customerSelection.getCustomerId()); + List customerSelections = customerSelectionService.selectCustomerSelectionList(param); + if(CollectionUtils.isEmpty(customerSelections)){ + customerSelectionService.insertCustomerSelection(customerSelection); + } }); return AjaxResult.success("新增成功"); }catch (Exception e){