소스 검색

1/18 其他参考资料

xiexiang 1 년 전
부모
커밋
e66e3bb059

+ 1 - 1
src/main/java/cn/cslg/pas/common/dto/business/OtherReferencesDTO.java

@@ -18,7 +18,7 @@ public class OtherReferencesDTO {
 
     private String remark;
 
-    private String referencesName;
+    private String referenceName;
 
     private String referenceUrl;
 

+ 1 - 1
src/main/java/cn/cslg/pas/common/vo/business/OtherReferencesVO.java

@@ -28,7 +28,7 @@ public class OtherReferencesVO {
     /**
      * 其他参考资料名称
      */
-    private String referencesName;
+    private String referenceName;
 
     private String referenceUrl;
 

+ 2 - 2
src/main/java/cn/cslg/pas/domain/business/OtherReferences.java

@@ -33,8 +33,8 @@ public class OtherReferences extends BaseEntity<OtherReferences> {
     /**
      * 其他参考资料名称
      */
-    @TableField(value = "references_name")
-    private String referencesName;
+    @TableField(value = "reference_name")
+    private String referenceName;
 
     @TableField(value = "reference_url")
     private String referenceUrl;

+ 24 - 4
src/main/java/cn/cslg/pas/service/business/OtherReferencesService.java

@@ -64,11 +64,11 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
             otherReferences = this.getById(id);
             BeanUtils.copyProperties(otherReferencesDTO, otherReferences);
             otherReferences.updateById();
+            //先删除 后添加
+            LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(AssoOtherReferencesFile::getOtherReferencesId, id);
+            assoReferencesFileService.remove(queryWrapper);
             if (!fileGuids.isEmpty()) {
-                //先删除 后添加
-                LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
-                queryWrapper.eq(AssoOtherReferencesFile::getOtherReferencesId, id);
-                assoReferencesFileService.remove(queryWrapper);
                 List<Integer> fileIds = this.addFile(otherReferences.getId(), fileGuids);
             }
         } else {
@@ -89,6 +89,12 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
         return otherReferences.getId();
     }
 
+    /**
+     * 新增文件与其他参考资料关联
+     * @param id
+     * @param fileGuids
+     * @return
+     */
     public List<Integer> addFile(Integer id, List<String> fileGuids){
         List<Integer> ids = new ArrayList<>();
         if (!fileGuids.isEmpty()) {
@@ -130,6 +136,11 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
         return otherReferencesVOS;
     }
 
+    /**
+     * 装载查询其他参考资料
+     * @param otherReferencesVOS
+     * @throws IOException
+     */
     public void loadOtherReferencesVOS(List<OtherReferencesVO> otherReferencesVOS) throws IOException {
         List<String> createIds = new ArrayList<>();
         otherReferencesVOS.forEach(item -> {
@@ -162,8 +173,17 @@ public class OtherReferencesService extends ServiceImpl<OtherReferencesMapper, O
 
     }
 
+    /**
+     * 删除其他参考资料
+     * @param ids
+     * @return
+     */
     public List<Integer> deleteOtherReferences(List<Integer> ids) {
         if (!ids.isEmpty()) {
+            //先删除附件
+            LambdaQueryWrapper<AssoOtherReferencesFile> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.in(AssoOtherReferencesFile::getOtherReferencesId, ids);
+            assoReferencesFileService.remove(queryWrapper);
             this.removeBatchByIds(ids);
         }
         return ids;