mybatis springMVC查询缺失字段

时间:2021-03-10 19:06:45

mybatis springMVC查询缺失字段

原因:

1、springMVC未配置自动映射

<!-- 配置类的自动映射 -->
<property name="configuration">
<bean
class="org.apache.ibatis.session.Configuration">

</bean>
</property>

2、数据库字段名与类的属性名没有一致

    类属性名遵循驼峰命名法
如数据库 :file_name     类的属性:fileName

3、如果前两点都没有错就用as标识

select attachment.id as id,attachment.native_name as nativeName,attachment.file_name as fileName
from
attachment