class ServerGroupController {

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ServiceResult<String> add(@Validated(AddServerGroup.class) @RequestBody ServerGroup serverGroup, @CurrentUser LoginUser user, Errors errors) throws Exception {
        serverGroup.setUpdate_user_no(user.getUserNo());
        ValidateResult validateRes = serverGroupService.validatePermision(user, errors)
                .addAssert(() -> serverGroupDaoOld.getCountByName(serverGroup.getName()) == 0, serverGroup.getName() + " 已存在！")
                .addAssert(() -> serverGroupDaoOld.insertServerGroup(serverGroup) > 0, message.db_message_add_operation_failed).validate();
        if (!validateRes.isValid()) {
            return ServiceResult.fail(validateRes.getSummarize());
        }
        return serverGroupService.addDataCenter(user, serverGroup);
    }

}