提交 3bc0414b 编写于 作者: M mxd

修复分组缺失创建人、创建时间等信息的问题

上级 482150cf
......@@ -21,6 +21,14 @@ public class Group extends Attributes<Object> {
private String path;
private Long createTime;
private Long updateTime;
private String createBy;
private String updateBy;
/**
* 路径变量
*/
......@@ -108,20 +116,48 @@ public class Group extends Attributes<Object> {
return group;
}
public Long getCreateTime() {
return createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
public Long getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Group)) {
return false;
}
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Group group = (Group) o;
return Objects.equals(id, group.id) && Objects.equals(name, group.name) && Objects.equals(type, group.type) && Objects.equals(parentId, group.parentId) && Objects.equals(path, group.path);
return Objects.equals(id, group.id) && Objects.equals(name, group.name) && Objects.equals(type, group.type) && Objects.equals(parentId, group.parentId) && Objects.equals(path, group.path) && Objects.equals(createTime, group.createTime) && Objects.equals(updateTime, group.updateTime) && Objects.equals(createBy, group.createBy) && Objects.equals(updateBy, group.updateBy) && Objects.equals(paths, group.paths) && Objects.equals(options, group.options);
}
@Override
public int hashCode() {
return Objects.hash(id, name, type, parentId, path);
return Objects.hash(id, name, type, parentId, path, createTime, updateTime, createBy, updateBy, paths, options);
}
}
......@@ -232,6 +232,8 @@ public class DefaultMagicResourceService implements MagicResourceService, JsonCo
if (group.getId() == null) {
group.setId(UUID.randomUUID().toString().replace("-", ""));
}
group.setCreateTime(System.currentTimeMillis());
group.setCreateBy(WebUtils.currentUserName());
groupResource = resource.getDirectory(group.getName());
// 判断分组文件夹需要不存在
isTrue(!groupResource.exists(), FILE_SAVE_FAILURE);
......@@ -261,6 +263,9 @@ public class DefaultMagicResourceService implements MagicResourceService, JsonCo
Resource oldResource = getGroupResource(group.getId());
groupResource = resource.getDirectory(group.getName());
isTrue(oldResource != null && oldResource.exists(), GROUP_NOT_FOUND);
// 设置修改时间,修改人
group.setUpdateBy(WebUtils.currentUserName());
group.setUpdateTime(System.currentTimeMillis());
// 名字不一样时重命名
if (!Objects.equals(oldGroup.getName(), group.getName())) {
// 判断分组文件夹需要不存在
......@@ -368,6 +373,9 @@ public class DefaultMagicResourceService implements MagicResourceService, JsonCo
}
}
}
// 设置修改时间,修改人
src.setUpdateBy(WebUtils.currentUserName());
src.setUpdateTime(System.currentTimeMillis());
Resource oldResource = groupMappings.get(src.getId());
if (oldResource.renameTo(targetResource)) {
Resource resource = targetResource.getResource(Constants.GROUP_METABASE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册