@Test public void transfer() throws Exception { mockMvc.perform(MockMvcRequestBuilders.put("/groupdb/transfer") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
@RequestMapping(value = "/transfer", method = RequestMethod.PUT) public ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = groupDatabaseService.validatePermision(user, errors) .addAssert(() -> dataBaseDao.updateDataBaseInfo(dataBaseInfo.getId(), dataBaseInfo.getTarget_dal_group_id()) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }
GroupDatabaseController { @RequestMapping(value = "/transfer", method = RequestMethod.PUT) public ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = groupDatabaseService.validatePermision(user, errors) .addAssert(() -> dataBaseDao.updateDataBaseInfo(dataBaseInfo.getId(), dataBaseInfo.getTarget_dal_group_id()) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); } }
GroupDatabaseController { @RequestMapping(value = "/transfer", method = RequestMethod.PUT) public ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = groupDatabaseService.validatePermision(user, errors) .addAssert(() -> dataBaseDao.updateDataBaseInfo(dataBaseInfo.getId(), dataBaseInfo.getTarget_dal_group_id()) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  }
GroupDatabaseController { @RequestMapping(value = "/transfer", method = RequestMethod.PUT) public ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = groupDatabaseService.validatePermision(user, errors) .addAssert(() -> dataBaseDao.updateDataBaseInfo(dataBaseInfo.getId(), dataBaseInfo.getTarget_dal_group_id()) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/dblist") ServiceResult<List<DataBaseInfo>> getDBListByGroupId(@RequestParam("groupId") Long id); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/transfer", method = RequestMethod.PUT) ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); }
GroupDatabaseController { @RequestMapping(value = "/transfer", method = RequestMethod.PUT) public ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = groupDatabaseService.validatePermision(user, errors) .addAssert(() -> dataBaseDao.updateDataBaseInfo(dataBaseInfo.getId(), dataBaseInfo.getTarget_dal_group_id()) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/dblist") ServiceResult<List<DataBaseInfo>> getDBListByGroupId(@RequestParam("groupId") Long id); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/transfer", method = RequestMethod.PUT) ServiceResult<String> transfer(@Validated(TransferGroupDB.class) @RequestBody DataBaseInfo dataBaseInfo, @CurrentUser LoginUser user, Errors errors);  }