每日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没有写条件
相关推荐
天若有情6736 分钟前
Java Swing 实战:从零打造经典黄金矿工游戏
java·后端·游戏·黄金矿工·swin
lichong95134 分钟前
Android studio 修改包名
android·java·前端·ide·android studio·大前端·大前端++
lichong95137 分钟前
Git 检出到HEAD 再修改提交commit 会消失解决方案
java·前端·git·python·github·大前端·大前端++
@yanyu66639 分钟前
Tomcat安装与HTML响应实战
java·tomcat·html
呼哧呼哧.1 小时前
Spring的核心思想与注解
数据库·sql·spring
mtactor2 小时前
投资理财学习笔记
笔记·学习·金融
Chen-Edward2 小时前
有了Spring为什么还有要Spring Boot?
java·spring boot·spring
magic334165632 小时前
Springboot整合MinIO文件服务(windows版本)
windows·spring boot·后端·minio·文件对象存储
云创智城-yuncitys2 小时前
SpringCloud 架构在智慧交通路侧停车系统中的实践:从技术落地到城市级服务升级
spring·spring cloud·架构·智慧城市·停车系统·充电系统源码
222you2 小时前
Git仓库推送到GitHub
git·github