Mapper.xml 返回值详解

一. Mapper.xml 返回值详解:

<?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.project.dao.UserDao">


    <!--
        resultMap: 结果集的映射:属性名和列名不一致的情况下, 多表查询
        id:唯一的标志
        type:返回值类型, 查询出来的数据最终还是封装到pojo对象中
        子标签:id: 一般用来配置主键, 
        属性:column ,列名  
             property:pojo中的属性名
             如果属性名和列名一致,属性名可以省略,建议都写上
             result: 非主键的映射
    -->
    <resultMap id="users" type="sysUser">
        <id column="u_id" property="id"></id>
        <result column="name" property="name"></result>
        <result column="address" property="address"></result>
        <result column="birthday" property="birthday"></result>
        <result column="sex" property="sex"></result>
    </resultMap>


    <select id="findAll" resultMap="users">
        select * from sys_user
    </select>

</mapper>

Mybatis 框架配置文件详解(SqlMapConfig.xml&&Mapper.xml)
Mybatis Mapper.xml 增删改查详解
Mapper.xml 传递参数详解

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值