每日Bug汇总--Day04

Bug汇总—Day04

一、项目运行报错

二、项目运行Bug

1、**问题描述:**下拉框关联数据,选择下拉框数据后,联动输入框中的数据查询不到,在后台接收到的是null

原因分析:

  • 前端是否正确接收到了参数’jishigonghao’(判断不是)
    selectJiShiNameBygonghao(jishigonghao) {
      this.$http({
        url: 'jishi/getJiShiGongName',
        method: 'get',
        params: jishigonghao
      }).then(res => {
        console.log("传递的参数")
        console.log(jishigonghao)
        console.log("查询技师姓名")
        console.log(res)
        console.log(res.data)
        this.ruleForm.jishixingming = res.data
      })

image-20240411153353468

  • 传递参数的时候后端API不能直接写string name这样,得用路径url传递参数

实现代码:

  • 前端
    selectJiShiNameBygonghao(jishigonghao) {
      this.$http({
        url: `jishi/getJiShiGongName/${jishigonghao}`,
        method: 'get',
      }).then(res => {
        console.log("传递的参数")
        console.log(jishigonghao)
        console.log("查询技师姓名")
        console.log(res)
        console.log(res.data)
        this.ruleForm.jishixingming = res.data
      })
    },
  • 后端
	/**
	 * 后端查询根据技师工号查询技师姓名
	 */
	@RequestMapping("/getJiShiGongName/{jishigonghao}")
	public R getJiShiGongName(@PathVariable("jishigonghao") String jishigonghao) {
		System.out.println("技师工号为:" + jishigonghao);
		List<String> result = jishiService.getJiShiGongName(jishigonghao);
		return R.ok().put("data", result);
	}

2、按照上述修改完成以后还是出了问题

image-20240411154104373

原因分析:

后端接收的参数层级不对

console.log(res.data.data)
this.ruleForm.jishixingming = res.data.data

image-20240411154332676

3、问题描述:

2024-04-11 15:49:31.385  WARN 3648 --- [nio-8080-exec-8] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_ARRAY token
 at [Source: (PushbackInputStream); line: 1, column: 287] (through reference chain: com.entity.MeirongxiangmuEntity["jishixingming"])]

原因分析:

  • 传递的参数中的技师姓名是个数组不是字符串

实现代码

 console.log(res.data.data[0])
this.ruleForm.jishixingming = res.data.data[0]

4、添加了一条重复项目名称的数据后,数据库所有的数据都变成了这条数据

image-20240411155656765

分析原因:

  • SQL语句写的有问题
 select count(*)
        from meirongxiangmu
        where xiangmumingcheng= #{xiangmumingcheng}
```rom meirongxiangmu
        where xiangmumingcheng= #{xiangmumingcheng}
  • 后台查询的Wrapper没有写条件
  • 14
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

卷Java

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值