009 批量删除

devtools/2024/10/22 16:37:33/

文章目录

    • 前端
    • 后端

https://element.eleme.cn/#/zh-CN/component/button

前端

vue">    <el-button type="danger" @click="batchDelete">批量删除</el-button><el-treeref="menuTree"
vue">    batchDelete() {console.log("批量删除菜单...");//封装要删除的idlet ids = [];//通过eltree菜单 获取let checkedNodes = this.$refs.menuTree.getCheckedNodes();console.log("被选中的元素",checkedNodes);for (let index = 0; index < checkedNodes.length; index++) {//把选中的CheckBox的id值 添加到ids集合中ids.push( checkedNodes[index].id );}this.$confirm(`是否批量删除[${ids}]菜单?`, "提示", {confirmButtonText: "确定",cancelButtonText: "取消",type: "warning",}).then(() => {this.$http({url: this.$http.adornUrl("/product/category/delete"),method: "post",data: this.$http.adornData(ids, false),}).then(({ data }) => {this.$message({type: "success",message: "菜单批量删除成功!",});//重新刷新当前菜单this.getMenus();//设置需要默认展开的菜单, 设置为 要删除节点的父节点// this.expandedKey = [node.parent.data.id];});}).catch(() => {});},},

后端

@RestController
@RequestMapping("product/category")
public class CategoryController {/*** 删除*/@RequestMapping("/delete")//@RequiresPermissions("product:category:delete")public R delete(@RequestBody Integer[] ids){//直接删除方式//categoryService.removeByIds(Arrays.asList(ids));//TODO 检查当前要删除的菜单,是否被别的地方引用//逻辑删除方式categoryService.removeMenuByIds(Arrays.asList(ids));return R.ok();}}
@Service("categoryService")
public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity> implements CategoryService {/*** 逻辑删除菜单* @param asList*/@Overridepublic void removeMenuByIds(List<Integer> asList) {//TODO 检查当前要删除的菜单是否被别的地方引用//逻辑删除baseMapper.deleteBatchIds(asList);}
}
#mybatis
mybatis-plus:mapper-locations: classpath*:/mapper/**/*.xml#实体扫描,多个package用逗号或者分号分隔typeAliasesPackage: io.renren.modules.*.entityglobal-config:#数据库相关配置db-config:#主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";id-type: AUTOlogic-delete-value: -1logic-not-delete-value: 0banner: false#原生配置configuration:map-underscore-to-camel-case: truecache-enabled: falsecall-setters-on-nulls: truejdbc-type-for-null: 'null'

http://www.ppmy.cn/devtools/99466.html

相关文章

第九周:机器学习笔记

第九周机器学习周报 摘要Abstract机器学习——Spatial Transformer1.1 How to transform an image/feature map?&#xff08;怎么做&#xff09;1.2 Interpolation&#xff08;插值&#xff09;1.3 spatial Transformer的应用 Pytorch学习1. 线性层2. 其他层的介绍3. 搭建小实…

Stream Collectors.toMap 当value为null时报空指针

文章目录 Stream Collectors.toMap 当value为null时报空指针问题源码解决 Stream Collectors.toMap 当value为null时报空指针 问题 public class Demo {public static void main(String[] args) {List<Test> list new ArrayList<>();list.add(new Test("co…

Kubernetes全名及其缩写K8S的正确读音

Kubernetes&#xff0c;在希腊语意为“舵手”或“驾驶员”&#xff0c;在IT技术领域&#xff0c;这是一个开源系统&#xff0c;支持部署、扩缩和管理容器化应用。正如船长负责船舶在海上的安全航行一样&#xff0c;Kubernetes担负着安全编排和运送容器&#xff08;可理解为船上…

【线性相关 vs 双变量回归】数据点在斜率周围的聚集程度与斜率本身并不是一回事。

相关性分析(具体来说,皮尔逊成对相关性)和回归分析(具体来说,双变量最小二乘 (OLS) 回归)具有许多共同的特征: 两者都定期应用于两个连续变量(我们称之为 X 和 Y)。通常向学生介绍这两种图表时使用的是同一类型的图表:散点图。二者从根本上讲都是关于 X 中的偏差(即…

Android常见界面控件(二)

目录 ​前言 一、 RadioButton控件 设置RadioGroup的监听事件 二、CheckBox控件 三、Toast类 改变Toast窗口的提示位置 四、EditText控件 常用属性 前言 在上一篇中&#xff0c;我们讲解了三个常见的控件&#xff1a;TextView控件、Button控件、ImageView控件&#xf…

Comsol 考虑波导的二维星形空穴型声子晶体线缺陷压电能量收集优化方案

参考文献&#xff1a;Yang X , Zhong J , Xiang J .Optimization scheme for piezoelectric energy harvesting in line-defect for 2D starlike hole-type phononic crystals considering waveguides[J].AIP Advances, 2022, 12(1):-. 利用声子晶体(PnC)增强弹性波能收集是电…

在线英语学习小程序App源码开发技术探讨

引言 随着信息技术的飞速发展和全球化进程的加快&#xff0c;英语学习已经成为越来越多人的日常需求。传统的纸质材料和课堂教学已经无法满足现代人灵活、高效的学习需求。因此&#xff0c;开发一款在线英语学习小程序App成为了一个热门话题。本文将从技术角度探讨在线英语学习…

电脑文件自动加解密如何实现?3个方法教会你!

电脑文件的自动加解密是一项非常实用的功能&#xff0c;可以帮助确保数据的安全性。 以下是三种实现电脑文件自动加解密的方法&#xff1a; 方法一&#xff1a;使用操作系统自带的加密功能 Windows BitLocker&#xff1a; 启用BitLocker&#xff1a;在Windows系统中&#xf…