From a672e4e8c05be9c763943a06cfe5220ef217934c Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Sat, 23 Jan 2021 20:07:44 +0800 Subject: [PATCH] modify --- zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java index 8a6f81e..026ef0b 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysVipInfoServiceImpl.java @@ -485,7 +485,7 @@ int i=sysVipInfoDao.insert(vipInfo); if (CollectionUtils.isNotEmpty(addVipDto.getLabels())) { - batchInsertLabel(addVipDto.getLabels(), user.getSuName(), vipInfo.getId()); + batchInsertLabel(addVipDto.getLabels(), vipInfo.getId()); } //创建用户默认储值卡 @@ -536,23 +536,20 @@ int i = sysVipInfoDao.update(vipInfo); if (CollectionUtils.isNotEmpty(modifyVipDto.getLabels())) { - sysVipLabelDao.deleteByVipId(modifyVipDto.getVipId()); - - batchInsertLabel(modifyVipDto.getLabels(), user.getSuName(), vipInfo.getId()); + sysVipLabelDao.deleteRelateByVipId(modifyVipDto.getVipId()); + batchInsertLabel(modifyVipDto.getLabels(), vipInfo.getId()); } return i; } - private void batchInsertLabel(List<String> labelList, String suName, Long id) { + private void batchInsertLabel(List<String> labelList, Long id) { Set<String> labels = new HashSet<>(labelList); Iterator<String> iterator = labels.iterator(); - if (iterator.hasNext()) { - SysVipLabel sysVipLabel = new SysVipLabel(); - sysVipLabel.setCreateTime(new Date()); - sysVipLabel.setCreateBy(suName); - sysVipLabel.setLabel(iterator.next()); - sysVipLabel.setVipId(id); - sysVipLabelDao.insert(sysVipLabel); + while (iterator.hasNext()) { + SysVipLabelRelate relate = new SysVipLabelRelate(); + relate.setLabelId(Long.parseLong(iterator.next())); + relate.setVipId(id); + sysVipLabelDao.insertRelate(relate); } } -- Gitblit v1.9.1