It's likely that neither a Result Type nor a Result Map was specified.

发布时间 2023-10-12 09:54:57作者: 风餮

It's likely that neither a Result Type nor a Result Map was specified.
很可能既没有指定结果类型也没有指定结果映射。

出现问题的代码:

本段代码功能是查询一张表的全部

点击查看代码
<mapper namespace="com.ding.dao.RoleDao">
    <!-- 用于select查询公用抽取的列 -->
    <sql id="columns">
		select id,role_name,role_code,description,create_time,update_time,is_deleted
	</sql>

    <select id="findAll">
        <include refid="columns"></include>
        from acl_role
        where is_deleted=0
    </select>
</mapper>

原因:

编写sql语句的mapper文件中没有写resultType或resultMap

解决:

添加 resultType="role"

点击查看代码
<mapper namespace="com.atguigu.dao.RoleDao">
    <!-- 用于select查询公用抽取的列 -->
	<sql id="columns">
		select id,role_name,role_code,description,create_time,update_time,is_deleted
	</sql>

    <!--查询所有-->
    <select id="findAll" resultType="role">
        <include refid="column"></include>
        from acl_role
        where is_deleted = 0
    </select>

</mapper>