BUG問題彙總表
因爲個人平時進場容易疏忽大意,經常性不止一次會犯重複性的錯誤,所以整理一份平時遇到的BUG問題表彙總,希望能夠鞭笞自己細心,多學習,多進步
BUG問題彙總表
2020.5.18
1.
【問題】:mybatis的xml文件中,SQL語句查出來的字段在實體類中沒有值,名稱和返回值都指定了
【原因】:沒有重新編譯
【如何發現】:斷點看查詢出來值的時候發現
【如何修復】:重啓IDEA之後就行了
【總結】:奇怪的BUG
2.
【問題】:Lock wait timeout exceeded; try restarting transaction
【原因】:這條語句在Mysql中被鎖住了
【如何發現】:打了斷點之後沒有放行再次重啓執行相應的SQL
【如何修復】:
1.首先查被鎖住的語句
select * from information_schema.innodb_trx
2.找到之後找到線程編號,字段爲trx_mysql_thread_id
3.通過命令殺死線程編號即可
kill 線程編號
【總結】:還是在測試的時候不夠小心導致
3.
【問題】:下載依賴時報錯:Cannot resolve org.openjfx:javafx.base:11.0.0-SNAPSHOT
【原因】:因爲項目設置的jre換成了11
【如何發現】:maven導入jia包時發現
【如何修復】:file-setting-build-build tools -maven -importing選項中的jdk導入選擇成8即可
【總結】:沒有總結
5.22
1.
【問題】:通過nexus搭建maven私服,倉庫名稱全都指定好了,在部署時報錯:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project integrated_tools: Failed to deploy artifacts: Could
not transfer artifact org.example:integrated_tools:pom:1.0-20200522.052151-1 from/to test (http://localhost:8212/repository/test/): Transfer failed for http://localhost:
8212/repository/test/org/example/integrated_tools/1.0-SNAPSHOT/integrated_tools-1.0-20200522.052151-1.pom 400 Repository version policy: RELEASE does not allow version:
1.0-20200522.052151-1
【原因】:倉庫名稱取名爲test,報錯
【如何發現】:通過mvn deploy部署時發現
【如何修復】:將maven配置的setting.xml文件與私服的關聯設置正確,並在工程的pom文件中配置倉庫,名稱要和setting.xml中的一樣之後,檢查倉庫名稱是否爲test,取名爲test所以報錯
【總結】:沒有總結
5.27
1.
【問題】:接口測試id數據正確,但是前端接收起來最後的尾數錯誤
【原因】:後端用Long類型超過17位導致前端接收精度丟失
【如何發現】:和前端聯調時發現
【如何修復】:
- 後端傳輸JSON格式化爲String類型的。
@JsonFormat(shape = JsonFormat.Shape.STRING)
private Long aliyunOssFileId;
@JsonFormat(shape = JsonFormat.Shape.STRING)
作用就是將JSON數據的此字段格式化爲字符串類型,保證前端超過17位不會出現精度丟失問題!
2.自己遍歷list,然後重新賦值…麻煩
IPage<AppAd> appAdIPage = appAdMapper.selectPage(page, new QueryWrapper<>(null));
List<AppAd> list = appAdIPage.getRecords();
//定於dto集合爲返回的值
ArrayList<AppAdRespDto> respDtos = new ArrayList<>();
if (list.size() > 0 ){
//遍歷填充每一個返回的dto
list.forEach(lists->{
AppAdRespDto respDto = new AppAdRespDto();
BeanUtils.copyProperties(lists,respDto);
//因爲Long類型超出17位前端解析會錯誤,所以轉String
respDto.setId(lists.getId().toString());
respDtos.add(respDto);
});
//return CommonResult.success(PageModel.buildByIPage(page.setRecords(list)));
return CommonResult.getSucceedInstance(respDtos,"成功");
}
推薦第一種
【總結】:新發現
6.8
1.
【問題】: Expected one result (or null) to be returned by selectOne(), but found: 2
【原因】:使用MyBatis查詢的結果需要一條數據(即一個實體),結果查出來有多條數據
【如何發現】:測試時
【如何修復】:
其實有兩種方式,根據業務來選擇吧
1. 在Mapper層返回值定義爲一個List即可接收多條數據
2. 排查sql語句,要麼是業務上面出現問題導致這條sql有兩條,要麼就是sql本身有問題,挨着排查即可
【總結】:沒有總結