@PheonixHkbxoic
2018-03-07T10:09:41.000000Z
字数 1648
阅读 1080
SpringBoot
<mapper namespace="cn.pheker.springbootdemo.dao.UserMapper"><resultMap id="BaseResultMap" type="cn.pheker.springbootdemo.model.User"><id column="id" jdbcType="VARCHAR" property="id" /><result column="login_name" jdbcType="VARCHAR" property="loginName" /><result column="real_name" jdbcType="VARCHAR" property="realName" /><result column="password" jdbcType="VARCHAR" property="password" /><result column="email" jdbcType="VARCHAR" property="email" /><result column="telephone" jdbcType="VARCHAR" property="telephone" /><result column="address" jdbcType="VARCHAR" property="address" /></resultMap><select id="selectAll" resultMap="BaseResultMap">select<include refid="Base_Column_List" />from t_user</select></mapper>
@MapperScan("cn.pheker.springbootdemo.mapper")
用来扫描*Mapper.xml这样的文件,参数是xml的basePackage,可配置多个
mybatis:mapperLocations: classpath*:cn/pheker/springbootdemo/mapper/*.xmltypeAliasesPackage: cn.pheker.springbootdemo.model
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.pheker.demo.springbootdemo.dao.TUserMapper.queryAll
发生此异常时须仔细检查上面注意事项,如果还是有问题,则在pom文件的build下添加
<!--打包时包含源代码包下的资源文件--><resources><resource><directory>src/main/java</directory><includes><include>**/*.properties</include><include>**/*.xml</include></includes></resource></resources>