class ServerController {

    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ServiceResult<String> add(@Validated(AddServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors) throws Exception {
        server.setUpdate_user_no(user.getUserNo());
        ValidateResult validateRes = serverService.validatePermision(user, errors)
                .addAssert(() -> serverDao.isNotExistByIpAndPort(server), "此IP和端口已存在！")
                .addAssert(() -> serverService.insertServer(server)).validate();
        if (!validateRes.isValid()) {
            return ServiceResult.fail(validateRes.getSummarize());
        }
        return serverService.addDataCenter(user, server);
    }

}