@Test public void delete() throws Exception { mvc.perform(MockMvcRequestBuilders.post("/appGroup/delete") .contentType(MediaType.APPLICATION_JSON_UTF8) .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
@RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = appGroupService.validatePermision(user, errors) .addAssert(() -> appGroupService.deleteCheck(appGroup.getId())) .addAssert(() -> appGroupService.deleteAppGroup(appGroup)) .validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }
AppGroupController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = appGroupService.validatePermision(user, errors) .addAssert(() -> appGroupService.deleteCheck(appGroup.getId())) .addAssert(() -> appGroupService.deleteAppGroup(appGroup)) .validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); } }
AppGroupController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = appGroupService.validatePermision(user, errors) .addAssert(() -> appGroupService.deleteCheck(appGroup.getId())) .addAssert(() -> appGroupService.deleteAppGroup(appGroup)) .validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  }
AppGroupController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = appGroupService.validatePermision(user, errors) .addAssert(() -> appGroupService.deleteCheck(appGroup.getId())) .addAssert(() -> appGroupService.deleteAppGroup(appGroup)) .validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<AppGroupView>> getGroupUsers(@RequestBody Paging<AppGroup> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/sync") ServiceResult<String> sync(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/check") ConfigCkeckResult<ConfigCheckItem> check(@RequestParam("id") Long id); }
AppGroupController { @RequestMapping(value = "/delete", method = RequestMethod.DELETE) public ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors) throws Exception { ValidateResult validateRes = appGroupService.validatePermision(user, errors) .addAssert(() -> appGroupService.deleteCheck(appGroup.getId())) .addAssert(() -> appGroupService.deleteAppGroup(appGroup)) .validate(); if (!validateRes.isValid()) { return ServiceResult.fail(validateRes.getSummarize()); } return ServiceResult.success(); }  @RequestMapping(value = "/list", method = RequestMethod.POST) ServiceResult<ListResult<AppGroupView>> getGroupUsers(@RequestBody Paging<AppGroup> paging); @RequestMapping(value = "/add", method = RequestMethod.POST) ServiceResult<String> add(@Validated(AddAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/update", method = RequestMethod.PUT) ServiceResult<String> update(@Validated(UpdateAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/delete", method = RequestMethod.DELETE) ServiceResult<String> delete(@Validated(DeleteAppGroup.class) @RequestBody AppGroup appGroup, @CurrentUser LoginUser user, Errors errors); @RequestMapping(value = "/sync") ServiceResult<String> sync(@RequestParam("id") Long id, @CurrentUser LoginUser user); @RequestMapping(value = "/check") ConfigCkeckResult<ConfigCheckItem> check(@RequestParam("id") Long id);  }