From 9b3ea0596380998a6f68ed8609b0df6e64ad6790 Mon Sep 17 00:00:00 2001 From: yuezhihang Date: Wed, 13 Jul 2022 17:11:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=96=99=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FileMaterialController.java | 24 +++++++++++++++++-- .../entity/FileMaterial.java | 4 ++++ .../fileMaterialCenter/FileMaterialMapper.xml | 2 +- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/controller/FileMaterialController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/controller/FileMaterialController.java index 8fa350fa..c79f845c 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/controller/FileMaterialController.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/controller/FileMaterialController.java @@ -5,6 +5,8 @@ import com.adc.da.http.ResponseMessage; import com.adc.da.http.Result; import com.adc.da.slrs.fileMaterialCenter.entity.FileMaterialPage; import com.adc.da.slrs.fileMaterialCenter.service.IFileMaterialService; +import com.adc.da.slrs.zlTree.entity.ZlTreeData; +import com.adc.da.slrs.zlTree.service.IZlTreeDataService; import com.adc.da.util.UUIDUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -39,6 +41,9 @@ public class FileMaterialController extends BaseController { @Autowired IFileMaterialService iFileMaterialService; + @Autowired + IZlTreeDataService iZlTreeService; + @PostMapping @ApiOperation("新增文件资料组") public ResponseMessage addFileMaterial(@RequestBody FileMaterial material){ @@ -50,6 +55,12 @@ public class FileMaterialController extends BaseController { material.setId(UUIDUtils.randomUUID20()); material.setDataUploadTime(new Date()); material.setDelFlag("0"); + + ZlTreeData zlTreeData=new ZlTreeData(); + zlTreeData.setId(material.getTreeId()); + zlTreeData.setDataId(material.getId()); + iZlTreeService.save(zlTreeData); + boolean save = iFileMaterialService.save(material); return Result.success(save); @@ -61,7 +72,11 @@ public class FileMaterialController extends BaseController { public ResponseMessage deleteMaterial(String id){ List idList = Arrays.asList(id.split(",")); boolean b = iFileMaterialService.removeByIds(idList); - + if (null!= idList && idList.size()>0) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.in("data_id", idList); + iZlTreeService.remove(wrapper); + } return Result.success(b); } @@ -80,7 +95,12 @@ public class FileMaterialController extends BaseController { @ApiOperation("修改文件资料组") public ResponseMessage updateFileMaterial(@RequestBody FileMaterial fileMaterial){ boolean b = iFileMaterialService.updateById(fileMaterial); - + ZlTreeData zlTreeData=new ZlTreeData(); + zlTreeData.setId(fileMaterial.getTreeId()); + zlTreeData.setDataId(fileMaterial.getId()); + QueryWrapper wrapper=new QueryWrapper<>(); + wrapper.eq("data_id",fileMaterial.getId()); + iZlTreeService.update(zlTreeData,wrapper); return Result.success(b); } diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/entity/FileMaterial.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/entity/FileMaterial.java index a78643c7..636a2766 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/entity/FileMaterial.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/fileMaterialCenter/entity/FileMaterial.java @@ -71,4 +71,8 @@ public class FileMaterial extends BaseEntity { @ApiModelProperty(value = "删除标志") @TableField("is_show") private String isShow; + + @ApiModelProperty(value = "树id") + @TableField(exist = false) + private String treeId; } diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/fileMaterialCenter/FileMaterialMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/fileMaterialCenter/FileMaterialMapper.xml index 00eefb83..c4fa2869 100644 --- a/adc-da-slrs/src/main/resources/mybatis/mapper/fileMaterialCenter/FileMaterialMapper.xml +++ b/adc-da-slrs/src/main/resources/mybatis/mapper/fileMaterialCenter/FileMaterialMapper.xml @@ -18,7 +18,7 @@