[mybatis]resultMap配置

 <resultMap id="brandResultMap" type="brand">
     <!--
            id:完成主键字段的映射
                column:表的列名
                property:实体类的属性名
            result:完成一般字段的映射
                column:表的列名
                property:实体类的属性名
        -->
     <result column="brand_name" property="brandName"/>
     <result column="company_name" property="companyName"/>
</resultMap>



<select id="selectAll" resultMap="brandResultMap">
    select *
    from tb_brand;
</select>

个人感觉这里还挺重要的,主要是在两种模式下命名不同习惯的情况下进行一个列的映射,相当于将两个连接起来 

猜你喜欢

转载自blog.csdn.net/qq_63499305/article/details/130714353