|
@@ -23,7 +23,12 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private NodeAttachmentMapper nodeAttachmentMapper;
|
|
private NodeAttachmentMapper nodeAttachmentMapper;
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据ID查询附件信息
|
|
|
|
+ * @param id 附件ID
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public NodeAttachment getById(String id) {
|
|
public NodeAttachment getById(String id) {
|
|
try {
|
|
try {
|
|
@@ -42,6 +47,11 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据节点ID查询附件信息
|
|
|
|
+ * @param nodeId 节点ID
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public NodeAttachment getByNodeId(String nodeId) {
|
|
public NodeAttachment getByNodeId(String nodeId) {
|
|
try {
|
|
try {
|
|
@@ -59,7 +69,12 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 处理文件并保存附件信息
|
|
|
|
+ * @param filePath 文件路径
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public String processFileAndSave(String filePath) {
|
|
public String processFileAndSave(String filePath) {
|
|
@@ -134,9 +149,9 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
-// // 先根据nodeId删除其他的附件记录
|
|
|
|
-// nodeAttachmentMapper.deleteByNodeId(nodeId);
|
|
|
|
-// logger.info("删除nodeId对应的其他附件记录,nodeId: {}", nodeId);
|
|
|
|
|
|
+ // 先根据nodeId删除其他的附件记录
|
|
|
|
+ nodeAttachmentMapper.deleteByNodeIdAndIdNotEqual(nodeId, nodeAttachmentId);
|
|
|
|
+ logger.info("删除nodeId对应的其他附件记录,nodeId: {}", nodeId);
|
|
|
|
|
|
// 再查询要更新的记录是否存在
|
|
// 再查询要更新的记录是否存在
|
|
NodeAttachment existing = nodeAttachmentMapper.selectById(nodeAttachmentId);
|
|
NodeAttachment existing = nodeAttachmentMapper.selectById(nodeAttachmentId);
|