@Test public void update() throws Exception { mockMvc.perform(MockMvcRequestBuilders.put("/server/update") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
@RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateServer.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.updateServer(server) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return serverService.updateDataCenter(user, server); }
ServerController { @RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateServer.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.updateServer(server) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return serverService.updateDataCenter(user, server); } }
ServerController { @RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateServer.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.updateServer(server) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return serverService.updateDataCenter(user, server); }  }
ServerController { @RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateServer.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.updateServer(server) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return serverService.updateDataCenter(user, server); }  @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<ServerView>> loadPageList(@RequestBody Paging<Server> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/sync") ServiceResult<String> sync(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/check") ConfigCkeckResult<ConfigCheckItem> check(@CurrentUser LoginUser user, @RequestParam("id") Long id); }
ServerController { @RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateServer.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.updateServer(server) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return serverService.updateDataCenter(user, server); }  @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<ServerView>> loadPageList(@RequestBody Paging<Server> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteServer.class) @RequestBody Server server, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/sync") ServiceResult<String> sync(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/check") ConfigCkeckResult<ConfigCheckItem> check(@CurrentUser LoginUser user, @RequestParam("id") Long id);  }