[Solved] return null from a method with a primitive return type (int).

1. Error information:

org.apache.ibatis.binding.BindingException: Mapper method 'com.jack.all.mapper.TUserMapper.deleteById attempted to return null from a method with a primitive return type (int).
    at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:105) ~[mybatis-plus-core-3.2.0.jar:3.2.0]
    at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:61) ~[mybatis-plus-core-3.2.0.jar:3.2.0]
    at com.sun.proxy.$Proxy57.deleteById(Unknown Source) ~[na:na]
    at com.jack.all.service.impl.TUserServiceImpl.deleteId(TUserServiceImpl.java:62) ~[classes/:na]

2. Solution: the XML needs to write the corresponding, and the previous update is still performed with select, so an error is reported

    <update id="deleteById" parameterType="string">
        update t_user set isdelete=1
        <where>
            id=#{id}
        </where>
    </update>

Similar Posts: