From 4d4275384796cad98c91db2c243f4f5dcb114c22 Mon Sep 17 00:00:00 2001 From: "kuang.yife" Date: Sun, 15 Jan 2023 17:23:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E5=93=81=E5=B9=BF=E5=9C=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customer/CustomerSelectionController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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){