Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lepdou committed Aug 11, 2016
1 parent a91fce6 commit e45c7bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Expand Up @@ -4,22 +4,12 @@

public class OpenItemDTO extends BaseDTO {

private long id;

private String key;

private String value;

private String comment;

public long getId() {
return id;
}

public void setId(long id) {
this.id = id;
}

public String getKey() {
return key;
}
Expand Down
Expand Up @@ -70,7 +70,7 @@ public void updateItem(@PathVariable String appId, @PathVariable String env,
!StringUtils.isContainEmpty(item.getKey(), item.getValue(), item.getDataChangeLastModifiedBy()),
"key,value,dataChangeLastModifiedBy 字段不能为空");

RequestPrecondition.checkArguments(item.getKey().equals(key), "item payload can not be empty");
RequestPrecondition.checkArguments(item.getKey().equals(key), "path中的key和payload中的key不一致");

if (userService.findByUserId(item.getDataChangeLastModifiedBy()) == null) {
throw new BadRequestException("用户不存在");
Expand Down Expand Up @@ -100,12 +100,12 @@ public void deleteItem(@PathVariable String appId, @PathVariable String env,
throw new BadRequestException("用户不存在");
}

ItemDTO toDeletedItem = itemService.loadItem(Env.valueOf(env), appId, clusterName, namespaceName, key);
if (toDeletedItem == null){
ItemDTO toDeleteItem = itemService.loadItem(Env.valueOf(env), appId, clusterName, namespaceName, key);
if (toDeleteItem == null){
throw new BadRequestException("item不存在");
}

itemService.deleteItem(Env.fromString(env), toDeletedItem.getId(), operator);
itemService.deleteItem(Env.fromString(env), toDeleteItem.getId(), operator);
}

}

0 comments on commit e45c7bc

Please sign in to comment.