java常见错误:Error querying database. Cause: java.lang.NumberFormatException: For input string: “PH

异常错误

###Error querying database. Cause: java.lang.NumberFormatException: For input string: “PHP”
###Cause: java.lang.NumberFormatException: For input string: “PHP”] with root cause

java.lang.NumberFormatException: For input string: “PHP”
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043) ~[na:1.8.0_251]
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110) ~[na:1.8.0_251]
at java.lang.Double.parseDouble(Double.java:538) ~[na:1.8.0_251]
at org.apache.ibatis.ognl.OgnlOps.doubleValue(OgnlOps.java:243) ~[mybatis-3.5.2.jar:3.5.2]
at org.apache.ibatis.ognl.OgnlOps.compareWithConversion(OgnlOps.java:100) ~[mybatis-3.5.2.jar:3.5.2]
at org.apache.ibatis.ognl.OgnlOps.isEqual(OgnlOps.java:143) ~

错误解析

java常见错误:Error querying database. Cause: java.lang.NumberFormatException: For input string: “PH_第1张图片
这边解析到0是int类型,默认进来到参数也应该是

解决方案

<select id="getCategoryPlate" resultType="com.mk.springboot.vo.CategoryPlateVO" parameterType="String">
        SELECT category.*, plate.`name` as `plateName` FROM category,plate WHERE category.plate_id=plate.id
        <if test='name != "0" and name != null'>
            AND category.name = #{name}
        </if>
 </select>

你可能感兴趣的:(springboot)