每日Bug汇总--Day04

Bug汇总---Day04

一、项目运行报错

二、项目运行Bug

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

原因分析:

  • 前端是否正确接收到了参数'jishigonghao'(判断不是)
js 复制代码
    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
      })
  • 传递参数的时候后端API不能直接写string name这样,得用路径url传递参数

实现代码:

  • 前端
js 复制代码
    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
      })
    },
  • 后端
java 复制代码
	/**
	 * 后端查询根据技师工号查询技师姓名
	 */
	@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、按照上述修改完成以后还是出了问题

原因分析:

后端接收的参数层级不对

js 复制代码
console.log(res.data.data)
this.ruleForm.jishixingming = res.data.data

3、问题描述:

java 复制代码
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"])]

原因分析:

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

实现代码

js 复制代码
 console.log(res.data.data[0])
this.ruleForm.jishixingming = res.data.data[0]

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

分析原因:

  • SQL语句写的有问题
mysql 复制代码
 select count(*)
        from meirongxiangmu
        where xiangmumingcheng= #{xiangmumingcheng}
```rom meirongxiangmu
        where xiangmumingcheng= #{xiangmumingcheng}
  • 后台查询的Wrapper没有写条件
相关推荐
aramae11 分钟前
MySQL内置函数(7)
开发语言·笔记·后端·mysql·其他
bessyon13 分钟前
信息透明度与决策效率:一个技术视角的分析
笔记
张某布响丸辣37 分钟前
附件下载的安全边界:路径白名单、NAS 哨兵文件与 Redis Lua 一次性令牌
java·redis·redis lua·nas哨兵
YatHinLay1 小时前
Spring Boot + Calcite 实现跨库查询
java
hanlin031 小时前
刷题笔记:力扣第41题-缺失的第一个正数
笔记·算法·leetcode
酷炫码神2 小时前
MosMos 创意效果与能力边界展示
java
Wang's Blog2 小时前
Java 接入Redis: 使用Jedis操作Redis
java·服务器·redis
事圆则缓2 小时前
Java 8 Lambda、Stream、Optional 与 Android 边界:从回调语法到运行时兼容
android·java
shehuiyuelaiyuehao2 小时前
算法50,分治归并,数组中的逆序对
java·算法
烽学长2 小时前
(附源码)基于Springboot+vue的图书阅读分享系统的设计与实现
java·spring boot·后端