Bug汇总—Day05
一、项目运行报错
二、项目运行Bug
1、**问题描述:**前端将从后台查询的数据作为参数进行get请求,参数为空
原因分析:
- 这种写法可能只支全局的参数
- 调用方法的传参响应
代码实现
if (this.jishiName) {this.$http({url: `huiyuanyuyuexinxi/xiaofei/${this.jishiName}`,method: 'get'}).then(res => {console.log(res.data)// 读取接口请求成功回传回来的数据var Huiyuanxiaofeixinxis = res.data.Huiyuanxiaofeixinxis// 定义数组,存放一会覆盖echarts图形的数据var data = []console.log(Huiyuanxiaofeixinxis.length)// 循环遍历数组,取出数据,转成和data一样的格式for (var i = 0; i < Huiyuanxiaofeixinxis.length; i++) {var d = { name: '', value: 0 }d.name = Huiyuanxiaofeixinxis[i].xingmingd.value = Huiyuanxiaofeixinxis[i].nianxiaofeie// 往data数组中添加数据data.push(d)}// 排序,b - a降序——a - b升序data.sort((a, b) => b.value - a.value)// 覆盖data(){}中全局变量的数据this.dataHuiyuanXiaoliang = data// 画出图形this.DrawNian()}).catch(err => {console.log(err)console.log("后台接口请求失败!")})} else {this.$http({url: `jishi/jishiName/${this.$storage.get('adminName')}`,method: 'get'}).then(res => {console.log(res.data.data)this.jishiName = res.data.datathis.$http({url: `huiyuanyuyuexinxi/xiaofei/${this.jishiName}`,method: 'get'}).then(res => {console.log(res.data)// 读取接口请求成功回传回来的数据var Huiyuanxiaofeixinxis = res.data.Huiyuanxiaofeixinxis// 定义数组,存放一会覆盖echarts图形的数据var data = []console.log(Huiyuanxiaofeixinxis.length)// 循环遍历数组,取出数据,转成和data一样的格式for (var i = 0; i < Huiyuanxiaofeixinxis.length; i++) {var d = { name: '', value: 0 }d.name = Huiyuanxiaofeixinxis[i].xiangmumingchengd.value = Huiyuanxiaofeixinxis[i].count// 往data数组中添加数据data.push(d)}// 排序,b - a降序——a - b升序data.sort((a, b) => b.value - a.value)// 覆盖data(){}中全局变量的数据this.dataHuiyuanXiaoliang = data// 画出图形this.DrawNian()}).catch(err => {console.log(err)console.log("后台接口请求失败!")})console.log("技师姓名查询成功!")})}
2、问题描述: Parameter ‘jishiNames’ not found. Available parameters are [collection, list]
解决思路: 在DAO层方法参数加注解@Param(“jishiNames”)
实现代码:
List<JishinianyejitongjiEntity> selectJiShixiaofeixinxis(@Param("jishiNames") List<String> jishiNames);