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

@@ -87,17 +87,17 @@ export function permissionAddDialog() {
}
}
export function permissionDetailDialog() {
export function permissionDetailDialog(field = 'id') {
return {
actionType: 'dialog',
dialog: {
title: '新增确权申请',
title: '确权申请详情',
size: 'md',
actions: [],
body: {
debug: true,
...detailForm(),
initApi: apiGet('${base}/confirmation/detail/${id}'),
initApi: apiGet(`\${base}/confirmation/detail/\${${field}}`),
static: true,
data: {
detail: true,

View File

@@ -63,8 +63,9 @@ export function resourceList() {
...resourceEditeDialog(),
},
{
disabledOn: '${confirmationId}',
type: 'action',
label: '删除',
label: "${IF(confirmationId, '删除(确权中)', '删除')}",
confirmTitle: '确认删除',
confirmText: '确认删除名称为「${name}」的数据资源吗?',
actionType: 'ajax',

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;
}