mybatis-plus+vue+elementUI查询出带子项形式的树形数据

mybatis-plus+vue+elementUI

查询出带子项形式的树形数据

以计划事项为例(planItem)
在这里插入图片描述
element官网给的父项含子项的格式
在这里插入图片描述
所以输出的json数据中要有子项的数据
而依靠mybatis-plus的强大功能就可以直接查询出带子项数据的json数据
所以说mybatis-plus真香呀

在这里插入图片描述
我自己起名叫childPlanItems
所以mapping中collection的property也要叫childPlanItems
后面的子项数据都是存在childPlanItems中了
在这里插入图片描述
在这里插入图片描述
用created钩子函数执行selectAll方法

created: function () {
   
    this.selectAll();
  },
  methods: {
   
	selectAll() {
   
      let url =
        LIST_URL + "/" + this.currentPage + "/" + this.pageSize;
      this.axios({
   
        method: "POST",
        url: url,
        data: this.$data.searchForm,//查询用的,与本文无瓜
      })
        .then((res) => {
   
            this.$data.tableData = res.data.data.records;
            this.$data.totalCount = res.data.data.total; //totalcount
            this.$data.currentPage = res.data.data.current; //页数
        })
        .catch((error) => {
   
          this.$message.error(error);
        });
    },
  }

controller层

	@PreAuthorize("hasAuthority('/planItem')")
    @ApiImplicitParams({
   @ApiImplicitParam(name = "Authorization", value = "Authorization token", required = true, dataType = "string", paramType = 
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值