diff --git a/src/main/java/cn/teammodel/model/dto/Appraise/InsertNodeDto.java b/src/main/java/cn/teammodel/model/dto/Appraise/InsertNodeDto.java index 0b33ea5..37d430a 100644 --- a/src/main/java/cn/teammodel/model/dto/Appraise/InsertNodeDto.java +++ b/src/main/java/cn/teammodel/model/dto/Appraise/InsertNodeDto.java @@ -18,6 +18,7 @@ public class InsertNodeDto { @ApiModelProperty(value = "父亲节点,不传则为根节点", required = true) @NotBlank(message = "name 不能为空") String name; + String[] path; String logo; Integer order = 0; Integer score = 0; diff --git a/src/main/java/cn/teammodel/model/dto/Appraise/UpdateNodeDto.java b/src/main/java/cn/teammodel/model/dto/Appraise/UpdateNodeDto.java index cf5073a..832b8a3 100644 --- a/src/main/java/cn/teammodel/model/dto/Appraise/UpdateNodeDto.java +++ b/src/main/java/cn/teammodel/model/dto/Appraise/UpdateNodeDto.java @@ -14,6 +14,7 @@ public class UpdateNodeDto { @ApiModelProperty(value = "评价项节点的 id") String id; String name; + String[] path; String logo; Integer order; boolean isPraise; diff --git a/src/main/java/cn/teammodel/model/entity/appraise/AppraiseTreeNode.java b/src/main/java/cn/teammodel/model/entity/appraise/AppraiseTreeNode.java index f6387e6..02f7bbf 100644 --- a/src/main/java/cn/teammodel/model/entity/appraise/AppraiseTreeNode.java +++ b/src/main/java/cn/teammodel/model/entity/appraise/AppraiseTreeNode.java @@ -12,6 +12,7 @@ public class AppraiseTreeNode { String id; String pid; String name; + String[] path; String logo; String creator; String creatorId; diff --git a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java index d6ed5e4..9a241f2 100644 --- a/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java +++ b/src/main/java/cn/teammodel/service/impl/EvaluationServiceImpl.java @@ -176,7 +176,6 @@ public class EvaluationServiceImpl implements EvaluationService { throw new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "父节点不存在"); } } - // todo: 可不可以添加默认值 order ? newNode.setId(UUID.randomUUID().toString()); newNode.setCreatorId(loginUser.getId()); newNode.setCreator(loginUser.getName()); @@ -199,6 +198,7 @@ public class EvaluationServiceImpl implements EvaluationService { .orElseThrow(() -> new ServiceException(ErrorCode.PARAMS_ERROR.getCode(), "更新节点不存在")); // 更新字段,考虑直接 copy properties updateNode.setName(updateNodeDto.getName()); + updateNode.setPath(updateNodeDto.getPath()); updateNode.setLogo(updateNodeDto.getLogo()); updateNode.setOrder(updateNodeDto.getOrder()); updateNode.setPraise(updateNodeDto.isPraise()); @@ -386,7 +386,7 @@ public class EvaluationServiceImpl implements EvaluationService { .filter(item -> nodeId.equals(item.getId())) .findFirst().orElseThrow(() -> new ServiceException("该记录节点不存在")); // 鉴权(不是创建老师不能撤回) - if (!userId.equals(record.getCreatorId())) { + if (!userId.equals(record.getCreatorId()) || !loginUser.getRoles().contains("admin")) { throw new ServiceException(ErrorCode.NO_AUTH_ERROR.getCode(), "您不是创建老师,不能撤回"); } // 删除评价项并且恢复评分