请检查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>