解决:Could not find SQL statement to include with refid

2022/2/6 2:12:24

本文主要是介绍解决:Could not find SQL statement to include with refid,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

请检查xml文件的SQL标签和resultMap标签内容是否写正确了。

下面是正确的写法样例。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.wyx.dao.SysUserMapper">
    <resultMap id="BaseResultMap" type="com.wyx.model.SysUser">
        <id column="id" jdbcType="BIGINT" property="id" />
        <result column="name" jdbcType="VARCHAR" property="name" />
        <result column="nick_name" jdbcType="VARCHAR"
            property="nickName" />
        <result column="avatar" jdbcType="VARCHAR" property="avatar" />
        <result column="password" jdbcType="VARCHAR"
            property="password" />
        <result column="salt" jdbcType="VARCHAR" property="salt" />
        <result column="email" jdbcType="VARCHAR" property="email" />
        <result column="mobile" jdbcType="VARCHAR" property="mobile" />
        <result column="status" jdbcType="TINYINT" property="status" />
        <result column="dept_id" jdbcType="BIGINT" property="deptId" />
        <result column="create_by" jdbcType="VARCHAR"
            property="createBy" />
        <result column="create_time" jdbcType="TIMESTAMP"
            property="createTime" />
        <result column="last_update_by" jdbcType="VARCHAR"
            property="lastUpdateBy" />
        <result column="last_update_time" jdbcType="TIMESTAMP"
            property="lastUpdateTime" />
        <result column="del_flag" jdbcType="TINYINT" property="delFlag" />
    </resultMap>

    <sql id="Base_Column_List">
        id, name, nick_name, avatar, password, salt, email, mobile, status,
        dept_id, create_by,
        create_time, last_update_by, last_update_time, del_flag
    </sql>

    <select id="findAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from sys_user
    </select>
</mapper>

 



这篇关于解决:Could not find SQL statement to include with refid的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程