mybatis使用中类属性名和数据库表字段名问题

起初我以为上述二者必须一致,后来发现也是可以像Hibernate那样在xml文件中进行映射的。

<mapper namespace="com.tenghu.mybatis.model.xml.DepartmentMapper">  
      
    <!-- 配置映射字段 -->  
    <resultMap type="Department" id="tab_department">  
        <id property="ids" column="ids"/>  
        <result property="deName" column="de_name"/>  
        <result property="pIds" column="p_ids"/>  
        <result property="deChargePerson" column="de_charge_person"/>  
        <result property="createTime" column="create_time"/>  
    </resultMap>  
      
    <!-- 查询所有部门 -->  
    <select id="queryAllDepartment" resultMap="tab_department">  
        select * from tab_department  
    </select>  
</mapper>  
原文地址:https://www.cnblogs.com/alden-it/p/6170032.html