原文:mybatis中报错attempted to return null from a method with a primitive return type (int).

查询总数没有值时报错 这个时候需要讲dao层接口的返回数据类型改成Integer就好了 ...

2020-09-21 09:31 0 2777 推荐指数:

查看详情

attempted to return null from a method with a primitive return type (int)

解决方法: 方法1:将boolean、int、long等基本数据类型改为封装数据类型,boolean封装数据类型为Boolean、int封装数据类型为Integer,根据个人项目逻辑,对返回值进行判断即可。方法2:使用MySQL种的IFNULL函数,IFNULL函数是MySQL控制流函数 ...

Tue Feb 25 23:36:00 CST 2020 0 2918
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM