DatabaseSetEntryController { @RequestMapping(value = "/update", method = RequestMethod.PUT) public ServiceResult<String> update(@Validated(UpdateDbSetEntry.class) @RequestBody DatabaseSetEntry dbsetEntry, @CurrentUser LoginUser user, Errors errors) throws Exception { dbsetEntry.setUpdate_user_no(user.getUserNo()); String oldName = dataBaseSetEntryDao.getDataBaseSetEntryById(dbsetEntry.getId()).getName(); ValidateResult validateRes = databaseSetService.validatePermision(user, errors) .addAssert(() -> databaseSetEntryService.isNotExistByName(dbsetEntry), dbsetEntry.getName() + " 已存在！") .addAssert(() -> dataBaseSetEntryDao.updateDatabaseSetEntry(dbsetEntry) > 0, message.db_message_update_operation_failed).validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return databaseSetEntryService.updateDataCenter(user, dbsetEntry); }  @RequestMapping(value = "/{dbsetId}/list") ServiceResult<List<DatabaseSetEntry>> list(@PathVariable("dbsetId") Long dbsetId); @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<DatabaseSetEntryView>> loadPageList(@RequestBody Paging<DatabaseSetEntry> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddDbSetEntry.class) @RequestBody DatabaseSetEntry dbsetEntry, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/adds", method = RequestMethod.POST) ServiceResult<String> adds(@Validated(AddDbSetEntry.class) @RequestBody List<DatabaseSetEntry> list, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateDbSetEntry.class) @RequestBody DatabaseSetEntry dbsetEntry, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteDbSetEntry.class) @RequestBody DatabaseSetEntry dbsetEntry, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/sync") ServiceResult<String> sync(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/check") ConfigCkeckResult check(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/syncdb") ServiceResult<String> syncdb(@Validated(AddDbSetEntry.class) @RequestBody DatabaseSetEntry dbsetEntry, @CurrentUser LoginUser user, Errors errors); @RequestMapping("/buttons") ServiceResult getProjectButton(@CurrentUser LoginUser user);  }
@Test public void update() throws Exception { String requestJson = JSONObject.toJSONString(DatabaseSetEntry.builder().id(1L).name("name").build()); mockMvc.perform(MockMvcRequestBuilders.put("/groupdbSetEntry/update") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(requestJson) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }