每日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没有写条件
相关推荐
alonewolf_992 分钟前
深入解析G1与ZGC垃圾收集器:原理、调优与选型指南
java·jvm·算法
小镇学者3 分钟前
【c++】C++字符串删除末尾字符的三种实现方法
java·开发语言·c++
rfidunion5 分钟前
springboot+VUE+部署(1。新建项目)
java·vue.js·spring boot
小翰子_5 分钟前
Spring Boot整合Sharding-JDBC实现日志表按月按周分表实战
java·spring boot·后端
weixin_3993806913 分钟前
OA 系统假死问题分析与优化
java·运维
豆沙沙包?33 分钟前
2026年--Lc334-2130. 链表最大孪生和(链表转数组)--java版
java·数据结构·链表
千寻技术帮33 分钟前
10347_基于Springboot的新疆旅游管理系统
spring boot·mysql·旅游·在线旅游
柒.梧.40 分钟前
SSM常见核心面试问题深度解析
java·spring·面试·职场和发展·mybatis
杨章隐1 小时前
Java 解析 CDR 文件并计算图形面积的完整方案(支持 MultipartFile / 网络文件)@杨宁山
java·开发语言
Renhao-Wan1 小时前
Java 并发基石:AQS (AbstractQueuedSynchronizer)
java·开发语言