浏览代码

时间表查询

wang_xy 1 年之前
父节点
当前提交
6bca0b965e

+ 7 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringAirWallServiceImpl.java

@@ -161,12 +161,14 @@ public class ZEngineeringAirWallServiceImpl implements IZEngineeringAirWallServi
         ZEngineeringAirWall update = BeanUtil.toBean(bo, ZEngineeringAirWall.class);
         validEntityBeforeSave(update);
         boolean flag = baseMapper.updateById(update) > 0;
+        // 查询数据库中已存在的主表创建时间
+        ZEngineeringAirWallVo vo = baseMapper.selectVoById(bo.getId());
         if (flag) {
             List<ZEngiineeringPhoto> list = new ArrayList<>();
             // 查询数据库中已存在的文件列表
             ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
             zEngiineeringPhotoBo.setParentId(update.getId());
-            zEngiineeringPhotoBo.setCreateTime(bo.getCreateTime());
+            zEngiineeringPhotoBo.setCreateTime(vo.getCreateTime());
             List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
             // 插入前端传来的新文件
             if (!ObjectUtils.isEmpty(bo.getFiles())) {
@@ -332,13 +334,16 @@ public class ZEngineeringAirWallServiceImpl implements IZEngineeringAirWallServi
     public Boolean updateNodeByBo(ZEngineeringAirWallBo bo) {
         ZEngineeringAirWall update = BeanUtil.toBean(bo, ZEngineeringAirWall.class);
         boolean flag = baseMapper.updateById(update) > 0;
+
+        // 查询数据库中已存在的主表创建时间
+        ZEngineeringAirWallVo vo = baseMapper.selectVoById(bo.getId());
         if (flag) {
             if (!ObjectUtils.isEmpty(bo.getFiles())) {
                 List<ZEngiineeringPhoto> list = new ArrayList<>();
                 // 查询数据库中已存在的文件列表
                 ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
                 zEngiineeringPhotoBo.setParentId(update.getId());
-                zEngiineeringPhotoBo.setCreateTime(update.getCreateTime());
+                zEngiineeringPhotoBo.setCreateTime(vo.getCreateTime());
                 List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
                 // 插入前端传来的新文件
                 for (ZFileBo pic : bo.getFiles()) {

+ 1 - 3
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringDangerousServiceImpl.java

@@ -311,9 +311,7 @@ public class ZEngineeringDangerousServiceImpl implements IZEngineeringDangerousS
             }
 
             // 删除数据库中多余的文件
-            List<String> photosToDelete = existingPhotos.stream()
-                .filter(pic -> !bo.getFiles().stream().map(ZFileBo::getUrl).collect(Collectors.toList()).contains(pic))
-                .collect(Collectors.toList());
+            List<String> photosToDelete = existingPhotos.stream().filter(pic -> !bo.getFiles().stream().map(ZFileBo::getUrl).collect(Collectors.toList()).contains(pic)).collect(Collectors.toList());
             if (!photosToDelete.isEmpty()) {
                 photosToDelete.forEach(item->{
                     ZEngiineeringPhoto zEngiineeringPhoto=new ZEngiineeringPhoto();

+ 6 - 2
ruoyi-zdsz/src/main/java/com/ruoyi/zdsz/service/impl/ZEngineeringIndustryServiceImpl.java

@@ -335,6 +335,7 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
         ZEngineeringIndustry update = BeanUtil.toBean(bo, ZEngineeringIndustry.class);
         validEntityBeforeSave(update);
         boolean flag = baseMapper.updateById(update) > 0;
+        bo.setCreateTime(baseMapper.selectVoById(bo.getId()).getCreateTime());
         if (flag) {
             List<ZEngiineeringPhoto> list = new ArrayList<>();
             // 查询数据库中已存在的文件列表
@@ -488,12 +489,13 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
     public Boolean updateNodeByBo(ZEngineeringIndustryBo bo) {
         ZEngineeringIndustry update = BeanUtil.toBean(bo, ZEngineeringIndustry.class);
         boolean flag = baseMapper.updateById(update) > 0;
+        bo.setCreateTime(baseMapper.selectVoById(bo.getId()).getCreateTime());
         if (flag) {
             if (!ObjectUtils.isEmpty(bo.getFiles())) {
                 List<ZEngiineeringPhoto> list = new ArrayList<>();
                 // 查询数据库中已存在的文件列表
                 ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
-                zEngiineeringPhotoBo.setCreateTime(update.getCreateTime());
+                zEngiineeringPhotoBo.setCreateTime(bo.getCreateTime());
                 zEngiineeringPhotoBo.setParentId(update.getId());
                 List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
                 // 插入前端传来的新文件
@@ -581,9 +583,11 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
     public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
 
         ids.forEach(item -> {
+            ZEngineeringIndustryVo vo = baseMapper.selectVoById(item);
             // 查询数据库中已存在的文件列表
             ZEngiineeringPhotoBo zEngiineeringPhotoBo = new ZEngiineeringPhotoBo();
             zEngiineeringPhotoBo.setParentId(item);
+            zEngiineeringPhotoBo.setCreateTime(vo.getCreateTime());
             // 将查询出的url放入existingPhotos
             List<String> existingPhotos = photoService.queryList(zEngiineeringPhotoBo).stream().map(ZEngiineeringPhotoVo::getPicUrl).collect(Collectors.toList());
             // 若存在 则进行删除
@@ -593,7 +597,7 @@ public class ZEngineeringIndustryServiceImpl implements IZEngineeringIndustrySer
                 });
             }
             // 初始化工程节点对象
-            ZEngineeringIndustryVo vo = baseMapper.selectVoById(item);
+
             ZEngineeringNodeBo zEngineeringNodeBo = new ZEngineeringNodeBo();
             zEngineeringNodeBo.setCreateTime(vo.getCreateTime());
             zEngineeringNodeBo.setCivliId(vo.getId());