From a37b5f0fcc52a5cbe59aa89c534f06f32a441879 Mon Sep 17 00:00:00 2001 From: tangqian Date: Wed, 31 May 2023 18:02:53 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/service/dept/DeptServiceImpl.java | 49 +++++++++++++------ 1 file changed, 33 insertions(+), 16 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java index defd6493e..fda6f29cd 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java @@ -132,21 +132,38 @@ public class DeptServiceImpl implements DeptService { reqVO.setParentId(DeptIdEnum.ROOT.getId()); } validateForCreateOrUpdate(reqVO.getId(), reqVO.getParentId(), reqVO.getName()); - // 更新部门 - DeptDO updateObj = DeptConvert.INSTANCE.convert(reqVO); - if (DeptIdEnum.ROOT.getId().equals(updateObj.getParentId())) { - updateObj.setParentOrganizationIds(updateObj.getId() + ""); - updateObj.setParentOrganizationName(updateObj.getName()); - } else { - DeptDO parent = deptMapper.selectById(reqVO.getParentId()); - updateObj.setParentOrganizationIds(parent.getParentOrganizationIds() + "," + updateObj.getId()); - updateObj.setParentOrganizationName(parent.getParentOrganizationName() + ">" + updateObj.getName()); - } - deptMapper.updateById(updateObj); +// // 更新部门 +// DeptDO updateObj = DeptConvert.INSTANCE.convert(reqVO); +// if (DeptIdEnum.ROOT.getId().equals(updateObj.getParentId())) { +// updateObj.setParentOrganizationIds(updateObj.getId() + ""); +// updateObj.setParentOrganizationName(updateObj.getName()); +// } else { +// DeptDO parent = deptMapper.selectById(reqVO.getParentId()); +// updateObj.setParentOrganizationIds(parent.getParentOrganizationIds() + "," + updateObj.getId()); +// updateObj.setParentOrganizationName(parent.getParentOrganizationName() + ">" + updateObj.getName()); +// } + DeptDO deptDO = deptMapper.selectById(reqVO.getId()); + List deptDOS = deptMapper.selectListDeep(Wrappers.lambdaQuery().like(DeptDO::getParentOrganizationIds, reqVO.getId())); + deptDOS.forEach(x -> { + x.setParentOrganizationName(x.getParentOrganizationName().replace(deptDO.getName(), reqVO.getName())); + }); + deptMapper.updateBatch(deptDOS,deptDOS.size()); +// deptMapper.updateById(updateObj); + + // 发送刷新消息 deptProducer.sendDeptRefreshMessage(); } + public static void main(String[] args) { + String words = "创盈云>测试删除1"; + + System.out.println("原始字符串是'" + words + "'"); + + System.out.println("replace(\"r's\",\"is\")结果:" + words.replace("测试删除1", "测试删除")); + + } + @Override public void deleteDept(Long id) { // 校验是否存在 @@ -322,7 +339,7 @@ public class DeptServiceImpl implements DeptService { private static List deptDOS4 = new ArrayList<>(); @Override - public void batchImport(MultipartFile file){ + public void batchImport(MultipartFile file) { try { List deptList = ExcelUtils.read(file, BatchImportVO.class); @@ -341,7 +358,7 @@ public class DeptServiceImpl implements DeptService { deptDO1.setCharacteristic(batchImportVO1.getCharacteristic()); deptMapper.insert(deptDO1); deptDO1.setParentOrganizationIds(deptDO1.getId().toString()); - deptMapper.update(deptDO1,Wrappers.lambdaUpdate().eq(DeptDO::getId,deptDO1.getId())); + deptMapper.update(deptDO1, Wrappers.lambdaUpdate().eq(DeptDO::getId, deptDO1.getId())); // 装入层级2 for (BatchImportVO batchImportVO : batchImportVOS2) { DeptDO deptDO2 = new DeptDO(); @@ -351,7 +368,7 @@ public class DeptServiceImpl implements DeptService { deptDO2.setCharacteristic(batchImportVO.getCharacteristic()); deptMapper.insert(deptDO2); deptDO2.setParentOrganizationIds(deptDO1.getParentOrganizationIds() + ">" + deptDO2.getId()); - deptMapper.update(deptDO2,Wrappers.lambdaUpdate().eq(DeptDO::getId,deptDO2.getId())); + deptMapper.update(deptDO2, Wrappers.lambdaUpdate().eq(DeptDO::getId, deptDO2.getId())); deptDOS2.add(deptDO2); } // 装入层级3 @@ -365,7 +382,7 @@ public class DeptServiceImpl implements DeptService { deptDO3.setCharacteristic(batchImportVO.getCharacteristic()); deptMapper.insert(deptDO3); deptDO3.setParentOrganizationIds(deptDO.getParentOrganizationIds() + ">" + deptDO3.getId()); - deptMapper.update(deptDO3,Wrappers.lambdaUpdate().eq(DeptDO::getId,deptDO3.getId())); + deptMapper.update(deptDO3, Wrappers.lambdaUpdate().eq(DeptDO::getId, deptDO3.getId())); deptDOS3.add(deptDO3); } // 装入层级4 @@ -378,7 +395,7 @@ public class DeptServiceImpl implements DeptService { deptDO4.setParentOrganizationName(deptDO.getParentOrganizationName() + ">" + batchImportVO.getDepName()); deptMapper.insert(deptDO4); deptDO4.setParentOrganizationIds(deptDO.getParentOrganizationIds() + ">" + deptDO4.getId()); - deptMapper.update(deptDO4,Wrappers.lambdaUpdate().eq(DeptDO::getId,deptDO4.getId())); + deptMapper.update(deptDO4, Wrappers.lambdaUpdate().eq(DeptDO::getId, deptDO4.getId())); deptDOS4.add(deptDO4); } } catch (IOException e) { From 45980a8c792554e0725d409487ba13e4fb5e704e Mon Sep 17 00:00:00 2001 From: tangqian Date: Wed, 31 May 2023 18:08:01 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E9=83=A8=E9=97=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/recharge/RechargeOrderMapper.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml index e638744b3..05c9c5d84 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml @@ -100,6 +100,7 @@