controller
/** * 删除业主管理 */ @PreAuthorize("@ss.hasPermi('owner:owner:remove')") @Log(title = "业主管理", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { // return toAjax(propertyOwnerService.deletePropertyOwnerByIds(ids)); return success(propertyOwnerService.deletePropertyOwnerByIds(ids)); }
impl
@Override public String deletePropertyOwnerByIds(Long[] ids) { //实现批量删除业主,如果包含成员则提示不能删除的id,统计成功删除的条数 Integer sum = 0; List<Integer> lst = new ArrayList<>(); for (int i = 0; i < ids.length; i++) { System.out.println(ids[i]); // 根据id查询pid数量是否大于0,大于则不能删除,并存入list里 if (propertyOwnerMapper.selectCountByPid(Math.toIntExact(ids[i]))>0){ lst.add(Math.toIntExact(ids[i])); } else { propertyOwnerMapper.deleteByPid(Math.toIntExact(ids[i])); propertyOwnerMapper.delete(Math.toIntExact(ids[i])); sum+=1; } } // 如果前端传过来的id数量等于删除的数量,则返回删除成功 if (ids.length==sum){ return "删除成功!"; } return "已成功删除"+sum+"条数据,其中"+lst+"包含成员,不能删除!"; }
vue
/** 删除按钮操作 */ handleDelete(row) { const ids = row.id || this.ids; this.$modal.confirm('是否确认删除业主管理编号为"' + ids + '"的数据项?').then(function() { return delOwner(ids); }).then(response => { this.getList(); this.$modal.msgSuccess(response.msg); }).catch(() => {}); },
设计车辆管理业务流程图
在线制作流程图地址: https://www.processon.com