1
0

feat(web): 关联数据资源和确权状态

This commit is contained in:
2024-11-27 14:01:36 +08:00
parent 70d5a4549f
commit f15bcc2f53
4 changed files with 15 additions and 4 deletions

View File

@@ -76,6 +76,9 @@ public class DataResourceController extends SimpleController<DataResource, DataR
item.setDescription(dataResource.getDescription());
item.setType(dataResource.getType().getResourceType().name());
item.setFormat(dataResource.getFormat().getFormatType().name());
if (ObjectUtil.isNotNull(dataResource.getConfirmation())) {
item.setConfirmationId(dataResource.getConfirmation().getId());
}
item.setCreatedUser(dataResource.getCreatedUser().getUsername());
item.setCreatedTime(dataResource.getCreatedTime());
return item;
@@ -250,6 +253,7 @@ public class DataResourceController extends SimpleController<DataResource, DataR
private String description;
private String type;
private String format;
private Long confirmationId;
private String createdUser;
private LocalDateTime createdTime;
}

View File

@@ -2,6 +2,7 @@ package com.eshore.gringotts.web.domain.resource.entity;
import com.eshore.gringotts.core.Constants;
import com.eshore.gringotts.web.domain.base.entity.SimpleEntity;
import com.eshore.gringotts.web.domain.confirmation.entity.Confirmation;
import com.eshore.gringotts.web.domain.resource.entity.format.ResourceFormat;
import com.eshore.gringotts.web.domain.resource.entity.type.ResourceType;
import com.eshore.gringotts.web.domain.upload.entity.DataFile;
@@ -33,12 +34,14 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@NamedEntityGraph(name = "data_resource.list", attributeNodes = {
@NamedAttributeNode(value = "type"),
@NamedAttributeNode(value = "format"),
@NamedAttributeNode(value = "confirmation"),
@NamedAttributeNode(value = "createdUser"),
})
@NamedEntityGraph(name = "data_resource.detail", attributeNodes = {
@NamedAttributeNode(value = "type"),
@NamedAttributeNode(value = "format"),
@NamedAttributeNode(value = "example"),
@NamedAttributeNode(value = "confirmation"),
@NamedAttributeNode(value = "createdUser"),
@NamedAttributeNode(value = "modifiedUser"),
})
@@ -58,4 +61,7 @@ public class DataResource extends SimpleEntity {
@JoinColumn(foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT))
@ToString.Exclude
private DataFile example;
@OneToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER, mappedBy = "target")
@ToString.Exclude
private Confirmation confirmation;
}