Controller
@RestController
@RequestMapping("/riskevent")
@Api(value = "/riskevent", description = "风险事件管理")
public class SEventController extends MpBaseController {
@Autowired
private SEventService eventService;
/**
* 删除风险事件
* @param eventIds
* @return
*/
@RequiresPermissions("scyf:riskevent:remove")
@Log(title = "风险事件管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{eventIds}")
@ApiOperation(value = "/{eventIds}",notes = "删除事件")
public AjaxResult removeEvent(@ApiParam(value = "事件id")@PathVariable Integer[] eventIds){
return toAjax(eventService.removeByIds(Arrays.asList(eventIds)));
}
}
The @PathVariable annotation is mainly used for dynamic splicing addresses for deletion operations, which can satisfy both single deletion and multiple deletions.
Arrays.asList(eventIds) becomes a collection
Service
Because SEventService extends IService<SEvent>, you can directly operate the removeByIds() method
default boolean removeByIds(Collection<?> list) {
return CollectionUtils.isEmpty(list) ? false : SqlHelper.retBool(this.getBaseMapper().deleteBatchIds(list));
}